Rig型
リファレンスの説明と例は英語です。見出しと目次は日本語です。
A set of nodes and links, with the fixed shapes the round nodes rest on.
インポート
import type { Rig } from "@johnmorrisdotca/karakuri/physics";
定義
interface Rig {
nodes: RigNode[];
links: RigLink[];
statics: WorldShape[];
gravity: number;
damping: number;
iterations: number;
grip: number;
bounce: number;
}
メンバー
| 名前 | 型 | 説明 |
|---|---|---|
nodes | RigNode[] | |
links | RigLink[] | |
statics | WorldShape[] | |
gravity | number | |
damping | number | How much of its speed a node keeps each step (1 keeps all). |
iterations | number | |
grip | number | How much of a round node's speed along a surface it keeps when it touches one. |
bounce | number |
例
import { addRope, createRig } from "@johnmorrisdotca/karakuri/physics";
import type { Rig } from "@johnmorrisdotca/karakuri/physics";
const rig=createRig({gravity:0,iterations:1});
addRope(rig,0,0,10,0,2);
const value: Rig = rig;
console.log(value);{
nodes: [
{ x: 0, y: 0, px: 0, py: 0, invMass: 0, r: 0 },
{ x: 5, y: 0, px: 5, py: 0, invMass: 1, r: 0 },
{ x: 10, y: 0, px: 10, py: 0, invMass: 1, r: 0 }
],
links: [
{ a: 0, b: 1, length: 5, alive: true },
{ a: 1, b: 2, length: 5, alive: true }
],
statics: [],
gravity: 0,
damping: 0.999,
iterations: 1,
grip: 0.9,
bounce: 0.25
}出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。