Skip to content

Rigidbody

Adds physics simulation to a GameObject, enabling gravity, collisions, and forces. In VRChat worlds, Rigidbodies drive throwable pickups, physics puzzles, and any object that needs to move realistically.

Properties

PropertyTypeAccess
angularDragfloatget, set
angularVelocityVector3get, set
automaticCenterOfMassboolget, set
automaticInertiaTensorboolget, set
centerOfMassVector3get, set
collisionDetectionModeUnityEngineCollisionDetectionModeget, set
constraintsUnityEngineRigidbodyConstraintsget, set
detectCollisionsboolget, set
dragfloatget, set
excludeLayersUnityEngineLayerMaskget, set
freezeRotationboolget, set
gameObjectGameObjectget
includeLayersUnityEngineLayerMaskget, set
inertiaTensorVector3get, set
inertiaTensorRotationQuaternionget, set
interpolationUnityEngineRigidbodyInterpolationget, set
isKinematicboolget, set
massfloatget, set
maxAngularVelocityfloatget, set
maxDepenetrationVelocityfloatget, set
maxLinearVelocityfloatget, set
namestringget, set
positionVector3get, set
rotationQuaternionget, set
solverIterationsintget, set
solverVelocityIterationsintget, set
transformTransformget
useGravityboolget, set
velocityVector3get, set
worldCenterOfMassVector3get

angularDrag

Rotational drag coefficient. Higher values slow rotation faster.

rb.angularDrag = 1.0

angularVelocity

The angular (rotational) velocity in radians per second.

let spin: Vector3 = rb.angularVelocity

drag

Linear drag coefficient. Higher values slow movement faster.

rb.drag = 0.5

isKinematic

When true, the rigidbody is not driven by physics but can still affect other bodies.

rb.isKinematic = true

mass

The mass of the rigidbody in kilograms.

rb.mass = 2.0

position

The position of the rigidbody in physics space.

let pos: Vector3 = rb.position

rotation

The rotation of the rigidbody in physics space.

let rot: Quaternion = rb.rotation

useGravity

Whether gravity affects this rigidbody.

rb.useGravity = false

velocity

The linear velocity of the rigidbody in world-space units per second.

let vel: Vector3 = rb.velocity

Methods

AddExplosionForce

AddExplosionForce(explosionForce: float, explosionPosition: Vector3, explosionRadius: float, upwardsModifier: float, mode: UnityEngineForceMode) -> void
AddExplosionForce(explosionForce: float, explosionPosition: Vector3, explosionRadius: float, upwardsModifier: float) -> void
AddExplosionForce(explosionForce: float, explosionPosition: Vector3, explosionRadius: float) -> void

AddForce

AddForce(x: float, y: float, z: float, mode: UnityEngineForceMode) -> void
AddForce(x: float, y: float, z: float) -> void
AddForce(force: Vector3, mode: UnityEngineForceMode) -> void
AddForce(force: Vector3) -> void

Applies a force vector to the rigidbody, pushing it over time.

rb.AddForce(Vector3.up * 10.0)

AddForceAtPosition

AddForceAtPosition(force: Vector3, position: Vector3, mode: UnityEngineForceMode) -> void
AddForceAtPosition(force: Vector3, position: Vector3) -> void

AddRelativeForce

AddRelativeForce(x: float, y: float, z: float, mode: UnityEngineForceMode) -> void
AddRelativeForce(x: float, y: float, z: float) -> void
AddRelativeForce(force: Vector3, mode: UnityEngineForceMode) -> void
AddRelativeForce(force: Vector3) -> void

AddRelativeTorque

AddRelativeTorque(x: float, y: float, z: float, mode: UnityEngineForceMode) -> void
AddRelativeTorque(x: float, y: float, z: float) -> void
AddRelativeTorque(torque: Vector3, mode: UnityEngineForceMode) -> void
AddRelativeTorque(torque: Vector3) -> void

AddTorque

AddTorque(x: float, y: float, z: float, mode: UnityEngineForceMode) -> void
AddTorque(x: float, y: float, z: float) -> void
AddTorque(torque: Vector3, mode: UnityEngineForceMode) -> void
AddTorque(torque: Vector3) -> void

Applies a torque vector, causing the rigidbody to spin.

rb.AddTorque(Vector3.up * 5.0)

ClosestPointOnBounds

ClosestPointOnBounds(position: Vector3) -> Vector3

Equals

Equals(other: object) -> bool

GetAccumulatedForce

GetAccumulatedForce(step: float) -> Vector3
GetAccumulatedForce() -> Vector3

GetAccumulatedTorque

GetAccumulatedTorque(step: float) -> Vector3
GetAccumulatedTorque() -> Vector3

GetComponent

