Reference · Deterministic 2D physics
RigLinktype
A link that keeps two nodes length apart (a rope pulls but does not push: slack links only pull).
Import it
import type { RigLink } from "@johnmorrisdotca/karakuri/physics";
Definition
interface RigLink {
a: number;
b: number;
length: number;
alive: boolean;
}
Members
| Name | Type | Description |
|---|---|---|
a | number | |
b | number | |
length | number | |
alive | boolean |
Examples
import { addRope, createRig } from "@johnmorrisdotca/karakuri/physics";
import type { RigLink } from "@johnmorrisdotca/karakuri/physics";
const rig=createRig({gravity:0,iterations:1});
addRope(rig,0,0,10,0,2);
const value: RigLink = rig.links[0];
console.log(value);{ a: 0, b: 1, length: 5, alive: true }What it prints (run when this page was built)