- Home /
Rigidbody Sleeping
Hi, I've a series of rigidbodies stacked on top each other in a column. When they come to rest on top of each other, I was hoping that they'd go to 'sleep' as they're velocity is less than the sleep velocity. However, according to the documentation if there is a collision with another rigidbody this will automatically wake them up, even if that rigidbody is also stationary. I'm assuming this is happening in my case, as the rigidbodies have a velocity of 0,0,0 yet they won't go to sleep.
Can anyone suggest a way around this? I was initially going to try and remove their rigidbody component at runtime, but this doesn't seem possible. Essentially what I want is the rigidbodies to act under gravity and collide with each other, and then when they have settled, lose their physics behaviour.
Thanks!
Not sure if this helps, but have you tried modifying the Drag / Angular Drag?
I'm not sure how that would help to be honest, I have tried playing around with it but they're all still awake.
It would help by burning up some of the energy in your scenario. Even in the real world, a pile of frictionless objects will dance and jiggle around forever... if the real world had frictionless objects.
Ok I understand. I tried altering this as the game ran but to no effect - is there a specific number angular drag should be at, perhaps relative to the mass of the object? Thanks for the help
I don't recall the units, but no, it is independent of mass, as is drag.
Answer by Meltdown · Sep 07, 2011 at 07:58 AM
Have you tried tweaking the settings in the Physics Manager ?
You will specifically want to look at tweaking the Sleep Velocity, Sleep Angular Velocity and the Bounce Threshold to get the effect you want.
I have briefly but will look again inmore detail. I guess fundamentally I'd like to be assured, can you have to rigidbodies on top of each other 'sleeping' if all these values are correctly set up? Thanks again
Yes, that is where the bounce threshold comes in. Set that value to low enough and you'll get the bodies to sleep as you want. If you find you are setting the values too low you might want to increase the scale of your rigidbodies and your scene.
Ah right apologies, part of my scripts was moving the rigidbody when it shouldn't have been, therefore waking them up! Thanks for all the help
No worries, please make sure to upvote/mark as answer any answers that helped you.
Answer by NorthernEagle · Feb 15, 2012 at 02:41 AM
Just ran into the same issue as the original poster. Thanks for the answers!
Answer by ElMenduko · Feb 11, 2015 at 05:45 PM
Apart from changing the physics manager option I think you can manually send them to sleep with rigidbody.Sleep
Bad thing is you might (not sure about it) have to wake them up manually with rigidbody.WakeUp