Reference · Deterministic 2D physics
nodeSpeedfunction
The speed of a node in units a second at a step of dt.
Import it
import { nodeSpeed } from "@johnmorrisdotca/karakuri/physics";
Definition
function nodeSpeed(n: RigNode, dt: number): number
Parameters
| Name | Type | Description |
|---|---|---|
n | RigNode | The native rope node whose displacement is measured. |
dt | number | Elapsed simulated seconds; use STEP for the package’s fixed-step convention. |
Returns
number
The speed of a node in units a second at a step of dt.
Examples
import { STEP, addRope, createRig, nodeSpeed } from "@johnmorrisdotca/karakuri/physics";
const rig=createRig({gravity:0,iterations:1});
addRope(rig,0,0,10,0,2);
console.log(nodeSpeed(rig.nodes[0],STEP));0What it prints (run when this page was built)