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
| Property | Type | Access |
|---|---|---|
| angularDrag | float | get, set |
| angularVelocity | Vector3 | get, set |
| automaticCenterOfMass | bool | get, set |
| automaticInertiaTensor | bool | get, set |
| centerOfMass | Vector3 | get, set |
| collisionDetectionMode | UnityEngineCollisionDetectionMode | get, set |
| constraints | UnityEngineRigidbodyConstraints | get, set |
| detectCollisions | bool | get, set |
| drag | float | get, set |
| excludeLayers | UnityEngineLayerMask | get, set |
| freezeRotation | bool | get, set |
| gameObject | GameObject | get |
| includeLayers | UnityEngineLayerMask | get, set |
| inertiaTensor | Vector3 | get, set |
| inertiaTensorRotation | Quaternion | get, set |
| interpolation | UnityEngineRigidbodyInterpolation | get, set |
| isKinematic | bool | get, set |
| mass | float | get, set |
| maxAngularVelocity | float | get, set |
| maxDepenetrationVelocity | float | get, set |
| maxLinearVelocity | float | get, set |
| name | string | get, set |
| position | Vector3 | get, set |
| rotation | Quaternion | get, set |
| solverIterations | int | get, set |
| solverVelocityIterations | int | get, set |
| transform | Transform | get |
| useGravity | bool | get, set |
| velocity | Vector3 | get, set |
| worldCenterOfMass | Vector3 | get |
angularDrag
Rotational drag coefficient. Higher values slow rotation faster.
rb.angularDrag = 1.0angularVelocity
The angular (rotational) velocity in radians per second.
let spin: Vector3 = rb.angularVelocitydrag
Linear drag coefficient. Higher values slow movement faster.
rb.drag = 0.5isKinematic
When true, the rigidbody is not driven by physics but can still affect other bodies.
rb.isKinematic = truemass
The mass of the rigidbody in kilograms.
rb.mass = 2.0position
The position of the rigidbody in physics space.
let pos: Vector3 = rb.positionrotation
The rotation of the rigidbody in physics space.
let rot: Quaternion = rb.rotationuseGravity
Whether gravity affects this rigidbody.
rb.useGravity = falsevelocity
The linear velocity of the rigidbody in world-space units per second.
let vel: Vector3 = rb.velocityMethods
AddExplosionForce
AddExplosionForce(explosionForce: float, explosionPosition: Vector3, explosionRadius: float, upwardsModifier: float, mode: UnityEngineForceMode) -> voidAddExplosionForce(explosionForce: float, explosionPosition: Vector3, explosionRadius: float, upwardsModifier: float) -> voidAddExplosionForce(explosionForce: float, explosionPosition: Vector3, explosionRadius: float) -> voidAddForce
AddForce(x: float, y: float, z: float, mode: UnityEngineForceMode) -> voidAddForce(x: float, y: float, z: float) -> voidAddForce(force: Vector3, mode: UnityEngineForceMode) -> voidAddForce(force: Vector3) -> voidApplies a force vector to the rigidbody, pushing it over time.
rb.AddForce(Vector3.up * 10.0)AddForceAtPosition
AddForceAtPosition(force: Vector3, position: Vector3, mode: UnityEngineForceMode) -> voidAddForceAtPosition(force: Vector3, position: Vector3) -> voidAddRelativeForce
AddRelativeForce(x: float, y: float, z: float, mode: UnityEngineForceMode) -> voidAddRelativeForce(x: float, y: float, z: float) -> voidAddRelativeForce(force: Vector3, mode: UnityEngineForceMode) -> voidAddRelativeForce(force: Vector3) -> voidAddRelativeTorque
AddRelativeTorque(x: float, y: float, z: float, mode: UnityEngineForceMode) -> voidAddRelativeTorque(x: float, y: float, z: float) -> voidAddRelativeTorque(torque: Vector3, mode: UnityEngineForceMode) -> voidAddRelativeTorque(torque: Vector3) -> voidAddTorque
AddTorque(x: float, y: float, z: float, mode: UnityEngineForceMode) -> voidAddTorque(x: float, y: float, z: float) -> voidAddTorque(torque: Vector3, mode: UnityEngineForceMode) -> voidAddTorque(torque: Vector3) -> voidApplies a torque vector, causing the rigidbody to spin.
rb.AddTorque(Vector3.up * 5.0)ClosestPointOnBounds
ClosestPointOnBounds(position: Vector3) -> Vector3Equals
Equals(other: object) -> boolGetAccumulatedForce
GetAccumulatedForce(step: float) -> Vector3GetAccumulatedForce() -> Vector3GetAccumulatedTorque
GetAccumulatedTorque(step: float) -> Vector3GetAccumulatedTorque() -> Vector3GetComponent
GetComponent(type: string) -> UnityEngineComponentGetComponent(type: SystemType) -> UnityEngineComponentGetComponent(type: SystemType) -> UnityEngineObjectGetComponentInChildren
GetComponentInChildren(includeInactive: bool, type: SystemType) -> UnityEngineObjectGetComponentInChildren(t: SystemType, includeInactive: bool) -> UnityEngineComponentGetComponentInChildren(t: SystemType) -> UnityEngineComponentGetComponentInChildren(type: SystemType) -> UnityEngineObjectGetComponentInParent
GetComponentInParent(includeInactive: bool, type: SystemType) -> UnityEngineObjectGetComponentInParent(t: SystemType, includeInactive: bool) -> UnityEngineComponentGetComponentInParent(t: SystemType) -> UnityEngineComponentGetComponentInParent(type: SystemType) -> UnityEngineObjectGetComponents
GetComponents(results: SystemCollectionsGenericList`1[[UnityEngineObject, UnityEngineCoreModule, Version=0000, Culture=neutral, PublicKeyToken=null]], type: SystemType) -> voidGetComponents(type: SystemType, results: SystemCollectionsGenericList`1[[UnityEngineComponent, UnityEngineCoreModule, Version=0000, Culture=neutral, PublicKeyToken=null]]) -> voidGetComponents(type: SystemType) -> UnityEngineComponent[]GetComponents(type: SystemType) -> UnityEngineObject[]GetComponentsInChildren
GetComponentsInChildren(results: SystemCollectionsGenericList`1[[UnityEngineObject, UnityEngineCoreModule, Version=0000, Culture=neutral, PublicKeyToken=null]], type: SystemType) -> voidGetComponentsInChildren(includeInactive: bool, result: SystemCollectionsGenericList`1[[UnityEngineObject, UnityEngineCoreModule, Version=0000, Culture=neutral, PublicKeyToken=null]]) -> voidGetComponentsInChildren(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]]) -> voidGetComponentsInParent(includeInactive: bool, type: SystemType) -> UnityEngineObject[]GetComponentsInParent(t: SystemType, includeInactive: bool) -> UnityEngineComponent[]GetComponentsInParent(t: SystemType) -> UnityEngineComponent[]GetComponentsInParent(type: SystemType) -> UnityEngineObject[]GetHashCode
GetHashCode() -> intGetInstanceID
GetInstanceID() -> intGetPointVelocity
GetPointVelocity(worldPoint: Vector3) -> Vector3GetRelativePointVelocity
GetRelativePointVelocity(relativePoint: Vector3) -> Vector3GetType
GetType() -> SystemTypeIsSleeping
IsSleeping() -> boolMove
Move(position: Vector3, rotation: Quaternion) -> voidMovePosition
MovePosition(position: Vector3) -> voidMoves the rigidbody to a position, respecting physics interpolation.
rb.MovePosition(targetPosition)MoveRotation
MoveRotation(rot: Quaternion) -> voidRotates the rigidbody to a rotation, respecting physics interpolation.
rb.MoveRotation(targetRotation)ResetCenterOfMass
ResetCenterOfMass() -> voidResetInertiaTensor
ResetInertiaTensor() -> voidSetDensity
SetDensity(density: float) -> voidSleep
Sleep() -> voidSweepTest
SweepTest(direction: Vector3, hitInfo: UnityEngineRaycastHit, maxDistance: float, queryTriggerInteraction: UnityEngineQueryTriggerInteraction) -> boolSweepTest(direction: Vector3, hitInfo: UnityEngineRaycastHit, maxDistance: float) -> boolSweepTest(direction: Vector3, hitInfo: UnityEngineRaycastHit) -> boolSweepTestAll
SweepTestAll(direction: Vector3, maxDistance: float, queryTriggerInteraction: UnityEngineQueryTriggerInteraction) -> UnityEngineRaycastHit[]SweepTestAll(direction: Vector3, maxDistance: float) -> UnityEngineRaycastHit[]SweepTestAll(direction: Vector3) -> UnityEngineRaycastHit[]ToString
ToString() -> stringWakeUp
WakeUp() -> void