How to rotate dynamic rigidbody around Y axis?

serengeor
Posts: 22
Joined: Mon Dec 20, 2010 7:13 pm

How to rotate dynamic rigidbody around Y axis?

Post by serengeor »

I'm having the same problem as the guy in this thread http://bulletphysics.org/Bullet/phpBB3/ ... 50&start=0

I'm really confused about this.

How can I actually rotate dynamic rigid body around Y axis manually?
I need this for First person game and I don't want to use Kinematic charachter controller(Not that I don't know how to, I just don't want to).
Etek
Posts: 15
Joined: Mon Oct 04, 2010 5:55 pm

Re: How to rotate dynamic rigidbody around Y axis?

Post by Etek »

Get it's matrix, use rotation on it, set the matrix back on the body.
serengeor
Posts: 22
Joined: Mon Dec 20, 2010 7:13 pm

Re: How to rotate dynamic rigidbody around Y axis?

Post by serengeor »

Thanks for your reply, I taught this forum was dead.
I'll try to rotate it with matrix'es, tough I'm don't really know much about them.
Again thanks for replying.
Etek
Posts: 15
Joined: Mon Oct 04, 2010 5:55 pm

Re: How to rotate dynamic rigidbody around Y axis?

Post by Etek »

I do it like this

Code: Select all

btRidigBody myBody;
btTransform transform;
btScalar matrix[16];

transform = myBody->getCenterOfMassTransform();
matrix = transform.getOpenGLMatrix();

multiply with rotation matrix

transform.setFromOpenGLMatrix(matrix);
myBody->setTransform(transform);
This is written from memory, so actual names may differ.
serengeor
Posts: 22
Joined: Mon Dec 20, 2010 7:13 pm

Re: How to rotate dynamic rigidbody around Y axis?

Post by serengeor »

Thanks mate, I wouldn't have solved this by myself! :wink: