- Home /
Does gravity affect kinematic objects?
Hello
This is my first post on Unity Answers and I would be grateful if anyone can help me with a small problem I am having
I have my rigid bodies in my scene, and they are everywhere. I made a script so that if a rigid body is not being looked at, it stops simulating it (becomes Kinematic). Then, if you look at the rigid body, it continues to simulate from where it left off.
This works fine when the gravity feature is disabled, but when It is enabled, it doesn't. Does anyone have a suggestion why this might be? Does the gravity affect kinematic objects?
Thanks for the help, Nat ---||---
Answer by Kryptos · Oct 26, 2012 at 08:15 AM
Kinematic rigidbodies are not affected by any forces (including gravity).
But it is possible that the velocity that was previously set (before switching to kinematic) was not zero (especially if gravity was enabled). Therefore, when switching back to nonkinematic, the rigidbody starts with a non-zero velocity.
To prevent that, you can force the velocity to zero:
// switch to 'kinematic'
rigidbody.isKinematic = true;
rigidbody.useGravity = false;
rigidbody.velocity = Vector3.zero;
rigidbody.angularVelocity = Vector3.zero;
// switch to 'non-kinematic'
rigidbody.isKinematic = false;
rigidbody.useGravity = true;
rigidbody.velocity = Vector3.zero; // or another initial value
Now you should tell us more about how you switch from kinematic to non-kinematic, and what exactly happens.
Answer by Montraydavis · Oct 26, 2012 at 01:09 AM
Kinetic is based off of energy, versus gravity;
umm... what? $$anonymous$$inematic. Not $$anonymous$$inetic.
Your answer
![](https://koobas.hobune.stream/wayback/20220613082904im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How to deal with *many* moving colliders? 1 Answer
My objects keep falling through 1 Answer
Problems with ragdolls and no gravity 0 Answers
Help with orbits 1 Answer
Falling object, change its angle 0 Answers