Beginner help request on constraints
Posted: Sat Dec 24, 2016 10:23 am
I've run into a strange behaviour that I can't figure out and would like some help please - since I'm new to Bullet I'm certain I've done something wrong, but where to start investigating?
What I have is a static box and a number of capsules (chain) and another box (lamp) - basically a ragdoll. These are made using btRigidBody with btMotionState and constraints (tried both p2p and 6Dof).
If I set the mass of the dynamic objects (chain capsules and lamp box) to zero, then the objects are placed correctly. See the pic below:
So the starting world transforms set in btMotionState must be ok. But of course the objects won't move with their mass set to zero. Now, if I set the mass values correctly (the capsules are 0.5 each and the lamp box is 2.0) then they float up through the ceiling (so it seems). I have a video that shows this. The first video is when m_localInertia are set to zero - the lamp responds to and "swings", except upside down. But why upside down? I've made no change to the code other than set the mass values between the pic and video.
https://youtu.be/a_rrhoA1EpU
The second video shows when m_localInertia is set using shape->calculateLocalInertia(mass, localInertia). This time the linked objects break apart! Again, no change other than setting the local inertia non-zero between the first video and the second video.
https://youtu.be/lfCFTaFNyrA
Obviously I've messed up, but I have no idea where. Any help here would be much appreciated.
What I have is a static box and a number of capsules (chain) and another box (lamp) - basically a ragdoll. These are made using btRigidBody with btMotionState and constraints (tried both p2p and 6Dof).
If I set the mass of the dynamic objects (chain capsules and lamp box) to zero, then the objects are placed correctly. See the pic below:
So the starting world transforms set in btMotionState must be ok. But of course the objects won't move with their mass set to zero. Now, if I set the mass values correctly (the capsules are 0.5 each and the lamp box is 2.0) then they float up through the ceiling (so it seems). I have a video that shows this. The first video is when m_localInertia are set to zero - the lamp responds to and "swings", except upside down. But why upside down? I've made no change to the code other than set the mass values between the pic and video.
https://youtu.be/a_rrhoA1EpU
The second video shows when m_localInertia is set using shape->calculateLocalInertia(mass, localInertia). This time the linked objects break apart! Again, no change other than setting the local inertia non-zero between the first video and the second video.
https://youtu.be/lfCFTaFNyrA
Obviously I've messed up, but I have no idea where. Any help here would be much appreciated.