Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/facepunch/sbox-public/llms.txt

Use this file to discover all available pages before exploring further.

s&box uses a component-based physics system built on Jolt Physics. This page covers the full API for all collider types, the Rigidbody component, and the joint components that constrain bodies to each other.

Colliders

Colliders define the shape of an object for physics simulation. They can exist standalone (acting as static or kinematic bodies) or alongside a Rigidbody (which controls dynamic simulation). All colliders share a common base class, Collider.

Collider base properties

All collider types inherit these properties from Collider.
Static
bool
default:"false"
When true, the collider is fixed in the world and never moves. When false and not attached to a Rigidbody, the collider is kinematic — it follows GameObject transform changes but is not driven by physics forces.
IsDynamic
bool
Read-only. true only when the collider is simulated by a Rigidbody with MotionEnabled. Returns false for static and kinematic bodies.
IsTrigger
bool
default:"false"
When true, the collider becomes a trigger volume. It detects overlaps but does not generate contact forces. Triggers fire OnTriggerEnter and OnTriggerExit.
Touching
IEnumerable<Collider>
Read-only. When this is a trigger, lists all colliders currently overlapping it. When this is a regular collider, lists all triggers it is currently touching.
LocalBounds
BBox
Read-only. The local bounding box encompassing all physics shapes in this collider.

Surface properties

Friction
float?
Overrides the material friction for this collider. Accepts values above 1 for extra grip. Leave as null to use the surface asset’s value.
Elasticity
float?
Controls how bouncy the collider is. 0 is fully inelastic; 1 is fully elastic. Leave as null to use the surface asset’s value.
RollingResistance
float?
Reduces rolling speed for sphere and capsule shapes. Leave as null to use the surface asset’s value.
Surface
Surface
The surface asset that defines sound, footstep, and material properties. Individual Friction, Elasticity, and RollingResistance overrides take priority over the asset’s values.
SurfaceVelocity
Vector3
A local velocity applied to the surface of the collider. Objects resting on this collider slide in this direction — useful for conveyor belts.

Trigger events

OnTriggerEnter
Action<Collider>
Fired when another collider enters this trigger volume.
OnTriggerExit
Action<Collider>
Fired when another collider exits this trigger volume.
OnObjectTriggerEnter
Action<GameObject>
Fired with the entering GameObject when any of its colliders enters this trigger.
OnObjectTriggerExit
Action<GameObject>
Fired with the exiting GameObject when all of its colliders have left this trigger.

Collider methods

GetVelocityAtPoint( Vector3 worldPoint )
Vector3
Returns the velocity of this collider at the given world-space point, accounting for rotation.
FindClosestPoint( Vector3 worldPoint )
Vector3
Returns the closest point on any convex shape of this collider to the given world-space point.
GetWorldBounds()
BBox
Returns the world-space bounding box of all physics shapes attached to this collider.

BoxCollider

BoxCollider defines a rectangular box shape.
var box = go.Components.Create<BoxCollider>();
box.Scale = new Vector3( 100, 100, 100 );
box.Center = Vector3.Zero;
Scale
Vector3
default:"(50, 50, 50)"
The full extents of the box from corner to corner in local space.
Center
Vector3
default:"(0, 0, 0)"
The center of the box relative to the GameObject’s local origin.

SphereCollider

SphereCollider defines a sphere shape. When the GameObject has non-uniform scale, the shape degrades to a convex hull approximation.
var sphere = go.Components.Create<SphereCollider>();
sphere.Radius = 32;
sphere.Center = Vector3.Zero;
Radius
float
default:"32"
Radius of the sphere in local space.
Center
Vector3
default:"(0, 0, 0)"
Center of the sphere relative to the GameObject’s local origin.

CapsuleCollider

