Version: Unity 7.0 Alpha (7000.0)
LanguageEnglish
  • C#

Rigidbody2D

class in UnityEngine

/

Inherits from:Component

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Description

Provides physics movement and other dynamics, and the ability to attach Collider2D to it.

The Rigidbody2D is a fundamental physics component that provides multiple simulation dynamics, such as Rigidbody2D.position and Rigidbody2D.rotation for pose control, and Rigidbody2D.linearVelocity and Rigidbody2D.angularVelocity for velocity control.

You can attach multiple Collider2D to a Rigidbody2D to detect collisions and provide a collision response when you set Rigidbody2D.bodyType to RigidbodyType2D.Dynamic.

Properties

Property Description
angularDampingThe angular damping of the Rigidbody2D angular velocity.
angularVelocityAngular velocity in degrees per second.
attachedColliderCountReturns the number of Collider2D attached to this Rigidbody2D.
bodyTypeThe physical behaviour type of the Rigidbody2D.
centerOfMassThe center of mass of the rigidBody in local space.
collisionDetectionModeThe method used by the physics engine to check if two objects have collided.
constraintsControls which degrees of freedom are allowed for the simulation of this Rigidbody2D.
excludeLayersThe additional Layers that all Collider2D attached to this Rigidbody2D should exclude when deciding if a contact with another Collider2D should happen or not.
freezeRotationControls whether physics will change the rotation of the object.
gravityScaleThe degree to which this object is affected by gravity.
includeLayersThe additional Layers that all Collider2D attached to this Rigidbody2D should include when deciding if a contact with another Collider2D should happen or not.
inertiaThe Rigidbody's resistance to changes in angular velocity (rotation).
interpolationPhysics interpolation used between updates.
linearDampingThe linear damping of the Rigidbody2D linear velocity.
linearVelocityThe linear velocity of the Rigidbody2D represents the rate of change over time of the Rigidbody2D position in world-units.
linearVelocityXThe X component of the linear velocity of the Rigidbody2D in world-units per second.
linearVelocityYThe Y component of the linear velocity of the Rigidbody2D in world-units per second.
localToWorldMatrixThe transformation matrix used to transform the Rigidbody2D to world space.
massMass of the Rigidbody.
positionThe position of the rigidbody.
rotationThe rotation of the rigidbody.
sharedMaterialThe PhysicsMaterial2D that is applied to all Collider2D attached to this Rigidbody2D.
simulatedIndicates whether the rigid body should be simulated or not by the physics system.
sleepModeThe sleep state that the rigidbody will initially be in.