Hi guys... I have a question. I need to rotate a btRigidBody on it's local axis. I tried very hard to do this for several weeks now but to no avail.
I also tried asking on the bullet forums but they never post there anymore.
The body's btTransform doesn't help either, because I need to only try to affect it's rotation, but it won't if it's blocked or crashing along terrain, or on the ground. Using the btTransform it is not affected by these things like rigid bodies should be.
In short: I need to apply local rotation to a btRigidBody in the form of force, so the object can still be affected by other factors.
Thanks for any help!
Please help - Bullet physics local torque (SOLVED)
Please help - Bullet physics local torque (SOLVED)
Last edited by cobra on Sat Jun 20, 2009 4:10 am, edited 1 time in total.
-
- Posts: 1
- Joined: Mon Jun 08, 2009 7:16 pm
- Location: Germany
Re: Please help - Bullet physics local torque
Hi, im new here and my english is very bad because i´m from germany.
I had this problem for few days too, but i found a solution.
This works fine for my project:
MainChar->Person.btRotation.setEuler(irr::core:: PI,0,0);
MainChar->Person.btPosition.setRotation(MainChar->Person.btRotation );
MainChar->Person.RigidBody->setWorldTransform(btTransform(MainChar->Person.btRotation,MainChar->Person.RigidBody->getCenterOfMassPosition()));
You need to set Euler Angels to PI, when your character have to look forward.
When he´s look to the left, you have to calculate : PI/2.
When he´s look to the right, you have to set : -PI/2
When he´s look backwards, you have to set : 0.
bt.Position.SetRotation sets the Euler Rotation to Quaternion.
Then, we only have to rotate the Char to the world by
setWorldTransform(...).
I dont know if this the best solution for this problem, but
it works fine for me and i think its good enough
I hope i could help.
I had this problem for few days too, but i found a solution.
This works fine for my project:
MainChar->Person.btRotation.setEuler(irr::core:: PI,0,0);
MainChar->Person.btPosition.setRotation(MainChar->Person.btRotation );
MainChar->Person.RigidBody->setWorldTransform(btTransform(MainChar->Person.btRotation,MainChar->Person.RigidBody->getCenterOfMassPosition()));
You need to set Euler Angels to PI, when your character have to look forward.
When he´s look to the left, you have to calculate : PI/2.
When he´s look to the right, you have to set : -PI/2
When he´s look backwards, you have to set : 0.
bt.Position.SetRotation sets the Euler Rotation to Quaternion.
Then, we only have to rotate the Char to the world by
setWorldTransform(...).
I dont know if this the best solution for this problem, but
it works fine for me and i think its good enough
I hope i could help.
Dont laugh, im from germany!