Reference · Deterministic 2D physics
stepRigfunction
Advances the rig by one step of dt seconds.
Import it
import { stepRig } from "@johnmorrisdotca/karakuri/physics";
Definition
function stepRig(rig: Rig, dt: number): void
Parameters
| Name | Type | Description |
|---|---|---|
rig | Rig | The mutable native rope nodes, constraints and static geometry. |
dt | number | Elapsed simulated seconds; use STEP for the package’s fixed-step convention. |
Examples
import { STEP, addRope, createRig, rigNumbers, stepRig } from "@johnmorrisdotca/karakuri/physics";
const rig=createRig({gravity:0,iterations:1});
addRope(rig,0,0,10,0,2);
console.log((stepRig(rig,STEP),rigNumbers(rig)));[
0, 0, 0, 0, 5,
0, 5, 0, 10, 0,
10, 0
]What it prints (run when this page was built)