Jump to content

  • Log In with Google      Sign In   
  • Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.


Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


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.

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

#1 Medo3337   Members   -  Reputation: 680

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


Sponsor:

#2 Ashaman73   Crossbones+   -  Reputation: 8001

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.

#3 Álvaro   Crossbones+   -  Reputation: 13933

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.



PARTNERS