Class Rigidbody2D
Assembly: UnityEngine.dll
Syntax
[RequireComponent(typeof(Transform))]
public sealed class Rigidbody2D : Component
Properties
angularDrag
Declaration
public float angularDrag { get; set; }
Property Value
angularVelocity
Declaration
public float angularVelocity { get; set; }
Property Value
attachedColliderCount
Declaration
public int attachedColliderCount { get; }
Property Value
bodyType
Declaration
public RigidbodyType2D bodyType { get; set; }
Property Value
centerOfMass
Declaration
public Vector2 centerOfMass { get; set; }
Property Value
collisionDetectionMode
Declaration
public CollisionDetectionMode2D collisionDetectionMode { get; set; }
Property Value
constraints
Declaration
public RigidbodyConstraints2D constraints { get; set; }
Property Value
drag
Declaration
public float drag { get; set; }
Property Value
fixedAngle
Declaration
[Obsolete("'fixedAngle' is no longer supported. Use constraints instead.", false)]
public bool fixedAngle { get; set; }
Property Value
freezeRotation
Declaration
public bool freezeRotation { get; set; }
Property Value
gravityScale
Declaration
public float gravityScale { get; set; }
Property Value
inertia
Declaration
public float inertia { get; set; }
Property Value
interpolation
Declaration
public RigidbodyInterpolation2D interpolation { get; set; }
Property Value
|
Improve this Doc
View Source
isKinematic
Declaration
public bool isKinematic { get; set; }
Property Value
mass
Declaration
public float mass { get; set; }
Property Value
position
Declaration
public Vector2 position { get; set; }
Property Value
rotation
Declaration
public float rotation { get; set; }
Property Value
sharedMaterial
Declaration
public PhysicsMaterial2D sharedMaterial { get; set; }
Property Value
simulated
Declaration
public bool simulated { get; set; }
Property Value
sleepMode
Declaration
public RigidbodySleepMode2D sleepMode { get; set; }
Property Value
useAutoMass
Declaration
public bool useAutoMass { get; set; }
Property Value
useFullKinematicContacts
Declaration
public bool useFullKinematicContacts { get; set; }
Property Value
velocity
Declaration
public Vector2 velocity { get; set; }
Property Value
worldCenterOfMass
Declaration
public Vector2 worldCenterOfMass { get; }
Property Value
Methods
|
Improve this Doc
View Source
AddForce(Vector2)
Declaration
[ExcludeFromDocs]
public void AddForce(Vector2 force)
Parameters
Type |
Name |
Description |
Vector2 |
force |
|
AddForce(Vector2, ForceMode2D)
Declaration
public void AddForce(Vector2 force, [DefaultValue("ForceMode2D.Force")] ForceMode2D mode)
Parameters
|
Improve this Doc
View Source
AddForceAtPosition(Vector2, Vector2)
Declaration
[ExcludeFromDocs]
public void AddForceAtPosition(Vector2 force, Vector2 position)
Parameters
AddForceAtPosition(Vector2, Vector2, ForceMode2D)
Declaration
public void AddForceAtPosition(Vector2 force, Vector2 position, [DefaultValue("ForceMode2D.Force")] ForceMode2D mode)
Parameters
|
Improve this Doc
View Source
AddRelativeForce(Vector2)
Declaration
[ExcludeFromDocs]
public void AddRelativeForce(Vector2 relativeForce)
Parameters
Type |
Name |
Description |
Vector2 |
relativeForce |
|
AddRelativeForce(Vector2, ForceMode2D)
Declaration
public void AddRelativeForce(Vector2 relativeForce, [DefaultValue("ForceMode2D.Force")] ForceMode2D mode)
Parameters
|
Improve this Doc
View Source
AddTorque(Single)
Declaration
[ExcludeFromDocs]
public void AddTorque(float torque)
Parameters
Type |
Name |
Description |
Single |
torque |
|
AddTorque(Single, ForceMode2D)
Declaration
public void AddTorque(float torque, [DefaultValue("ForceMode2D.Force")] ForceMode2D mode)
Parameters
|
Improve this Doc
View Source
Cast(Vector2, ContactFilter2D, RaycastHit2D[])
Declaration
[ExcludeFromDocs]
public int Cast(Vector2 direction, ContactFilter2D contactFilter, RaycastHit2D[] results)
Parameters
Returns
|
Improve this Doc
View Source
Cast(Vector2, ContactFilter2D, RaycastHit2D[], Single)
Declaration
public int Cast(Vector2 direction, ContactFilter2D contactFilter, RaycastHit2D[] results, [DefaultValue("Mathf.Infinity")] float distance)
Parameters
Returns
|
Improve this Doc
View Source
Cast(Vector2, RaycastHit2D[])
Declaration
[ExcludeFromDocs]
public int Cast(Vector2 direction, RaycastHit2D[] results)
Parameters
Returns
|
Improve this Doc
View Source
Cast(Vector2, RaycastHit2D[], Single)
Declaration
public int Cast(Vector2 direction, RaycastHit2D[] results, [DefaultValue("Mathf.Infinity")] float distance)
Parameters
Returns
|
Improve this Doc
View Source
Distance(Collider2D)
Declaration
public ColliderDistance2D Distance(Collider2D collider)
Parameters
Returns
GetAttachedColliders(Collider2D[])
Declaration
public int GetAttachedColliders(Collider2D[] results)
Parameters
Returns
|
Improve this Doc
View Source
GetContacts(Collider2D[])
Declaration
public int GetContacts(Collider2D[] colliders)
Parameters
Returns
|
Improve this Doc
View Source
GetContacts(ContactFilter2D, Collider2D[])
Declaration
public int GetContacts(ContactFilter2D contactFilter, Collider2D[] colliders)
Parameters
Returns
|
Improve this Doc
View Source
GetContacts(ContactFilter2D, ContactPoint2D[])
Declaration
public int GetContacts(ContactFilter2D contactFilter, ContactPoint2D[] contacts)
Parameters
Returns
|
Improve this Doc
View Source
GetContacts(ContactPoint2D[])
Declaration
public int GetContacts(ContactPoint2D[] contacts)
Parameters
Returns
GetPoint(Vector2)
Declaration
public Vector2 GetPoint(Vector2 point)
Parameters
Type |
Name |
Description |
Vector2 |
point |
|
Returns
GetPointVelocity(Vector2)
Declaration
public Vector2 GetPointVelocity(Vector2 point)
Parameters
Type |
Name |
Description |
Vector2 |
point |
|
Returns
GetRelativePoint(Vector2)
Declaration
public Vector2 GetRelativePoint(Vector2 relativePoint)
Parameters
Type |
Name |
Description |
Vector2 |
relativePoint |
|
Returns
GetRelativePointVelocity(Vector2)
Declaration
public Vector2 GetRelativePointVelocity(Vector2 relativePoint)
Parameters
Type |
Name |
Description |
Vector2 |
relativePoint |
|
Returns
GetRelativeVector(Vector2)
Declaration
public Vector2 GetRelativeVector(Vector2 relativeVector)
Parameters
Type |
Name |
Description |
Vector2 |
relativeVector |
|
Returns
GetVector(Vector2)
Declaration
public Vector2 GetVector(Vector2 vector)
Parameters
Type |
Name |
Description |
Vector2 |
vector |
|
Returns
IsAwake()
Declaration
Returns
IsSleeping()
Declaration
Returns
IsTouching(Collider2D)
Declaration
public bool IsTouching(Collider2D collider)
Parameters
Returns
|
Improve this Doc
View Source
IsTouching(Collider2D, ContactFilter2D)
Declaration
public bool IsTouching(Collider2D collider, ContactFilter2D contactFilter)
Parameters
Returns
|
Improve this Doc
View Source
IsTouching(ContactFilter2D)
Declaration
public bool IsTouching(ContactFilter2D contactFilter)
Parameters
Returns
|
Improve this Doc
View Source
IsTouchingLayers()
Declaration
[ExcludeFromDocs]
public bool IsTouchingLayers()
Returns
IsTouchingLayers(Int32)
Declaration
public bool IsTouchingLayers([DefaultValue("Physics2D.AllLayers")] int layerMask)
Parameters
Type |
Name |
Description |
Int32 |
layerMask |
|
Returns
MovePosition(Vector2)
Declaration
public void MovePosition(Vector2 position)
Parameters
Type |
Name |
Description |
Vector2 |
position |
|
MoveRotation(Single)
Declaration
public void MoveRotation(float angle)
Parameters
Type |
Name |
Description |
Single |
angle |
|
OverlapCollider(ContactFilter2D, Collider2D[])
Declaration
public int OverlapCollider(ContactFilter2D contactFilter, Collider2D[] results)
Parameters
Returns
OverlapPoint(Vector2)
Declaration
public bool OverlapPoint(Vector2 point)
Parameters
Type |
Name |
Description |
Vector2 |
point |
|
Returns
Sleep()
Declaration
WakeUp()
Declaration
Extension Methods