- Home /
rigidbody.isKinematic = false Does NOT Work
In my script, I have on Input.GetMouseButtonUp(0) set rigidbody.isKinematic to false. But, my object does not work properly. In the inspector isKinematic changes to false, but gravity doesn't affect it. When I change it in the inspector, however it works.
How can I fix this?
EDIT:
Code:
if(Input.GetMouseButtonUp(0)){
jarInst.collider.enabled = true;
jarInst.rigidbody.isKinematic = false;
jarInst = null;
}
Answer by Eric5h5 · Dec 17, 2011 at 08:22 PM
It does work, but in the meantime the rigidbody has fallen asleep, so setting isKinematic to false isn't enough, you need to wake it up again using WakeUp().
Perfect answer. Didn't know there was something like that. Thanks
Answer by gregzo · Dec 17, 2011 at 06:51 PM
You have it the wrong way around. isKinematic = true will prevent your object to be affected by physics.
No, I want my object to be affected by physics but it doesn't work.
Oops, my bad, understood your question the wrong way around. And you say it works when you change it in the inspector, most strange. Can you post code?
Can't see anything wrong. Script attached to the object? Not accidentaly turned to enabled = false? Tried tracing with a print to see if your condition is ever met? Sorry, can't suggest but the obvious...
Your answer
![](https://koobas.hobune.stream/wayback/20220613062151im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Can not change some values in the inspector 1 Answer
RigibBody and ignored Input.GetKeyDown 0 Answers
3D world 2D gameplay, keep player in the camera? 1 Answer
Player object falling slowly when holding input 2 Answers
Falling object touch 0 Answers