www.jpct.net

jPCT - a 3d engine for Java => Support => Topic started by: Marius on June 20, 2013, 03:11:45 pm

Title: Best practice to rotate?
Post by: Marius on June 20, 2013, 03:11:45 pm
Hello,

I have another beginner question..
I want to rotate (animate) an object by a exact amount. Lets say PI. I use the Object3D.rotX/Y/Z method to do this. The step size is 0.02. Then when the progress of the rotation is >= PI i set a flag to false and stop the animation. My problem is that in this way the rotation isn't exact. There is a little offset. How is the "normal" (exact) way to do this?

Again thanks in advance,
Marius
Title: Re: Best practice to rotate?
Post by: EgonOlsen on June 20, 2013, 08:19:06 pm
Either correct the step for the last iteration, so that it stops at PI or detect the case that it has stopped, clear the rotation and apply a single rotation around PI.
Title: Re: Best practice to rotate?
Post by: Marius on June 21, 2013, 08:31:42 am
Thank you for your answer. I did the correction thing, but i thought that there must be a more elegant way. Clearing the rotation and set a single rotation around PI sounds good.