Is it possible to turn a dynamic object into a static object (mass = 0)?
I've tried:
pRBody->setMassProps(0.0f,btVector3(0.0f,0.0f,0.0f));
But this just makes my rigid body disappear!
Any ideas?
Thanks,
Steve.
Changing a dynamic object to a static object.
- Erwin Coumans
- Site Admin
- Posts: 4221
- Joined: Sun Jun 26, 2005 6:43 pm
- Location: California, USA
- Contact:
If you use the motionState, make sure to initialize the m_graphicsWorldTransform before constructing the rigidbody. Then the rigidbody will pick this transform as initial transform. If you use 'btDefaultMotionState' as motionstate it should be initialized by the constructor.
Before changing a dynamic object into a static object, remove it from the dynamics world, make the change, and add it back to the dynamics world.
Please let us know if that helps,
Erwin
Before changing a dynamic object into a static object, remove it from the dynamics world, make the change, and add it back to the dynamics world.
Please let us know if that helps,
Erwin
I'm trying out this.
Is the only way to set static/dynamic objects done with setting the mass to either 0 or >0?
The reason I'm asking is that in my application I do this switch for some objects rather often. When it's done with the mass then I need to store the object's mass information somewhere else during the time the object is static. It's sure quite doable this way but something like a setStatic()/setDynamic() function would seem a bit more elegant to me.
Best regards,
Ola
Is the only way to set static/dynamic objects done with setting the mass to either 0 or >0?
The reason I'm asking is that in my application I do this switch for some objects rather often. When it's done with the mass then I need to store the object's mass information somewhere else during the time the object is static. It's sure quite doable this way but something like a setStatic()/setDynamic() function would seem a bit more elegant to me.
Best regards,
Ola
Switching between dynamic and static works well now that I remove the the objects from the dynamics world before modifying the mass and then adding them again.
With the vechicle, there's trouble when I do this. I get an assertion failed:
I recon it happens because the car mass is zero and the vehicle constraint is still active. What do you think, Erwin? Should I fix this in my end (remove the constraint and re-add it later as well, I guess) or should Bullet be able to handle this case? I can offer to try to make a patch if you opt for the latter.
Best regards,
Ola
With the vechicle, there's trouble when I do this. I get an assertion failed:
Code: Select all
src/BulletDynamics/ConstraintSolver/btJacobianEntry.h:53: btJacobianEntry::btJacobianEntry(const btMatrix3x3&, const btMatrix3x3&, const btVector3&, const btVector3&, const btVector3&, const btVector3&, btScalar, const btVector3&, btScalar): Assertion `m_Adiag > btScalar(0.0)' failedBest regards,
Ola