Fabrice,

Thanks for your swift response. I have tried: aligntopath false and
true. The returned rotationY still ranges between 180 - (-180);

Here my code:

this.animator = new PathAnimator(p,this.raceEngine,{   duration:5000,
                                                                                
lookat:false,
                                                                                
aligntopath:true,
                                                                                
targetobject:null,
                                                                                
offset:new Number3D(0,0,0),
                                                                                
rotations:null
                                                                                
});

this.camAnimator = new PathAnimator(p,this.camera,{ duration:5000,
                                                                                
lookat:false,
                                                                                
aligntopath:true,
                                                                                
targetobject:this.animator.object3d,
                                                                                
offset:new Number3D(0,20,-25),
                                                                                
rotations:null
                                                                                
});

The raceEngine is the airplane. The camera is supposed to follow the
plane and always look at raceEngine's back(cam is always behind the
airplane). The cam distance to the raceEngine is -25 z-offset.

According to your explanation, if the cam offset Z is set to -25 and
camAnimator.aligntopath to true, the camera will rotate around the
racEngine's(camera) center point. However, this didn't work for me. I
am using 3.0.0 Branch and can't go back to the latest trunk.

Any Ideas?
Thanks, Patrick


Fabrice wrote:
> >  If I trace the rotationY of the camera
> > the output is incorrect. It starts at  0, goes to 90 as expected.
> > After 90 degrees goes up 179 and then jumps to 0.
> is campathanimator aligntopath:true? if yes, set to false.
>
> don't know if applicable but why not simply add campathanimator.target
> =  targetanimator.object3d?
> set campathanimator.lookat = true;
>
> > To manipulate the relative position
> > to the object I access the offset Number3D of the cameraPathAnimator
> > and update it according to the camera rotationY.
> don't forget that If you have aligntopath set to true, the offset is
> rotated as well, relative to object3d position.
> object3d being the object you pass to the pathanimator.
>
> Doing a project atm with very similar construction, including multiple
> pathsanimators
> everything is working ok, without a single calculation required in
> main class
> except of course the 0/1 increase values for the update().
>
> Also you should run the latest trunk, many modifications were made on
> the Path related classes. (and more will follow)
>
> Fabrice
>
> On Jan 25, 2009, at 10:21 PM, Patrick wrote:
>
> >
> > Hi All,
> >
> > I am trying rotate a camera around an object.
> >
> > The object is assigned to a pathAnimator and the camera to another
> > one. Both Animators load the same path so the camera and the object
> > are always on the same coordinate. To manipulate the relative position
> > to the object I access the offset Number3D of the cameraPathAnimator
> > and update it according to the camera rotationY.
> >
> > So this is simple trigonometry. I define the x and z offset of the
> > camera with cosine and sine. What I need for the calculation is the
> > current angle of the camera. If I trace the rotationY of the camera
> > the output is incorrect. It starts at  0, goes to 90 as expected.
> > After 90 degrees goes up 179 and then jumps to 0.
> >
> > The returned value should be linear to the rotation of the object and
> > range from 0 - 359 degrees.
> > Has Anyone ideas for a workaround? Help would be appreciated
> >
> > Thanks, Patrick

Reply via email to