Rotating Object

Started by Kaiidyn, November 23, 2010, 03:23:53 PM

Previous topic - Next topic

Kaiidyn

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?
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

EgonOlsen

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.

Kaiidyn

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