Rigidbody 2D

A Rigidbody 2D 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.

MassMass of the rigidbody.
Linear DragDrag coefficient affecting positional movement.
Angular DragDrag coefficient affecting rotational movement.
Gravity ScaleDegree to which the object is affected by gravity.
Fixed AngleCan the rigidbody rotate when forces are applied?
Is KinematicIs the rigidbody moved by forces and collisions?
InterpolateHow the object's movement is interpolated between physics updates (useful when motion tends to be jerky).
NoneNo movement smoothing is applied.
InterpolateMovement is smoothed based on the object's positions in previous frames.
ExtrapolateMovement is smoothed based on an estimate of its position in the next frame.
Sleeping ModeHow the object "sleeps" to save processor time when it is at rest.
Never SleepSleeping is disabled.
Start AwakeObject is initially awake.
Start AsleepObject is initially asleep but can be woken by collisions.
Collision DetectionHow collisions with other objects are detected.
DiscreteA collision is registered only if the object's collider is in contact with another during a physics update.
ContinuousA collision is registered if the object's collider appears to have contacted another between updates.

Details

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.

Colliders

Colliders define an approximate shape for an object that will be used by the physics engine to determine collisions with other objects. The collider types that can be used with Rigidbody 2D are the Circle Collider 2D, Box Collider 2D and Polygon Collider 2D - see the pages for these component for further details.

Kinematic Rigidbodies

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.

Page last updated: 2013-08-15