CapsuleCollider defines a pill-shaped capsule between two points.
var capsule = go.Components.Create<CapsuleCollider>();
capsule.Start = Vector3.Zero;
capsule.End = Vector3.Up * 60;
capsule.Radius = 16;
Start
Vector3
default:"(0, 0, 0)"
Bottom center point of the capsule in local space.
End
Vector3
default:"(0, 0, 10)"
Top center point of the capsule in local space.
Radius
float
default:"16"
Radius of the capsule’s circular cross-section.

ModelCollider

ModelCollider generates physics shapes from a Model asset’s embedded collision data.
var mc = go.Components.Create<ModelCollider>();
mc.Model = Model.Load( "models/crate.vmdl" );
Model
Model
The model whose physics parts are used to build shapes. If left unset, ModelCollider attempts to auto-detect a sibling ModelRenderer and use its model.
ModelCollider supports concave meshes (IsConcave returns true for mesh parts). Concave colliders are always static — you cannot attach them to a Rigidbody with MotionEnabled.

Rigidbody

Rigidbody adds dynamic physics simulation to a GameObject. It requires at least one collider on the same object or a child object to generate the body’s mass and contact shapes.
var rb = go.Components.Create<Rigidbody>();
rb.Gravity = true;
rb.LinearDamping = 0.1f;

Rigidbody properties

Gravity
bool
default:"true"
Enables or disables gravitational force on this body.
GravityScale
float
default:"1.0"
Multiplier applied to PhysicsWorld.Gravity. Use 2 for double gravity, 0 to neutralize gravity without disabling it.
LinearDamping
float
default:"0"
Linear drag applied every physics step. Higher values slow linear movement faster.
AngularDamping
float
default:"0"
Angular drag applied every physics step. Higher values slow rotation faster.
MassOverride
float
default:"0"
Sets the body’s mass when greater than zero. When zero, mass is automatically computed from attached collider shapes and their surface densities.
Mass
float
Read-only. The current computed or overridden mass of the body in kilograms.
MassCenter
Vector3
Read-only. The center of mass in local space.
OverrideMassCenter
bool
default:"false"
When true, uses MassCenterOverride instead of the automatically computed center of mass.
MassCenterOverride
Vector3
Custom center of mass in local space. Only active when OverrideMassCenter is true.
Velocity
Vector3
Current linear velocity. Read or write to get or set the body’s movement. On proxies (networked), returns the last synced value.
AngularVelocity
Vector3
Current angular velocity in radians per second.
MotionEnabled
bool
default:"true"
When false, the body becomes kinematic — it still generates contacts but is not moved by forces.
Sleeping
bool
true when the physics engine has put the body to sleep due to low velocity. You can set this to false to wake it.
StartAsleep
bool
default:"false"
When true, the body starts in the sleep state on spawn.
Locking
PhysicsLock
Flags that restrict movement on specific axes. Combine flags to lock, for example, PhysicsLock.PositionZ | PhysicsLock.RotationX.
RigidbodyFlags
RigidbodyFlags
Miscellaneous flags. Currently supports DisableCollisionSounds to suppress automatic impact sound effects.
EnhancedCcd
bool
default:"false"
Enables continuous collision detection against dynamic bodies. Use for fast-moving objects like bullets.
PreciseContacts
bool
default:"false"
Forces contact manifolds to be freshly computed each frame instead of being recycled. Reduces ghost collisions on character-like bodies.
SleepThreshold
float
default:"2.0"
Speed in units per second below which the body enters sleep. Increase to improve stacking stability.
CollisionEventsEnabled
bool
default:"true"
When false, disables ICollisionListener events and collision sound triggers for this body.
CollisionUpdateEventsEnabled
bool
default:"false"
When true, OnCollisionUpdate is also dispatched while a collision persists each frame.
PhysicsBody
PhysicsBody
Read-only. The underlying PhysicsBody handle. May be null when the component is disabled. Do not store — the body can be recreated.
Touching
IEnumerable<Collider>
Read-only. All trigger colliders currently touching this rigidbody.
Joints
IReadOnlySet<Joint>
Read-only. All joints currently connected to this body.

Rigidbody methods

