Represents a physics object. An entity can have multiple physics objects. See PhysicsGroup. A physics objects consists of one or more PhysicsShapes.
Generic angular damping, i.e. how much the physics body will slow down on its own.
Amount of air drag to be applied to angular movement/rotation. Default is 1. This should take into account object's rotation and surface area in direction of rotation, unlike PhysicsBody.AngularDamping. See PhysicsWorld.AirDensity and PhysicsBody.DragEnabled.
Angular velocity of this body in world space.
Whether this body is allowed to automatically go into "sleep" after a certain amount of time of inactivity. PhysicsBody.Sleeping for more info on the sleep mechanic.
Movement type of physics body, either Static, Keyframed, Dynamic Note: If this body is networked and dynamic, it will return Keyframed on the client
Returns average of densities for all physics shapes of this body. This is based on PhysicsShape.SurfaceMaterial of each shape.
Whether air drag forces are enabled for this body. See PhysicsWorld.AirDensity, PhysicsBody.AngularDrag and PhysicsBody.LinearDrag.
Whether this body is enabled or not. Disables collisions, physics simulation, touch events, trace queries, etc.
Sets PhysicsShape.EnableSolidCollisions on all shapes of this body.
Returns true if ANY of the physics shapes have solid collisions enabled.
Enables Touch callbacks on all PhysicsShapes of this body. Returns true if ANY of the physics shapes have touch events enabled.
Sets PhysicsShape.EnableTouchPersists on all shapes of this body.
Returns true if ANY of the physics shapes have persistent touch events enabled.
Sets PhysicsShape.EnableTraceAndQueries on all shapes of this body.
Returns true if ANY of the physics shapes have traces and queries enabled.
Whether gravity is enabled for this body or not.
Scale the gravity relative to PhysicsWorld.Gravity. 2 is double the gravity, etc.
Return the index of this body in its PhysicsGroup
What is this body called in the group?
The orientation of the principal axes of inertia tensor matrix.
Time since last water splash effect. Used internally.
Generic linear damping, i.e. how much the physics body will slow down on its own.
Amount of air drag to be applied to linear movement (i.e. not rotational movement). Default is 1. This should take into account object's rotation and surface area in direction of movement, unlike PhysicsBody.LinearDamping. See PhysicsWorld.AirDensity and PhysicsBody.DragEnabled.
Center of mass for this physics body relative to its origin.
Mass of this physics body.
Center of mass for this physics body in world space coordinates.
Controls physics simulation on this body.
The physics body we are attached to, if any
The physics group we belong to.
Returns the scale of this object. (Most of the time inherited from owning entity's scale)
A convenience property, returns Parent, or if there is no parent, returns itself.
All shapes that belong to this body.
Physics bodies automatically go to sleep after a certain amount of time of inactivity to save on performance. You can use this to wake the body up, or prematurely send it to sleep.
If enabled, this physics body will move slightly ahead each frame based on its velocities.
Sets PhysicsShape.SurfaceMaterial on all child PhysicsShapes.
If true we'll create a controller for this physics body. This is useful for keyframed physics objects that need to push things. The controller will sweep as the entity moves, rather than teleporting the object.. which works better when pushing dynamic objects etc.
The physics world this body belongs to.
Add a box shape to this body.
Add a capsule shape to this body.
Clones given shape and adds it to this body.
Add a convex hull shape to this body.
Add a convex hull shape to this body.
Adds a mesh type shape to this physics body. Mesh shapes cannot be physically simulated!
Adds a mesh type shape to this physics body. Mesh shapes cannot be physically simulated!
Add a sphere shape to this body.
Applies instant angular impulse (i.e. a bullet impact) to this body. For continuous force (i.e. a moving car), use PhysicsBody.ApplyTorque
Applies force to this body at the center of mass. This force will only be applied on the next physics frame and is scaled with physics timestep.
Applies force to this body at given position. This is akin to a bullet impact off center, and is capable of applying angular forces. This force will only be applied on the next physics frame and is scaled with physics timestep.
Applies instant linear impulse (i.e. a bullet impact) to this body at its center of mass. For continuous force (i.e. a moving car), use PhysicsBody.ApplyForce
Applies instant linear impulse (i.e. a bullet impact) to this body at given position. For continuous force (i.e. a moving car), use PhysicsBody.ApplyForceAt
Applies angular velocity to this body. This force will only be applied on the next physics frame and is scaled with physics timestep.
Checks if another body overlaps us, ignoring all collision rules
Checks if another body overlaps us at a given transform, ignoring all collision rules
Clear accumulated linear forces (PhysicsBody.ApplyForce and PhysicsBody.ApplyForceAt) during this physics frame that were not yet applied to the physics body.
Remove all physics shapes, but not the physics body itself.
Clear accumulated torque (angular force, PhysicsBody.ApplyTorque) during this physics frame that were not yet applied to the physics body.
Returns the closest point to the given one between all convex shapes of this body.
Returns the world space velocity of a point of the object. This is useful for objects rotating around their own axis/origin.
Convenience function that returns a Physics.PhysicsPoint from a position relative to this body.
Returns a Physics.PhysicsPoint at the center of mass of this body.
Meant to be only used on dynamic bodies, rebuilds mass from all shapes of this body based on their volume and physics properties, for cases where they may have changed.
Completely removes this physics body.
Overrides VelocityIterations and PositionIterations of this body's Sandbox.PhysicsWorld at simulation time, if they are lower than given amounts.
Convenience function that returns a Physics.PhysicsPoint for this body from a world space position.