View more

View more

View more

### Image of the Day Submit

IOTD | Top Screenshots

### The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.

# Trouble with rotation

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

2 replies to this topic

### #1Medo3337  Members

Posted 14 November 2012 - 12:43 AM

I'm trying to rotate RigidBody but having trouble, it's rotating correctly for few seconds and then I see the rotation stop (like it's restricted).

Here is the code I'm using:
btTransform worldTrans;
body->getMotionState()->getWorldTransform(worldTrans);
float x, y, z;
worldTrans.getBasis().getEulerZYX(x, y, z);
// Rotate
y+=0.1f;
worldTrans.getBasis().setEulerZYX(x, y, z);
body->setWorldTransform(worldTrans);

### #2Ashaman73  Members

Posted 14 November 2012 - 01:01 AM

When using euler for rotation you most likely encounter a gimbal lock. Try to fix two axis and rotate only one or avoid euler.

Ashaman

### #3Álvaro  Members

Posted 14 November 2012 - 08:31 AM

You don't want to go through Euler angles at all. Your world transform contains a rotation, which is probably represented as a 3x3 matrix. You seem to want to "add" (the technical term is "compose") an extra rotation of 0.1 radians along some axis. You can do that by creating a 3x3 matrix corresponding to the rotation around the axis and then multiplying the world transform by it.

I have never used Bullet before, so I can't write that in code, but hopefully you can understand it.

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.