Skip to main content

Rigidbody

info

Rigidbody inherits from Component

Control of an object's position through physics simulation. Unity Rigidbody

Members

Properties

NameDescription
Rigidbody.angularDragThe angular drag of the object.
Rigidbody.angularVelocityThe angular velocity vector of the rigidbody measured in radians per second.
Rigidbody.centerOfMassThe center of mass relative to the transform's origin.
Rigidbody.collisionDetectionModeThe Rigidbody's collision detection mode.
Rigidbody.constraintsControls which degrees of freedom are allowed for the simulation of this Rigidbody.
Rigidbody.detectCollisionsShould collision detection be enabled? (By default always enabled).
Rigidbody.dragThe drag of the object.
Rigidbody.freezeRotationControls whether physics will change the rotation of the object.
Rigidbody.inertiaTensorThe diagonal inertia tensor of mass relative to the center of mass.
Rigidbody.inertiaTensorRotationThe rotation of the inertia tensor.
Rigidbody.interpolationInterpolation allows you to smooth out the effect of running physics at a fixed frame rate.
Rigidbody.isKinematicControls whether physics affects the rigidbody.
Rigidbody.massThe mass of the rigidbody.
Rigidbody.maxAngularVelocityThe maximimum angular velocity of the rigidbody measured in radians per second. (Default 7) range [0, infinity].
Rigidbody.maxDepenetrationVelocityMaximum velocity of a rigidbody when moving out of penetrating state.
Rigidbody.positionThe position of the rigidbody.
Rigidbody.rotationThe rotation of the Rigidbody.
Rigidbody.sleepThresholdThe mass-normalized energy threshold, below which objects start going to sleep.
Rigidbody.solverIterationsThe solverIterations determines how accurately Rigidbody joints and collision contacts are resolved. Overrides Physics.defaultSolverIterations. Must be positive.
Rigidbody.solverVelocityIterationsThe solverVelocityIterations affects how how accurately Rigidbody joints and collision contacts are resolved. Overrides Physics.defaultSolverVelocityIterations. Must be positive.
Rigidbody.useGravityControls whether gravity affects this rigidbody.
Rigidbody.velocityThe velocity vector of the rigidbody. It represents the rate of change of Rigidbody position.
Rigidbody.worldCenterOfMassThe center of mass of the rigidbody in world space (Read Only).

Methods

NameDescription
Rigidbody.AddExplosionForce(explosionForce, explosionPosition, explosionRadius, upwardsModifier=0, mode=ForceMode.Force)Applies a force to a rigidbody that simulates explosion effects.
Rigidbody.AddForce(force, mode=ForceMode.Force)Adds a force to the Rigidbody.
Rigidbody.AddForceAtPosition(force, position, mode=ForceMode.Force)Applies force at position. As a result this will apply a torque and force on the object.
Rigidbody.AddRelativeForce(force, mode=ForceMode.Force)Adds a force to the rigidbody relative to its coordinate system.
Rigidbody.AddRelativeTorque(torque, mode=ForceMode.Force)Adds a torque to the rigidbody relative to its coordinate system.
Rigidbody.AddTorque(torque, mode=ForceMode.Force)Adds a torque to the rigidbody.
Rigidbody.ClosestPointOnBounds(position)The closest point to the bounding box of the attached colliders.
Rigidbody.GetPointVelocity(worldPoint)The velocity of the rigidbody at the point worldPoint in global space.
Rigidbody.GetRelativePointVelocity(relativePoint)The velocity relative to the rigidbody at the point relativePoint.
Rigidbody.IsSleeping()Is the rigidbody sleeping?
Rigidbody.MovePosition(position)Moves the kinematic Rigidbody towards position.
Rigidbody.MoveRotation(rot)Rotates the rigidbody to rotation.
Rigidbody.ResetCenterOfMass()Reset the center of mass of the rigidbody.
Rigidbody.ResetInertiaTensor()Reset the inertia tensor value and rotation.
Rigidbody.SetDensity(density)Sets the mass based on the attached colliders assuming a constant density.
Rigidbody.Sleep()Forces a rigidbody to sleep at least one frame.
Rigidbody.SweepTest(direction, maxDistance=math.huge, queryTriggerInteraction=QueryTriggerInteraction.UseGlobal)Tests if a rigidbody would collide with anything, if it was moved through the Scene.
Rigidbody.SweepTestAll(direction, maxDistance=math.huge, queryTriggerInteraction=QueryTriggerInteraction.UseGlobal)Like Rigidbody.SweepTest, but returns all hits.
Rigidbody.WakeUp()Forces a rigidbody to wake up.

Inherited Members

Inherited Properties

NameDescription
Rigidbody.gameObjectThe game object this component is attached to. A component is always attached to a game object.
Rigidbody.tagThe tag of this game object.
Rigidbody.transformThe Transform attached to this GameObject.
Rigidbody.hideFlagsShould the object be hidden, saved with the Scene or modifiable by the user?
Rigidbody.nameThe name of the object.

Inherited Methods

NameDescription
Rigidbody.BroadcastMessage(methodName, parameter=nil)Calls the method named methodName on every Lua Script in this game object or any of its children.
Rigidbody.CompareTag(tag)Is this game object tagged with tag ?
Rigidbody.GetAllLuaScripts()Returns an array of all Lua scripts that attached to the game object.
Rigidbody.GetComponent(type)Returns the component of Type type if the game object has one attached, nil if it doesn't.
Rigidbody.GetComponentInChildren(t)Returns the component of Type type in the GameObject or any of its children using depth first search.
Rigidbody.GetComponentInParent(t)Returns the component of Type type in the GameObject or any of its parents.
Rigidbody.GetComponents(type)Returns all components of Type type in the GameObject.
Rigidbody.GetComponentsInChildren(t)Returns all components of Type type in the GameObject or any of its children.
Rigidbody.GetComponentsInParent(t)Returns all components of Type type in the GameObject or any of its parents.
Rigidbody.SendMessage(methodName, value=nil)Calls the method named methodName on every Lua Script in this game object.
Rigidbody.SendMessageUpwards(methodName, value=nil)Calls the method named methodName on every LuaScript in this game object and on every ancestor of the behaviour.
Rigidbody.TryGetComponent(type)Gets the component of the specified type, if it exists.
Rigidbody.GetInstanceID()Returns the instance id of the object.