3d Object Spin?

Request and discuss new features and functions for WireFusion and the different add-ons.

3d Object Spin?

Postby jerrylew2000 » Thu Aug 28, 2003 7:16 am

Does WireFusion have the capablities to use sets of 8, 16 or 32 pictures of an object and make it spin. If you move the mouse to the right the object spins right and left the same. I have a turning platform that stops at 8, 16 and 32 positions. I also have a program that can assemble the the pictures and make it a 3D object using Java Script. I would pefer to use WireFusion. Please any help would be very much appreciated.
jerrylew2000
 
Posts: 2
Joined: Mon Aug 18, 2003 6:51 pm

Postby naxos » Fri Aug 29, 2003 1:01 am

yep, it does have... i mean you can make it quite easilly...

here you'll find plenty of them : http://infogence.biz/kidp

regards.
Naxos, 3D Photographist
WF test page : http://web3d.go.dyndns.org
"1+1=3... for large values of 1"
"Circle is the fastest way from a point to itself"
naxos
 
Posts: 427
Joined: Tue May 20, 2003 1:26 pm
Location: Lille, France (north)

Postby Stefano » Fri Aug 29, 2003 2:00 pm

Well, those VR examples was not made with WireFusion.

Currently there is no ready made solution for this in WireFusion. You could create it using the ImageArray object and a set of MouseAreas, but it's not a perfect solution.

We've had some thoughts of making a real VR object to facilate this...

/Stefano
Stefano
 
Posts: 680
Joined: Sat Feb 08, 2003 11:07 am
Location: Stockholm, Sweden

Postby naxos » Mon Sep 01, 2003 2:25 pm

Stefano wrote:Well, those VR examples was not made with WireFusion.
/Stefano


ohhh... oups... i though so...

strange they posted in WF forum ;-)
Naxos, 3D Photographist
WF test page : http://web3d.go.dyndns.org
"1+1=3... for large values of 1"
"Circle is the fastest way from a point to itself"
naxos
 
Posts: 427
Joined: Tue May 20, 2003 1:26 pm
Location: Lille, France (north)

sample code

Postby jeffOstrander » Mon Sep 01, 2003 9:42 pm

jerrylew2000,

As Stefano mentioned, the ImageArray object can easily house your collection of images. Here's a fairly easy way to display the correct picture from the image array in response to the user dragging across the face of the picture...

You'll need three objects...

1. The Image Array:
2. a Java object from the Misc menu.
3. (optional) A Number object from the Data menu. (You can use this to set the number of images in your collection, or just type the value in the arrayIndexMax variable in the Java code.)

When you've added these objects,

1. Fill the Image Array with your images (being sure to add them in the correct order to simulate object rotation.)

2. Open the Java object and, following the lines...
Code: Select all
   public void init() {
   }

...paste this code:
Code: Select all
   private int prevX = 0;
   private int arrayIndex = 0;
   private int arrayIndexMax = 1;
   public void inport_MouseDrag(double x, double y) {
      if (x > prevX){
         if (arrayIndex < arrayIndexMax - 1){arrayIndex ++;}
         else{arrayIndex = 0;}
      }
      else if (x < prevX){
         if (arrayIndex > 1){arrayIndex --;}
         else{arrayIndex = arrayIndexMax;}
      }
      sendNumber("arrayIndex", arrayIndex);
   }
   //set number of available pictures
   public void inport_setPictureCount(double arg) {
      arrayIndexMax = (int) arg;
   }


3. Press OK to close the Java object.

4. Open the Number object.
a. Set the Value to the number of images in your "rotation".
b. Check "Push value at presentation startup".

5. Wire Number 1.Value Pushed -> Java 1.setPictureCount.

6. Wire Image Array 1.Mouse Events/Mouse Drag -> Java 1.Mouse Drag

7. Wire Java 1.arrayIndex -> Image Array 1.Display Image
jeffOstrander
 
Posts: 307
Joined: Tue Jan 28, 2003 5:40 pm
Location: Grand Rapids, Michigan, USA

Thank You

