"Rigidbody component API"
- You need a pushable crate / physics prop and don't know which members the
Rigidbodycomponent actually exposes. ApplyForcedoes nothing — wrong force scale or missing collider setup.- A prop flies off or barely budges when the player walks into it.
The Rigidbody component's public surface isn't fully enumerated in the wiki. Some members (like MassOverride) are set-only, others (like PhysicsBody) are nullable, and force units are engine-inches-based — all easy to get wrong without a verified reference.
Verified Rigidbody members:
// Core properties
rb.Gravity // bool — enable/disable gravity
rb.MassOverride // float (kg) — SET-ONLY override
rb.Mass // float (kg) — READ
rb.Velocity // Vector3 — read/write
rb.MotionEnabled // bool
// Physics body (nullable)
rb.PhysicsBody // PhysicsBody? → .MassCenter, .AutoSleepForce API:
rb.ApplyForce(force); // whole-step force
rb.ApplyForceAt(position, force); // force at world point
rb.ApplyImpulseAt(position, impulse);Dynamic prop recipe:
A pushable physics prop = ModelRenderer + non-static BoxCollider + Rigidbody:
var go = new GameObject();
var renderer = go.Components.Create<ModelRenderer>();
renderer.Model = Model.Load("models/dev/box.vmdl");
var col = go.Components.Create<BoxCollider>();
col.Static = false; // MUST be non-static
var rb = go.Components.Create<Rigidbody>();
rb.Gravity = true;
rb.MassOverride = 10f; // kgPush-on-contact spring (drag toward hold point):
var offset = holdPoint - body.MassCenter;
var force = offset * springK * body.Mass;
// Cap magnitude so heavy props resist a single puller
force = force.ClampLength(maxForce);
body.ApplyForce(force);Force units are engine-based (kg·units/s²). To convert from SI Newtons, multiply by the meters-to-units constant (39.37). Light props (MassOverride small) fly; heavy ones barely move — that's F = ma working correctly.
The Rigidbody wraps a PhysicsBody managed by the engine's physics simulation. Setting Static = false on the collider is what makes the body dynamic (the default is static/kinematic). MassOverride as a set-only property means you can't read back what you set — use .Mass for reads. Force applied per-step accumulates naturally with the fixed-tick simulation.