Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 19 Oct 2012
Offline Last Active Oct 21 2012 07:58 AM

Topics I've Started

ogrekit applyTorque orientation problem

19 October 2012 - 11:39 AM


I am trying to rotate a 3d object in ogrekit by applying applyTorque(). This works fine when the object orientation is not changed. But for example if i rotate my object 90 degrees to the left, only the object itself seems to rotate, the orientation of the object seems to stay the same. This causes the following problem:

If i use applyTorque() while the object is still in it's begin orientation(with up Arrow keyboard button):


If i use applyTorque() while the object is rotated 90 degrees clockwise(with up Arrow keyboard button):


I tried to use quaternions to change the orientation, but this doesn't seem to do anything. What am i doing wrong?


gkVector3 speedd, torque;

gkQuaternion orientation;
orientation = blockObj->getOrientation();//blockObj is the object i'm trying to rotate.

gkVector3 newX;

  newX = orientation * gkVector3::UNIT_X;
  torque -= newX;


blockObj->applyTorque(gkVector3(torque.y, torque.x, torque.z));


I hope my explanation/question is understandable. It's hard to explain.