A Rigidbody2D component places an object under the control of the physics engine. Many concepts familiar from the standard Rigidbody component carry over to Rigidbody 2D, with the difference that in 2D, objects can only move in the XY plane and can only rotate on an axis perpendicular to that plane.
|Use Auto Mass||Detect the object’s mass from its collider? Check the box for yes.|
|Mass||Mass of the rigidbody. (Greyed out if you have selected Use Auto Mass.)|
|Linear Drag||Drag coefficient affecting positional movement.|
|Angular Drag||Drag coefficient affecting rotational movement.|
|Gravity Scale||Degree to which the object is affected by gravity.|
|Is Kinematic||Is the rigidbody moved by forces and collisions?|
|Interpolate||How the object’s movement is interpolated between physics updates (useful when motion tends to be jerky).|
|None||No movement smoothing is applied.|
|Interpolate||Movement is smoothed based on the object’s positions in previous frames.|
|Extrapolate||Movement is smoothed based on an estimate of its position in the next frame.|
|Sleeping Mode||How the object “sleeps” to save processor time when it is at rest.|
|Never Sleep||Sleeping is disabled (should be avoided where possible).|
|Start Awake||Object is initially awake.|
|Start Asleep||Object is initially asleep but can be woken by collisions.|
|Collision Detection||How collisions with other objects are detected.|
|Discrete||A collision is registered only if the object’s collider is in contact with another during a physics update.|
|Continuous||A collision is registered if the object’s collider appears to have contacted another between updates.|
|Constraints||Restrictions on the rigidbody’s motion:-|
|Freeze Position||Stops the rigidbody moving in the world X & Y axes selectively.|
|Freeze Rotation||Stops the rigidbody rotating around the Z axes selectively.|
Adding a Rigidbody 2D allows a sprite to be moved in a physically convincing way by applying forces from the scripting API. When the appropriate collider component is also attached to the sprite object, it will be affected by collisions with other moving objects. Using physics simplifies many common gameplay mechanics and allows for realistic, emergent behaviour with minimal coding.
The Is Kinematic setting switches off the physical behaviour of the Rigidbody 2D so that it will not react to gravity and collisions. This is typically used to keep an object under non-physical script control most of the time but then switch to physics in a particular situation. For example, a player might normally move by walking (better handled without physics) but then get catapulted into the air by an explosion or strike. Physics can be used to create the catapulting effect if you switch off ’’Is Kinematic" just before applying a large force to the object.