Jump to content

View more

Image of the Day

Adding some finishing touches...
Follow us for more
#screenshotsaturday #indiedev... by #MakeGoodGames https://t.co/Otbwywbm3a
IOTD | Top Screenshots

The latest, straight to your Inbox.

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


Sign up now

Trouble with rotation

4: Adsense

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.


  • You cannot reply to this topic
2 replies to this topic

#1 Medo3337   Members   

891
Like
0Likes
Like

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);


#2 Ashaman73   Members   

13715
Like
0Likes
Like

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

 

Gnoblins: Website - Facebook - Twitter - Youtube - Steam Greenlit - IndieDB - Gamedev Log


#3 Álvaro   Members   

21085
Like
0Likes
Like

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.