Can someone explain RigidBody.setSleepThresholds() to me?

elias4444
Posts: 3
Joined: Sun Jul 26, 2009 10:57 pm

Can someone explain RigidBody.setSleepThresholds() to me?

Post by elias4444 »

I've been searching for this, but can't seem to find anything on it. My RigidBody (cube shaped) objects continue vibrating (jittering) once they've come to a "rest" on a flat plane. This causes them to never reach a "sleeping" state (which I use to detect when the sequence is finished). I seem to be able to fix this by setting values in the setSleepThresholds() function, which takes a linear and angular argument.

I thought at one point the linear argument was "how far the object could move in pixels" and the angular argument was "how far the object could rotate in degrees," but that doesn't seem to be correct. Could someone please explain to me what the arguments represent and how to correctly use them?
ola
Posts: 169
Joined: Sun Jan 14, 2007 7:56 pm
Location: Norway

Re: Can someone explain RigidBody.setSleepThresholds() to me?

Post by ola »

It's velocities. When the rigid body moves slower than the threshold value, it goes to sleep.

If your units are meters, then the linear part is in meters/second. The angular bit is in rad/s.

Best regards,
Ola
fishboy82
Posts: 91
Joined: Wed Jun 10, 2009 4:01 am

Re: Can someone explain RigidBody.setSleepThresholds() to me?

Post by fishboy82 »

Just Additional Remark:
The object will not sleep immediately when it's velocity comes down below the threshold .Only afte it's velocity continuous below this threshold for about 2 seconds and all object that connect it or contact with it donot in active state will this object sleep .