Postby jerrylew2000 » Wed Sep 03, 2003 9:27 am

Thank you guys for your help!
jerrylew2000
 
Posts: 2
Joined: Mon Aug 18, 2003 6:51 pm

Postby Stefano » Wed Sep 03, 2003 10:24 am

Jeff,

there was a small problem with your code. You could only rotate in one direction. This has been fixed with the below code. A new inport was also added, which is used to set the start picture (index).

Here is a project file using this:
http://www.demicron.com/download/projec ... xample.zip

It would be nice to be able to set speed as well... :)


/Stefano

Code: Select all
      private int prevX = 0;
   private int arrayIndex = 0;
   private int arrayIndexMax = 1;
   public void inport_MouseDrag(double x, double y) {
      if (x > prevX){
         if (arrayIndex < arrayIndexMax){arrayIndex ++;}
         else{arrayIndex = 0;}
      }
      else if (x < prevX){
         if (arrayIndex > 0){arrayIndex --;}
         else{arrayIndex = arrayIndexMax;}
      }
      prevX = (int)x;
      sendNumber("arrayIndex", arrayIndex);
   }
   //set number of available pictures
   public void inport_setStartPicture(double arg) {
         arrayIndex = (int)arg;
      sendNumber("arrayIndex", arrayIndex);   
   }
   public void inport_setPictureCount(double arg) {
      arrayIndexMax = (int)arg-1;
   }
Stefano
 
Posts: 680
Joined: Sat Feb 08, 2003 11:07 am
Location: Stockholm, Sweden

Postby Guest » Wed Sep 03, 2003 2:36 pm

Oops, forgot to reset my reference variable, didn't I? (That's what you get for writing code just to answer a question :? )

Could we set the rotational speed by measuring the delta of prevX and the current X? I modified your last post to do this and it seems to yield a pretty proportionate "feel" as you drag back and forth across the Image Array object at various speeds. I'm sure it could be done better, but for the sake of discussion...

Code: Select all
    private int prevX = 0;
   private int arrayIndex = 0;
   private int arrayIndexMax = 1;
   private int rotatorWidth = 120;
   public void inport_MouseDrag(double x, double y) {
         int stepsApplied = Math.abs(((int) x - prevX)) / (rotatorWidth/arrayIndexMax);
         //If this is first drag event, just get x so we know where we are.  We'll rotate on next drag.
         if (prevX != 0){
         if (x > prevX){
            if (arrayIndex < arrayIndexMax){arrayIndex += stepsApplied;}
            else{arrayIndex = 0;}
         }
         else if (x < prevX){
            if (arrayIndex > 0){arrayIndex -= stepsApplied;}
            else{arrayIndex = arrayIndexMax;}
         }
         //just for testing
         sendText("stepsApplied", "moved from " + prevX + " to " + x + " which is " + stepsApplied + " steps");
         if (stepsApplied != 0) prevX = (int)x; //if the move was not large enough to constitute 1 step, just save our previous spot
         sendNumber("arrayIndex", arrayIndex);
      }
      else{prevX = (int)x;}
   }
   //set number of available pictures
   public void inport_setStartPicture(double arg) {
      arrayIndex = (int)arg;
      sendNumber("arrayIndex", arrayIndex);   
   }
   public void inport_setPictureCount(double arg) {
      arrayIndexMax = (int)arg-1;
   }
   public void inport_rotatorRollOff() {
      prevX = 0;
   }   
   public void inport_setRotatorWidth(double arg) {
      rotatorWidth = (int)arg;
   }


This does require a couple of additional inports.
* setRotatorWidth, which tells us how big the rotator is so we can calculate speed of rotation. This should be called on presentation start up (or the user could skip the inport and just set rotatorWidth directly in the code.)
* rotatorRollOff, which we probably should have thought of earlier. It compensates for the fact that the last x position of the previous drag will not necessarily be the first x position for the next drag. This should be wired as Image Array 1.Mouse Events/Mouse Roll Out -> Java 1.rotatorRollOff
Guest
 


Return to Request a Feature

Who is online

Users browsing this forum: No registered users and 0 guests

cron