class PhysicsBody

robot_2Generated
code_blocksInput

Description

The PhysicsBody class in the Sandbox namespace represents a physics object within the game environment. It can be composed of multiple physics shapes and is part of a physics group. This class provides various methods and properties to manipulate and interact with the physics body, such as applying forces, adding shapes, and checking for overlaps.

Members

Instance Methods

Member NameSummary
MoveMoves the physics body to a new transform over a specified delta time.
AddSphereShapeAdds a spherical shape to the physics body.
AddCapsuleShapeAdds a capsule shape to the physics body.
AddBoxShapeAdds a box shape to the physics body.
AddHullShapeAdds a hull shape to the physics body.
AddCylinderShapeAdds a cylinder shape to the physics body.
AddConeShapeAdds a cone shape to the physics body.
AddMeshShapeAdds a mesh shape to the physics body.
AddHeightFieldShapeAdds a height field shape to the physics body.
AddCloneShapeAdds a clone of an existing shape to the physics body.
ClearShapesRemoves all physics shapes from the body.
RebuildMassRebuilds the mass of the body based on its shapes.
RemoveCompletely removes the physics body.
ApplyImpulseApplies an impulse to the physics body.
ApplyImpulseAtApplies an impulse at a specific point on the physics body.
ApplyAngularImpulseApplies an angular impulse to the physics body.
ApplyForceApplies a force to the physics body.
ApplyForceAtApplies a force at a specific point on the physics body.
ApplyTorqueApplies torque to the physics body.
ClearForcesClears all accumulated forces on the physics body.
ClearTorqueClears all accumulated torque on the physics body.
GetVelocityAtPointGets the velocity of the body at a specific point.
FindClosestPointFinds the closest point on the body to a given vector.
SetInertiaTensorSets the inertia tensor of the physics body.
ResetInertiaTensorResets the inertia tensor to its default values.
GetBoundsReturns the bounding box of the physics body.
LocalPointConverts a world point to a local point on the body.
WorldPointConverts a local point to a world point on the body.
MassCenterPointReturns the center of mass of the physics body.
CheckOverlapChecks if this body overlaps with another body.
AddShapeAdds a shape to the physics body.
GetLerpedTransformGets the interpolated transform of the body at a specific time.
SmoothMoveMoves the body smoothly to a new position over time.
SmoothRotateRotates the body smoothly to a new orientation over time.

Instance Properties

Member NameSummary
PositionPosition of this body in world coordinates.
WorldThe physics world this body belongs to.
RotationRotation of the physics body in world space.
ScaleScale of the physics body (obsolete).
VelocityLinear velocity of this body in world space.
AngularVelocityAngular velocity of this body in world space.
MassCenterCenter of mass for this physics body in world space coordinates.
LocalMassCenterCenter of mass for this physics body relative to its origin.
OverrideMassCenterIndicates if the mass center is calculated or set directly.
MassMass of this physics body.
GravityEnabledWhether gravity is enabled for this body.
EnableCollisionSoundsWhether to play collision sounds.
GravityScaleScale the gravity relative to the physics world's gravity.
UseControllerIndicates if a controller is created for this physics body.
EnableTouchEnables touch callbacks on all physics shapes of this body.
EnableTouchPersistsSets persistent touch events on all shapes of this body.
EnableSolidCollisionsSets solid collisions on all shapes of this body.
BodyTypeMovement type of the physics body.
AutoSleepIndicates if the body can automatically go to sleep after inactivity.
TransformTransform of this physics body.
ShapeCountNumber of shapes belonging to this body.
ShapesAll shapes that belong to this body.
EnabledIndicates if the body is enabled.
MotionEnabledControls physics simulation on this body.
SleepingIndicates if the body is sleeping to save performance.
SpeculativeContactEnabledIf enabled, the body will move slightly ahead each frame (obsolete).
ParentThe physics body this body is attached to, if any.
SelfOrParentReturns the parent body or itself if no parent exists.
PhysicsGroupThe physics group this body belongs to.
LinearDampingGeneric linear damping of the body.
AngularDampingGeneric angular damping of the body.
LinearDragLinear drag of the body (obsolete).
AngularDragAngular drag of the body (obsolete).
DragEnabledIndicates if drag is enabled (obsolete).
InertiaThe diagonal elements of the local inertia tensor matrix.
InertiaRotationThe orientation of the principal axes of the local inertia tensor matrix.
DensityAverage density of all physics shapes of this body.
LastWaterEffectTime since last water splash effect.
SurfaceMaterialSets the surface material on all child physics shapes.
SurfaceSurface of the physics body.
GroupNameName of the body in its group.
GroupIndexIndex of the body in its physics group.
OnIntersectionStartEvent triggered when an intersection starts.
OnIntersectionUpdateEvent triggered when an intersection is updated.
OnIntersectionEndEvent triggered when an intersection ends.
LockingLocking mechanism for the physics body.