Author Topic: Rotate relative to fixed axis?  (Read 3326 times)

Offline stonef

  • byte
  • *
  • Posts: 2
    • View Profile
Rotate relative to fixed axis?
« on: May 05, 2011, 03:29:59 am »
How do i rotate a Object3D relative to it's originally fixed axis? Like for example if i want to rotate without jPCT i call
gl.glRotatef(xangle, 1, 0, 0) //rotate X axis
gl.glRotatef(yangle, 0, 1, 0) //rotate Y axis

Meaning i will always let Z be unchanged.

If i use myObj.rotateX / myObj.rotateY i will end up with Z axis changed as well.

Offline Kaiidyn

  • long
  • ***
  • Posts: 103
    • View Profile
Re: Rotate relative to fixed axis?
« Reply #1 on: May 05, 2011, 10:05:30 am »
Not sure this is what you are looking for, but try calling myObj.clearRotation() before calling the actual rotation.
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: 12295
    • View Profile
    • http://www.jpct.net
Re: Rotate relative to fixed axis?
« Reply #2 on: May 05, 2011, 05:15:39 pm »
You can rotate any axis using the rotateAxis-method.