ApplyForce( in Vector3 force )
void
Applies a continuous force to the body at the center of mass. Force is accumulated and applied during the next physics step.
ApplyForceAt( in Vector3 position, in Vector3 force )
void
Applies a continuous force at a specific world-space point, generating torque when off-center.
ApplyTorque( in Vector3 force )
void
Applies angular force (torque) to the body.
ApplyImpulse( in Vector3 force )
void
Applies an instantaneous velocity change (impulse) at the center of mass.
ApplyImpulseAt( in Vector3 position, in Vector3 force )
void
Applies an instantaneous impulse at a specific world-space point.
ClearForces()
void
Cancels any accumulated forces that have not yet been applied to the body this frame.
SmoothMove( in Transform transform, float timeToArrive, float timeDelta )
void
Moves the body toward transform using velocity rather than teleportation, cooperating with the physics solver. Good for grabbed objects.
SmoothMove( in Vector3 position, float timeToArrive, float timeDelta )
void
Position-only overload of SmoothMove.
SmoothRotate( in Rotation rotation, float timeToArrive, float timeDelta )
void
Rotates the body toward rotation using angular velocity, cooperating with the solver.
GetVelocityAtPoint( in Vector3 position )
Vector3
Returns the world-space velocity at a specific point on the body, including the contribution of angular velocity.
FindClosestPoint( in Vector3 position )
Vector3
Returns the closest point on any convex shape of this body to the given world-space position.
GetWorldBounds()
BBox
Returns the world-space bounding box of the physics body.
InertiaTensor
Vector3
Gets or sets the inertia tensor diagonal. Set to override the auto-computed value; call ResetInertiaTensor() to revert.
ResetInertiaTensor()
void
Reverts InertiaTensor and InertiaTensorRotation to the values automatically computed from attached colliders.

Joints

Joints constrain two physics bodies relative to each other. All joints share a common Joint base class. Place a joint component on any GameObject and set the Body property to the target. The joint itself anchors at the component’s GameObject by default.

Joint base properties

Body
GameObject
The GameObject whose physics body this joint constrains. The joint searches the GameObject hierarchy upward for a Rigidbody or Collider. If none is found, the joint anchors to the world body.
AnchorBody
GameObject
Optional override for the source body. Defaults to the GameObject the joint component is on.
EnableCollision
bool
default:"false"
When true, the two connected bodies can still collide with each other.
BreakForce
float
default:"0"
Maximum linear impulse the joint can sustain before breaking. 0 means indestructible.
BreakTorque
float
default:"0"
Maximum angular impulse the joint can sustain before breaking. 0 means indestructible.
IsBroken
bool
Read-only at runtime. true when the joint has been broken.
OnBreak
Action
Fired when the joint breaks (either from exceeding BreakForce/BreakTorque or by calling Break()).
LinearStress
float
Read-only. The current linear impulse being applied to the joint this step.
AngularStress
float
Read-only. The current angular impulse being applied to the joint this step.
Body1
PhysicsBody
Read-only. The source physics body (the anchor side).
Body2
PhysicsBody
Read-only. The target physics body.

Joint methods

Break()
void
Breaks the joint immediately, firing OnBreak. Has no effect in the editor.
Unbreak()
void
Re-creates a previously broken joint. Has no effect in the editor.

FixedJoint

FixedJoint welds two bodies together at a fixed relative offset. The constraint is soft — it uses spring-damper parameters rather than a rigid weld, which improves solver stability.
var joint = go.Components.Create<FixedJoint>();
joint.Body = otherObject;
joint.LinearFrequency = 10;
joint.LinearDamping = 1;
LinearFrequency
float
default:"10"
Spring frequency for the linear constraint. Higher values make the weld stiffer.
LinearDamping
float
default:"1"
Damping ratio for the linear constraint. 1 is critically damped.
AngularFrequency
float
default:"10"
Spring frequency for the angular constraint.
AngularDamping
float
default:"1"
Damping ratio for the angular constraint.

