TrackballController (THREE JS TrackballControls) Free 3D Object rotation

Software: Away3D 4.x

Fidel, Newbie
Posted: 31 July 2013 03:03 PM   Total Posts: 4

There seems to be no easy way to freely rotate a 3D object with the mouse. I built a 3d bottle in WebGL using the three.js framework. See the demo at http://warsteiner.de/bottle I was wondering if there is any “easy” way to achieve the same mouse interactions in Away3d. The HoverController class comes close but isn’t really free rotation. See the Away3d version with HoverController at http://warsteiner.de/bottle/as3.

I guess would be nice to have a Controller like the one in Three js. Or did I miss something?

   

Avatar
theMightyAtom, Sr. Member
Posted: 31 July 2013 04:38 PM   Total Posts: 669   [ # 1 ]

I would write a navigation to Spin the bottle, rather than move the camera as the HoverCamera works.

Warsteiner, great beer smile
I’m sure I could build you the navigation class, and fix your label material for a case or two…

Good Luck!

   

Fidel, Newbie
Posted: 01 August 2013 07:37 AM   Total Posts: 4   [ # 2 ]

@theMightyAtom

I tried to rotate the bottle itself using the objects rotationX and ...Y properties and the mouse coordinates. That works as expected when the bottle isn’t rotated in the Y direction. After that when I drag up the bottles X rotation ins’t as one would expect it. Maybe you can hint me in the right direction? In which country do you live?

Here is my code:

if ( _mouseIsDown )
{
    TweenMax
.to(_bottleSettings.ANIMATION_TIME_NORMAL{rotationX:_bottle.rotationX + (_lastMouseY stage.mouseY), rotationY:_bottle.rotationY + (_lastMouseX stage.mouseX)});
   

Avatar
theMightyAtom, Sr. Member
Posted: 01 August 2013 09:47 AM   Total Posts: 669   [ # 3 ]

I’m in Denmark, have a good friend in Berlin who always brings me a case on Warsteiner (or something similar) on his way through Flensborg wink

I would put the bottle in a container, then you can manipulate the different axis of rotation separately.

If you are using Loader3D, for example, then you could control the y axis of the loader, and the x-axis of the bottle Mesh within. That’s generally easier than calculating rotation matrices.

Cheers!

   

Fidel, Newbie
Posted: 01 August 2013 10:37 AM   Total Posts: 4   [ # 4 ]

I’ll give it a try. If I get the opportunity to come to Denmark, the beer is on me smile

   

Fidel, Newbie
Posted: 02 August 2013 08:46 AM   Total Posts: 4   [ # 5 ]

Now I have the X and Y axis working quite well. Do you have an idea how I can get the Z axis in there without messing up the other two axis.

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X