Author Topic: Rotating Object  (Read 1253 times)

Offline Kaiidyn

  • long
  • ***
  • Posts: 103
    • View Profile
Rotating Object
« on: November 23, 2010, 03:23:53 pm »
When using Object3D.rotateX the object rotates the object with the value given.
Is it possible to do like Object3D.rotateX(Math.toRadians(45)); in the renderloop and keep the object rotated at 45 degrees, instead of adding 45 deg. to the current rotation value?

Edit: Also is it possible to get the current rotate value?
« Last Edit: November 23, 2010, 03:56:20 pm by Kaiidyn »
Clean code is simple and direct. Clean code reads like well-written prose. Clean code never obscures the designer’s intent but rather is full of crisp abstractions and straightforward lines of control. - Grady Booch

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11777
    • View Profile
    • http://www.jpct.net
Re: Rotating Object
« Reply #1 on: November 23, 2010, 08:52:36 pm »
You can clear the rotation in each iteration and re-set it to 45° (or whatever afterwards). Object3D.clearRotation() is your friend. About the second question: Yes and no...all rotations accumulate to a matrix. You can get some euler angles back from that one (the forum should actually contain various code for this), but there's no guarantee that they'll match the ones that you used to create the matrix. If you really need this, it's a better idea to keep track of the angles yourself IMHO.

Offline Kaiidyn

  • long
  • ***
  • Posts: 103
    • View Profile
Re: Rotating Object
« Reply #2 on: November 23, 2010, 10:55:21 pm »
Awesome, got it working now :)
thanks mate
Clean code is simple and direct. Clean code reads like well-written prose. Clean code never obscures the designer’s intent but rather is full of crisp abstractions and straightforward lines of control. - Grady Booch