- Home /
Physics preventing objects to go into sleep?
Is there a way to prevent a certain object to fall into sleep (physiX)? I'm aware of the costs etc. involved, but with one object should not be the big problem?
Answer by AquaGeneral · Nov 03, 2010 at 12:34 PM
Use Continuous Collision Detection. You can read more about it here: http://unity3d.com/support/documentation/Components/class-Rigidbody.html
Set the "Collision Detection" setting in the object's rigidbody component to "Continuous Dynamic".
here: if (rigidbody.IsSleeping() ) rigidbody.WakeUp();
from: http://forum.unity3d.com/threads/4519-$$anonymous$$aking-a-rigidbody-never-sleep
In that case, the static objects which are going to be colliding with the "Continuous Dynamic" object need to be set to "Continuous".
From the documentation: Continuous - Used for objects which the Continuous Dynamic detection needs to collide with.
BTW, that forum topic is almost four years old, before Unity had the support for Continuous Collision Detection.
Answer by Anxo · Aug 04, 2014 at 11:00 PM
I understand this question was from 2010 but I jut had to look it up and this question was the first one I ran into, so I thought I would contribute.
To adress AquaGenerals Answer: Use Continuous Collision Detection is designed for objects to not pass through each other when moving at a high velocity. As state in the documentation (which might have changed since 2010)
Solution: Rigidbody now has a property called "sleepVelocity" which sets the threshold under which the rigid body will fall asleep.
If 0 velocity is not low enough and you need to keep it awake even then, you can use a if(rigidbody.isSleeping)rigidbody.wakup(); call in the fixedupdate, but that might get a little heavy if you have it on lots of objects as they all will have to run a check on every fixed frame.
sleepAngularVelocity The angular velocity below which objects start going to sleep. (Default 0.14) range { 0, infinity }. sleepVelocity The linear velocity below which objects start going to sleep. (Default 0.14) range { 0, infinity }.
Your answer
Follow this Question
Related Questions
2D 360 degress platformer example needed 0 Answers
How to stop rigidbody.sleep() 2 Answers
do rigidbodies fall asleep at the same time? 1 Answer
Why are my Rigidbodies not sleeping? 0 Answers
Rigidbody not sleeping 1 Answer