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 —||—

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.

Kinetic is based off of energy, versus gravity;