Best practice to rotate?

Started by Marius, June 20, 2013, 03:11:45 PM

Previous topic - Next topic

Marius

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

EgonOlsen

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.

Marius

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.