menu_bookDocumentation

s&box Rigidbody Component: Physics Body Reference

calendar_today May 4, 2026 schedule ~1 min read person patrickjr verified 50

s&box Rigidbody Component: Physics Body Reference

Rigidbody adds physics simulation to a GameObject. It requires at least one Collider component on the same object.

Key Properties

CSHARP
// Physics behavior
[Property] bool Gravity = true;
[Property] float GravityScale = 1.0f;
[Property] float LinearDamping;
[Property] float AngularDamping;
[Property] float MassOverride;       // 0 = auto-calculate from shapes
[Property] bool MotionEnabled = true; // false = kinematic
[Property] bool StartAsleep;
[Property] PhysicsLock Locking;      // Lock axes
[Property] bool EnhancedCcd;         // Continuous collision detection (fast objects)

// Impact damage
[Property] bool EnableImpactDamage = true;
[Property] float MinImpactDamageSpeed = 500f;
[Property] float ImpactDamage = 0f;  // 0 = auto from mass

// State
bool Sleeping { get; set; }
Vector3 Velocity { get; set; }
Vector3 AngularVelocity { get; set; }
Vector3 MassCenter { get; }          // Local space
PhysicsBody PhysicsBody { get; }

Force and Impulse Methods

CSHARP
rb.ApplyForce(Vector3.Up * 1000f);                    // Continuous force
rb.ApplyForceAt(position, force);                      // Force at point
rb.ApplyTorque(Vector3.Up * 100f);                     // Angular force
rb.ApplyImpulse(Vector3.Up * 500f);                    // Instant impulse
rb.ApplyImpulseAt(position, force);                    // Impulse at point
rb.ClearForces();                                      // Clear accumulated forces
rb.SmoothMove(targetTransform, timeToArrive, delta);   // Physics-cooperative move
rb.SmoothRotate(targetRotation, timeToArrive, delta);  // Physics-cooperative rotate

Networking

Collision Events

CSHARP
// Enable collision update events (OnCollisionUpdate)
rb.CollisionUpdateEventsEnabled = true;

// Check what triggers we're touching
foreach (var trigger in rb.Touching) { ... }

Collider Properties

CSHARP
// On any Collider component:
collider.IsTrigger = true;
collider.Static = true;           // Static geometry
collider.Friction = 0.5f;         // null = use surface default
collider.Elasticity = 0.3f;       // null = use surface default
collider.SurfaceVelocity = Vector3.Forward * 100f; // Conveyor belt effect
collider.Surface = mySurface;     // Override surface properties

// Trigger callbacks
collider.OnTriggerEnter = (other) => { ... };
collider.OnTriggerExit = (other) => { ... };
collider.OnObjectTriggerEnter = (go) => { ... };
collider.OnObjectTriggerExit = (go) => { ... };
Was this helpful?