- Home /
Turn on gravity on a single gameobject with OnMouseDown
I have searched but can't seem to find a cohesive answer. Is there a way for me to click an object and have that click turn gravity on? I'm running into several errors, most commonly a problem with using a static function on a non-static object, and I have been looking for hours without finding a straightforward solution. Any help would be really appreciated.
It sounds like your question isn't about how to turn gravity on (http://unity3d.com/support/documentation/ScriptReference/Rigidbody-useGravity.html).
Your question, it appears, is about scripting and referencing scripts. Could you please change your question to explain the error you're getting, what you expect to happen, and what's happening ins$$anonymous$$d?
Answer by Eric5h5 · Nov 09, 2011 at 05:36 PM
Don't use static for anything unless you understand it and are sure that's actually what you need.
function OnMouseDown () {
rigidbody.useGravity = true;
}
Your answer