GetComponent(type: string) -> UnityEngineComponent
GetComponent(type: SystemType) -> UnityEngineComponent
GetComponent(type: SystemType) -> UnityEngineObject

GetComponentInChildren

GetComponentInChildren(includeInactive: bool, type: SystemType) -> UnityEngineObject
GetComponentInChildren(t: SystemType, includeInactive: bool) -> UnityEngineComponent
GetComponentInChildren(t: SystemType) -> UnityEngineComponent
GetComponentInChildren(type: SystemType) -> UnityEngineObject

GetComponentInParent

GetComponentInParent(includeInactive: bool, type: SystemType) -> UnityEngineObject
GetComponentInParent(t: SystemType, includeInactive: bool) -> UnityEngineComponent
GetComponentInParent(t: SystemType) -> UnityEngineComponent
GetComponentInParent(type: SystemType) -> UnityEngineObject

GetComponents

GetComponents(results: SystemCollectionsGenericList`1[[UnityEngineObject, UnityEngineCoreModule, Version=0000, Culture=neutral, PublicKeyToken=null]], type: SystemType) -> void
GetComponents(type: SystemType, results: SystemCollectionsGenericList`1[[UnityEngineComponent, UnityEngineCoreModule, Version=0000, Culture=neutral, PublicKeyToken=null]]) -> void
GetComponents(type: SystemType) -> UnityEngineComponent[]
GetComponents(type: SystemType) -> UnityEngineObject[]

GetComponentsInChildren

GetComponentsInChildren(results: SystemCollectionsGenericList`1[[UnityEngineObject, UnityEngineCoreModule, Version=0000, Culture=neutral, PublicKeyToken=null]], type: SystemType) -> void
GetComponentsInChildren(includeInactive: bool, result: SystemCollectionsGenericList`1[[UnityEngineObject, UnityEngineCoreModule, Version=0000, Culture=neutral, PublicKeyToken=null]]) -> void
GetComponentsInChildren(includeInactive: bool, type: SystemType) -> UnityEngineObject[]
GetComponentsInChildren(t: SystemType, includeInactive: bool) -> UnityEngineComponent[]
GetComponentsInChildren(t: SystemType) -> UnityEngineComponent[]
GetComponentsInChildren(type: SystemType) -> UnityEngineObject[]

GetComponentsInParent

GetComponentsInParent(includeInactive: bool, results: SystemCollectionsGenericList`1[[UnityEngineObject, UnityEngineCoreModule, Version=0000, Culture=neutral, PublicKeyToken=null]]) -> void
GetComponentsInParent(includeInactive: bool, type: SystemType) -> UnityEngineObject[]
GetComponentsInParent(t: SystemType, includeInactive: bool) -> UnityEngineComponent[]
GetComponentsInParent(t: SystemType) -> UnityEngineComponent[]
GetComponentsInParent(type: SystemType) -> UnityEngineObject[]

GetHashCode

GetHashCode() -> int

GetInstanceID

GetInstanceID() -> int

GetPointVelocity

GetPointVelocity(worldPoint: Vector3) -> Vector3

GetRelativePointVelocity

GetRelativePointVelocity(relativePoint: Vector3) -> Vector3

GetType

GetType() -> SystemType

IsSleeping

IsSleeping() -> bool

Move

Move(position: Vector3, rotation: Quaternion) -> void

MovePosition

MovePosition(position: Vector3) -> void

Moves the rigidbody to a position, respecting physics interpolation.

rb.MovePosition(targetPosition)

MoveRotation

MoveRotation(rot: Quaternion) -> void

Rotates the rigidbody to a rotation, respecting physics interpolation.

rb.MoveRotation(targetRotation)

ResetCenterOfMass

ResetCenterOfMass() -> void

ResetInertiaTensor

ResetInertiaTensor() -> void

SetDensity

SetDensity(density: float) -> void

Sleep

Sleep() -> void

SweepTest

SweepTest(direction: Vector3, hitInfo: UnityEngineRaycastHit, maxDistance: float, queryTriggerInteraction: UnityEngineQueryTriggerInteraction) -> bool
SweepTest(direction: Vector3, hitInfo: UnityEngineRaycastHit, maxDistance: float) -> bool
SweepTest(direction: Vector3, hitInfo: UnityEngineRaycastHit) -> bool

SweepTestAll

SweepTestAll(direction: Vector3, maxDistance: float, queryTriggerInteraction: UnityEngineQueryTriggerInteraction) -> UnityEngineRaycastHit[]
SweepTestAll(direction: Vector3, maxDistance: float) -> UnityEngineRaycastHit[]
SweepTestAll(direction: Vector3) -> UnityEngineRaycastHit[]

ToString

ToString() -> string

WakeUp

WakeUp() -> void