MCPcopy Create free account
hub / github.com/melonjs/melonJS / sim

Function sim

packages/melonjs/tests/vector2d.spec.ts:143–147  ·  view source on GitHub ↗
(steps: number, dt: number)

Source from the content-addressed store, hash-verified

141 const target = new Vector2d(100, 200);
142 const lambda = 5;
143 const sim = (steps: number, dt: number) => {
144 const v = new Vector2d(0, 0);
145 for (let i = 0; i < steps; i++) v.damp(target, lambda, dt);
146 return v;
147 };
148 const v60 = sim(60, 1 / 60);
149 const v30 = sim(30, 1 / 30);
150 expect(v60.x).toBeCloseTo(v30.x, 9);

Callers 1

vector2d.spec.tsFile · 0.70

Calls 1

dampMethod · 0.95

Tested by

no test coverage detected