Author Topic: Best practice to rotate?  (Read 1688 times)

Offline Marius

  • byte
  • *
  • Posts: 4
    • View Profile
Best practice to rotate?
« 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

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Best practice to rotate?
« Reply #1 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.

Offline Marius

  • byte
  • *
  • Posts: 4
    • View Profile
Re: Best practice to rotate?
« Reply #2 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.