Seeing as rigidBody::applyTorque() acts in world space, how can I rotate an object around its local axes?
Effectively, I am looking for a way to produce Pitch Roll and Yaw movement.
Thanks
Simon
Local Pitch, roll, yaw - SOLVED
-
- Posts: 44
- Joined: Thu Aug 07, 2008 6:57 am
Local Pitch, roll, yaw - SOLVED
Last edited by sipickles on Tue Sep 02, 2008 7:15 pm, edited 1 time in total.
-
- Posts: 36
- Joined: Tue Jun 17, 2008 8:28 pm
Re: Another rotation question
Hi,
can You try this?
Best regards
can You try this?
Code: Select all
btTransform trans;
btQuaternion quat;
trans.setOrigin(btVector(0.0f, 0.0f, 0.0f)); //translation
quat.setEuler(0.0f, 0.0f, 0.0f);//rotation
trans.setRotation(quat);
btRigidBody* body = new btRigidBody(rbInfo);
body->setWorldTransform(trans);
-
- Posts: 44
- Joined: Thu Aug 07, 2008 6:57 am
Re: Another rotation question
Thanks for the reply
This is overriding the position and rotation of the object. I am wanting to apply forces to the object instead, just as ailerons or a rudder might do....AxeD wrote:Code: Select all
body->setWorldTransform(trans);
-
- Posts: 508
- Joined: Fri May 30, 2008 2:51 am
- Location: Ossining, New York
Re: Another rotation question
Are you sure torques are in world space? That seems unhelpful. I admit I've only applied forces myself.
I would have applied a force to each wing personally. Then you can simulate what happens when one of the wings is damaged
I would have applied a force to each wing personally. Then you can simulate what happens when one of the wings is damaged
-
- Posts: 44
- Joined: Thu Aug 07, 2008 6:57 am
Re: Another rotation question
I still think apply forces to the wings would suffer the same problem.
A wing applies a force relative to its local orientation, not the world space.
Perhaps one approach is to get the orientation quaternion of an object and transform the force by this. This converts the force in local space to its XYZ component forces in world space.... i think!
Am I correct here?
Thanks
A wing applies a force relative to its local orientation, not the world space.
Perhaps one approach is to get the orientation quaternion of an object and transform the force by this. This converts the force in local space to its XYZ component forces in world space.... i think!
Am I correct here?
Thanks
-
- Posts: 508
- Joined: Fri May 30, 2008 2:51 am
- Location: Ossining, New York
Re: Another rotation question
You can convert a vector between a body's model space and world space using the body's btTransform. This includes both the position and orientation of the body.
http://www.continuousphysics.com/Bullet ... sform.html
If you want to convert a quaternion between body and world space, you only need the rotation part of the transform, i.e. the "basis" -- no idea why it's called that.
http://www.continuousphysics.com/Bullet ... sform.html
If you want to convert a quaternion between body and world space, you only need the rotation part of the transform, i.e. the "basis" -- no idea why it's called that.
-
- Posts: 44
- Joined: Thu Aug 07, 2008 6:57 am
Re: Another rotation question
Thanks Sparkprime, o bullet master.
That is perfect!
That is perfect!