Objects "Shake" when there is a constant collision...

CarinaCruz
Posts: 21
Joined: Wed Mar 25, 2015 2:04 pm

Objects "Shake" when there is a constant collision...

Post by CarinaCruz »

Hello everyone!

I'm having a problem when two objects collide and remain together, happens a strange behavior of both, they are shaking.

Whats it could be happening?

I want my shapes stay close and stops...

Thanks!
User avatar
drleviathan
Posts: 849
Joined: Tue Sep 30, 2014 6:03 pm
Location: San Francisco

Re: Objects "Shake" when there is a constant collision...

Post by drleviathan »

What is pushing the two objects together? Gravity or something else?

Such shaking would be expected if there were an external "action" that was slamming either (a) the object positions into a state of penetration or (b) the object's velocities such that they are moving toward each other and constantly bouncing away.

Meanwhile, bouncy objects will rattle around like that as they settle down under gravity. You can reduce the rattle and speed up the settle by reducing restitution of the objects involved (e.g. use btCollisionObject::setRestitution()). Increasing friction can also speed up the settle, but doesn't really affect the rattle. Tweaking damping may also help, but is more relevant for fast moving objects and can actually increase the time it takes for slow objects to settle.

Finally, if the objects are constantly being re-activated (via btCollisionObject::activate()), or are configured to never deactivate (because btCollisionObject::setActivationState(DISABLE_DEACTIVATION)), then they might rattle around forever... especially if restitutions are high and/or there is some external force or logic pumping energy into the system.