class Rigidbody : Component

book_4_sparkGenerated
code_blocksInput

Description

The Rigidbody class in the Sandbox namespace adds physics properties to an object. It requires a collider to be attached to the same object. This class provides various methods and properties to manipulate the physical behavior of an object in a scene.

Members

Properties

Member NameSummary
GravityIs gravity enabled or not.
LinearDampingControls the linear damping of the rigidbody.
AngularDampingControls the angular damping of the rigidbody.
MassOverrideOverride mass for this body, only when value is more than zero.
OverrideMassCenterDetermines if the mass center should be overridden.
MassCenterOverrideSpecifies the mass center override when OverrideMassCenter is true.
MassGets the mass of the rigidbody.
LockingDefines the physics lock state of the rigidbody.
StartAsleepIndicates if the rigidbody should start asleep.
RigidbodyFlagsFlags that define the behavior of the rigidbody.
VelocityGets or sets the velocity of the rigidbody.
AngularVelocityGets or sets the angular velocity of the rigidbody.
MotionEnabledIndicates if motion is enabled for the rigidbody.
CollisionEventsEnabledEnable or disable touch events. If disabled, ICollisionListener won't get any touch events and collision sounds won't occur.
CollisionUpdateEventsEnabledLike CollisionEventsEnabled but means the OnCollisionUpdate gets called when the collision persists.
SleepingIndicates if the rigidbody is currently sleeping.
PhysicsBodyGet the actual physics body that was created by this component. Be cautious as it can be null when the object is not enabled or the physics world is not available.
TouchingThis is a list of all of the triggers that we are touching.

Methods

Member NameSummary
FindClosestPointReturns the closest point to the given one between all convex shapes of this body.
GetVelocityAtPointReturns the world space velocity of a point of the object. Useful for objects rotating around their own axis/origin.
ApplyForceAtApplies force to this body at given position.
ApplyForceApplies linear force to this body.
ApplyTorqueApplies angular velocity to this body.
ApplyImpulseAtApplies instant linear impulse (i.e. a bullet impact) to this body at given position.
ApplyImpulseApplies instant linear impulse (i.e. a bullet impact) to this body.
ClearForcesClear accumulated linear forces during this physics frame that were not yet applied to the physics body.
SmoothMoveMoves the rigidbody smoothly to a target position over time.
SmoothRotateRotates the rigidbody smoothly to a target rotation over time.