why do btRigidBody objects land on ground on thin edge?

Post Reply
ed_welch
Posts: 43
Joined: Wed Mar 04, 2015 6:16 pm

why do btRigidBody objects land on ground on thin edge?

Post by ed_welch »

When I drop objects on the ground I always get objects landing on the thin edge of the object, when it should topple over onto the flat edge. About 30% of the time this happens. Does anyone know a solution to this problem?
User avatar
drleviathan
Posts: 849
Joined: Tue Sep 30, 2014 6:03 pm
Location: San Francisco

Re: why do btRigidBody objects land on ground on thin edge?

Post by drleviathan »

In Bullet dynamic objects will be deactivated if their linear and angular speeds are below some thresholds for at least 2 seconds. When the sleeping thresholds are too high, or when there is too much damping or energy loss (low restitution), it is possible for objects to balance long enough to be deactivated while near an unstable equilibrium.

The default speeds are: linear = 0.8 m/sec and angular = 1.0 rad/sec. These numbers might be too small for your simulation, especially if you're using weak gravity.

You can change the sleeping speed thresholds via btRigidBody::setSleepingThresholds(linear_speed, angular_speed).

Here are some strategies that might help solve the problem of early deactivation:

(1) Decrease the sleeping thresholds
(2) When you create new objects give them a slight non-zero random angular velocity
(3) Increase restitution (bounciness) of the objects involved in collision
(4) Reduce damping and/or friction

Note: for some content... if you tune some of those numbers too far you can end up with some objects that never deactivate.
ed_welch
Posts: 43
Joined: Wed Mar 04, 2015 6:16 pm

Re: why do btRigidBody objects land on ground on thin edge?

Post by ed_welch »

Thanks for you answer drleviathan.
I am using normal value for gravity.
I tried messing around with the different parameters, but it does not seem to make any difference.
I tried modifying m_friction, m_spinningFriction, m_restitution, m_rollingFriction to various values
I set setAngularVelocity to value above 2 always
I made setSleepingThresholds very low,
then tried fooling around with setDamping and setDeactivationTime
but I still have the problem.
there are so many different values it's nearly impossible to try all the possible permutations
ed_welch
Posts: 43
Joined: Wed Mar 04, 2015 6:16 pm

Re: why do btRigidBody objects land on ground on thin edge?

Post by ed_welch »

I think I have solved the problem for most cases.
Actually, I think changing the default values was what actually caused the problem. Mucking around with m_rollingFriction, m_spinningFriction, SleepingThresholds, Damping and DeactivationTime made everything worse. You should leave these at defaults.
I am animating a door that is blown to pieces. (https://vimeo.com/manage/videos/757654546)
I had many problems because the pieces start out close together and get embebbed in each other. I solved this problem by explicitly calling stepSimulation(0.0001f) right after the explosion. That's an extra step apart from the one in the game loop and it helps stuff not get embedded in other stuff because the time interval is so small.
Post Reply