I'm trying to change an object's rotation using the following code, but it doesn't seem to do anything:
void dynamics_box::rotate(const float3 Angles)
{
btTransform Transformation;
motion_state->getWorldTransform(Transformation);
btQuaternion Quat = Transformation.getRotation();
btQuaternion Trans = btQuaternion(Angles.x, Angles.y, Angles.z);
btQuaternion Result = Quat * Trans;
Transformation.setRotation(Result);
motion_state->setWorldTransform(Transformation);
}
Any ideas what I'm doing wrong here?
Changing an object's rotation
-
- Posts: 52
- Joined: Mon Jul 19, 2010 3:11 am
Re: Changing an object's rotation
I'm doing this like that:
Code: Select all
void dynamics_box::rotate(const float3 Angles)
{
btTransform Transformation;
motion_state->getWorldTransform(Transformation);
Transformation.getBasis().setEulerYPR(Angles.y,Angles.x, Angles.z);
motion_state->setWorldTransform(Transformation);
}
-
- Posts: 37
- Joined: Wed Jul 27, 2011 12:01 am
Re: Changing an object's rotation
Tried that, didn't work. Object remains in its initial state.
-
- Posts: 52
- Joined: Mon Jul 19, 2010 3:11 am
Re: Changing an object's rotation
hmm, so maybe operate directly on body->getWorldTransform() instead motionstate
-
- Posts: 37
- Joined: Wed Jul 27, 2011 12:01 am
Re: Changing an object's rotation
Sweet, that worked. Thanks.