SimulationLifecycle Module
High-level simulation lifecycle control: reset, run, and ID generation.
Functions and values
| Function or value |
Description
|
Full Usage:
nextId arg1
Parameters:
string
Returns: string
Human-readable ID like "sphere-1", "box-3".
|
Generates the next sequential ID for a body with the given shape prefix.
Example
val id1: obj
val id2: obj
val id3: obj
|
|
Fully resets the simulation to a clean state with a ground plane and standard gravity. Steps: pause → server-side reset (fallback to clearAll) → reset ID counters → add ground plane at Y=0 → set gravity (0, -9.81, 0) → sleep 100ms. Call at the start of every demo or experiment for a predictable starting state.
|
|
Runs the simulation for the specified duration, then pauses automatically.
Example
|
PhysicsSandbox