HingeJoint

HingeJoint allows rotation around a single axis — like a door hinge or wheel axle. Optionally includes angle limits and a motor.
var hinge = go.Components.Create<HingeJoint>();
hinge.Body = doorBody;
hinge.MinAngle = -90;
hinge.MaxAngle = 0;
MinAngle
float
default:"0"
Minimum rotation angle in degrees.
MaxAngle
float
default:"0"
Maximum rotation angle in degrees. When both limits are 0, the hinge has unlimited rotation.
Motor
HingeJoint.MotorMode
default:"Disabled"
Motor mode. Disabled applies only friction. TargetAngle drives toward a set angle with a spring. TargetVelocity spins at a constant rate with a torque limit.
Friction
float
default:"0"
Passive resistance applied when Motor is Disabled.
TargetAngle
float
Target angle in degrees for TargetAngle motor mode.
Frequency
float
default:"1.0"
Spring frequency for the angle motor.
DampingRatio
float
default:"1.0"
Damping ratio for the angle motor.
TargetVelocity
float
Target angular velocity in degrees per second for TargetVelocity motor mode.
MaxTorque
float
Maximum torque the velocity motor can apply.
Angle
float
Read-only. Current hinge angle in degrees.
Speed
float
Read-only. Current rotational speed in degrees per second.
Axis
Vector3
Read-only. The hinge axis in world space.

SpringJoint

SpringJoint tries to maintain a target distance between two bodies using spring forces. It can pull, push, or both.
var spring = go.Components.Create<SpringJoint>();
spring.Body = target;
spring.RestLength = 100;
spring.Frequency = 5;
spring.Damping = 0.7f;
RestLength
float
default:"50"
The distance the spring tries to maintain between the two anchor points.
MinLength
float
default:"0"
Minimum allowed distance. The spring never compresses below this.
MaxLength
float
default:"100"
Maximum allowed distance. The spring never stretches beyond this.
Frequency
float
default:"5"
Spring stiffness. Higher values make the spring snap back faster.
Damping
float
default:"0.7"
Damping ratio. 1 is critically damped; values below 1 allow oscillation.
ForceMode
SpringJoint.SpringForceMode
default:"Both"
Pull applies force only when stretched, Push only when compressed, Both applies force in both directions.

SliderJoint

SliderJoint restricts a body to move along a single axis relative to another — like a piston or drawer.
var slider = go.Components.Create<SliderJoint>();
slider.Body = platform;
slider.MinLength = 0;
slider.MaxLength = 200;
MinLength
float
default:"0"
Minimum slide distance.
MaxLength
float
default:"0"
Maximum slide distance.
Friction
float
default:"0"
Passive resistance applied to sliding motion.

BallJoint

BallJoint (ball-and-socket) allows free rotation in all directions — like a shoulder joint. Optional swing and twist limits constrain the range of motion.
var ball = go.Components.Create<BallJoint>();
ball.Body = armObject;
ball.SwingLimitEnabled = true;
ball.SwingLimit = new Vector2( 0, 60 );
SwingLimitEnabled
bool
default:"false"
Enables angular swing limits.
SwingLimit
Vector2
default:"(0, 90)"
Minimum and maximum swing angles in degrees.
TwistLimitEnabled
bool
default:"false"
Enables angular twist limits.
TwistLimit
Vector2
default:"(-15, 15)"
Minimum and maximum twist angles in degrees.
Motor
BallJoint.MotorMode
default:"Disabled"
Disabled uses only friction. TargetRotation drives toward a target orientation. TargetVelocity spins at a target angular velocity.
Friction
float
default:"0.5"
Passive friction when the motor is disabled.

Physics guide

Overview of the physics system, collision layers, and best practices.

Character controller

Kinematic character movement without a Rigidbody.

Scene & GameObjects

How objects and components are organized in a scene.

Networking overview

Syncing physics bodies across clients.

Build docs developers (and LLMs) love