I had to do somethign similiar a week ago and I couldn't tween that
number...and I had the exact effects you had that one of them would go
around the long way.....

The only thing I could get workign was something like this function, that
I've used alot:

function properRotation(target_rotation,my_rotation,smooth) {
               var rot =target_rotation-my_rotation;
               while (rot<0) {
                       rot += 360;
               }
               while (rot>180) {
                       rot -= 360;
               }
               my_rotation += rot/smooth;
      return my_rotation;
}

Hope it helps or someone has a better work around.

-Pete

On Wed, Jan 28, 2009 at 4:44 PM, simplychaos <[email protected]> wrote:

>
> Ok this question is a little complicated, but hopefully someone can
> make some sense of it. I have 5 planes arranged in a circle, all
> facing outward from the center point they are based around. The idea
> is to let the user rotate around them, which works fine. I have it set
> up so you can click on a given plane and it will rotate around to it.
> So the problem comes when I want the selected plane to smoothly rotate
> toward the camera as the camera is rotating around toward the plane. I
> have created a "dummy" Object3D, set it's x,y,z to the same as the
> plane, and told it to lookAt(camera.position), then I adjust pitch so
> it is facing correctly (which I tested with the actual plane before).
> So I should have calculated the exact rotation that I want to tween to
> for that frame, right? I use TweenMax to tween to that frame, and for
> 1 out of the 5 planes it works perfectly. Camera is set to lookAt
> plane, and plane is tweening to lookAt camera, and they match up
> perfectly every time. The other four all tween toward different weird
> angles though... If I get rid of the tween and just set the plane to
> lookAt camera, getting the rotation the same way with Object3D, it
> works fine, but obviously just snaps to look at the camera instantly.
> So I don't think there is any problem with my code, since it's
> obviously getting the correct rotation variables. Any suggestions?




-- 
___________________

Actionscript 3.0 Flash 3D Graphics Engine

HTTP://AWAY3D.COM

Reply via email to