object (rigid body) stabilization after picking

Post Reply
Tadek
Posts: 7
Joined: Sun Jan 22, 2017 5:41 pm

object (rigid body) stabilization after picking

Post by Tadek »

Many of the bullet examples inherit from CommonRigidBodyBase. Objects are picked based on btPoint2PointConstraint. I have analyzed a SimpleBox example. When a falling object is picked it starts rotate around a pick point but rotation decreases with time. After some time a picked object should become stable.

In SimpleBox example I have changed a collision shape form (1,1,1) to (2,2,2):

Code: Select all

btBoxShape* colShape = createBoxShape(btVector3(2,2,2));
When I pick falling object (which is bigger than before) more or less at the same high above the ground it rotates much longer around pick point. Why ?
I wonder how can I control the time which is needed to stabilize object after picking. Let's assume that a gravity is fixed. I have only one idea: assign a bigger mass to the object. Are there any other parameters ?
benelot
Posts: 350
Joined: Sat Jul 04, 2015 10:33 am
Location: Bern, Switzerland
Contact:

Re: object (rigid body) stabilization after picking

Post by benelot »

If your goal is to reduce motion after picking you should introduce damping. You can do this by either directly reducing the velocity in each step with a constant like 0.99 * previousvelocity or you can apply a negated velocity which is 0.01*previousvelocity. But it depends on what you want to do.
Tadek
Posts: 7
Joined: Sun Jan 22, 2017 5:41 pm

Re: object (rigid body) stabilization after picking

Post by Tadek »

What about p2p constraint settings ? A default settings from CommonRigidBodyBase look like this:

Code: Select all

p2p->m_setting.m_impulseClamp = 30.f;
p2p->m_setting.m_tau = 0.001f;
I found following definitions:
- the m_impulseClamp value controls how quickly the dynamic rigid body comes to rest
- the m_damping value controls how stiff the constraint is.
- m_tau ???

I have tried m_impulseClamp = 0.8f. There is less motion after picking but I get a "spring" effect after picking body. m_impulseClamp = 0.8f (mass = 1) give very similar result as m_impulseClamp = 30.0f where mass = 40. I have also tried to set m_damping value to remove that spring effect but without result.

Could you explain how those settings work ?
How should I set them ?
What controls m_tau ?
Post Reply