Greetings,
Recently I updated our application with Bullet 2.73 and discovered some odd behavior:
We have dynamic rigid bodies that use a capsule object for collision detection. It is a requirement that the bodies and the capsules remain standing on the up axis. To accomplish this with Bullet 2.72 we call btRigidBody::setAngularFactor(0.0f). However, with Bullet 2.73 the rigid bodies and the capsules simply fall over and roll around, they behave as if btRigidBody::setAngularFactor(0.0f) was never called. I switched back to 2.72 without any changes to our application code and verified that the rigid body behavior functions as expected. I also stepped through the 2.73 code to ensure that btRigidBody::m_angularFactor is indeed being set, but it seems to have no effect on the body.
Is this a bug or is there something else I should be doing with 2.73 to ensure that my rigid bodies don't topple over?
Rev 2.73 setAngularFactor() ignored?
-
- Site Admin
- Posts: 4221
- Joined: Sun Jun 26, 2005 6:43 pm
- Location: California, USA
Re: Rev 2.73 setAngularFactor() ignored?
It is not supported in the SIMD optimizated constraint solver yet.
Instead, can you set the inverse inertia matrix to zero?
Another option is to disable the SIMD implementation of the constraint solver using:
But we might deprecate the angular factor, and document the fact that the inertia tensors needs to be scaled, to achieve the same effect.
Hope this helps,
Erwin
Instead, can you set the inverse inertia matrix to zero?
Code: Select all
body->setInvInertiaDiagLocal(btVector3(0,0,0));
body->updateInertiaTensor();
Code: Select all
dynamicsWorld->getSolverInfo().m_solverMode &= ~SOLVER_SIMD;
Hope this helps,
Erwin
-
- Posts: 7
- Joined: Tue Dec 09, 2008 7:41 pm
Re: Rev 2.73 setAngularFactor() ignored?
Thank you for the tip Erwin. The first option did the trick. I would rather not disable the SIMD functionality, the performance boost will be nice.Erwin Coumans wrote:It is not supported in the SIMD optimizated constraint solver yet.
Instead, can you set the inverse inertia matrix to zero?Another option is to disable the SIMD implementation of the constraint solver using:Code: Select all
body->setInvInertiaDiagLocal(btVector3(0,0,0)); body->updateInertiaTensor();
But we might deprecate the angular factor, and document the fact that the inertia tensors needs to be scaled, to achieve the same effect.Code: Select all
dynamicsWorld->getSolverInfo().m_solverMode &= ~SOLVER_SIMD;
Hope this helps,
Erwin
-
- Posts: 35
- Joined: Wed Jun 25, 2008 2:52 pm
Re: Rev 2.73 setAngularFactor() ignored?
Forgive a n00b question - I'm currently trying to implement a way to enable/disable rotation on an object. I'm using an older version of the engine at the moment so SetAngularFactor is working fine, but I came across this post. I managed to get your suggestion re: setInvInertiaDiagLocal(btVector3(0,0,0)) to work for the purpose of disabling the rotation - but I'm not sure how to re-enable the rotation once this has been done. I'm afraid I don't understand enough about the inertial tensors.
Any hints?
Any hints?
-
- Posts: 18
- Joined: Sun Mar 29, 2009 5:00 pm
Re: Rev 2.73 setAngularFactor() ignored?
A nice way would be- call a member function on the object which stores getInvInertiaDiagLocal() as a member field and sets your 'rotation enabled' flag, and then the other function will just use the stored vector with setInvInertiaDiagLocal() which enables rotation again.chucksspencer wrote:Forgive a n00b question - I'm currently trying to implement a way to enable/disable rotation on an object. I'm using an older version of the engine at the moment so SetAngularFactor is working fine, but I came across this post. I managed to get your suggestion re: setInvInertiaDiagLocal(btVector3(0,0,0)) to work for the purpose of disabling the rotation - but I'm not sure how to re-enable the rotation once this has been done. I'm afraid I don't understand enough about the inertial tensors.
Any hints?
Code: Select all
m_diagInvInertiaStore = m_body->getInvInertiaDiagLocal();
m_body->setInvInertiaDiagLocal(btVector3(0,0,0));
m_body->updateInertiaTensor();
m_rotationEnabled = false;
m_body->setInvInertiaDiagLocal( m_diagInvInertiaStore );
m_body->updateInertiaTensor();
m_rotationEnabled = true;
-
- Site Admin
- Posts: 4221
- Joined: Sun Jun 26, 2005 6:43 pm
- Location: California, USA
Re: Rev 2.73 setAngularFactor() ignored?
setAngularFactor should be working fine for Bullet 2.74 and later.
(so no need to store the inverse inertial tensor)
In addition, Bullet 2.75 will let you lock/unlock the linear and angular degrees of freedom individually for each component (X,Y,Z).
This feature allows for 2D physics, in combination with 3D physics.
Hope this helps,
Erwin
(so no need to store the inverse inertial tensor)
In addition, Bullet 2.75 will let you lock/unlock the linear and angular degrees of freedom individually for each component (X,Y,Z).
This feature allows for 2D physics, in combination with 3D physics.
Hope this helps,
Erwin
-
- Posts: 35
- Joined: Wed Jun 25, 2008 2:52 pm
Re: Rev 2.73 setAngularFactor() ignored?
That's in the global scene coordinates, right? It'd be neat if the axes of the angular degrees of freedom could be locked relative to either the component's local space or in an arbitrary frame of reference. I suppose one can do that using constraints, but it'd be convenient.Erwin Coumans wrote:setAngularFactor should be working fine for Bullet 2.74 and later.
(so no need to store the inverse inertial tensor)
In addition, Bullet 2.75 will let you lock/unlock the linear and angular degrees of freedom individually for each component (X,Y,Z).
This feature allows for 2D physics, in combination with 3D physics.
Hope this helps,
Erwin