Machinery TwinDocs

The simulation loop

What happens every frame, in what order, and why dependency order matters.

In Simulation and Online modes, the engine runs a fixed sequence every rendered frame:

  1. State machines tick. Each machine evaluates its active state's transitions (first match wins), switches state if needed, then executes the state's actions, writing values into their target variables.
  2. Variables are computed in dependency order. If variable B is a function of variable A, A is computed first. Chains of any depth resolve within a single tick.
  3. The scene renders. Every object reads the same consistent snapshot of variable values, no object ever sees a half-updated frame.

Consequences worth knowing

  • One tick, one snapshot. All kinematics in a frame use the same values, so mechanisms that share a master stay perfectly synchronized, the digital equivalent of a line shaft.
  • State machines act before functions. A state machine writing to a variable takes effect in the same frame; a function reading that variable downstream also sees it in the same frame.
  • Frame-rate independence. Time-based drivers (master clocks, timers, trapezoid position moves) advance with elapsed time, not frame count, so simulation speed doesn't depend on rendering performance.

Performance

The scene re-renders continuously while simulating. For heavy CAD scenes:

  • Import models at Draft or Normal quality (see the model simplifier).
  • Toggle the performance monitor in scene settings to watch FPS, draw calls, and memory.
  • Prefer the Lambert material mode over PBR for very large scenes.

On this page