unity3d Physics Gravity in Rigid Body


The useGravity property of a RigidBody controls whether gravity affects it or not. If set to false the RigidBody will behave as if in outer space (without a constant force being applied to it in some direction).

GetComponent<RigidBody>().useGravity = false;

It is very useful in the situations where you need all other properties of RigidBody except the motion controlled by gravity.

When enabled, the RigidBody will be affected by a gravitational force, set up under Physics Settings:

enter image description here

Gravity is defined in world units per second squared, and is entered here as a three-dimensional vector: meaning that with the settings in the example image, all RigidBodies with the useGravity property set to True will experience a force of 9.81 world units per second per second in the downwards direction (as negative Y-values in Unity's coordinate system point downwards).