Compare commits
32 Commits
liquid-fun
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 11e53383c7 | |||
| 4c82aabc5d | |||
|
|
93dd64df0f | ||
|
|
6ede4f3d2d | ||
|
|
86c9079d69 | ||
|
|
7791ea1f1b | ||
|
|
9415379691 | ||
|
|
4fc10a7fee | ||
|
|
c96feaccea | ||
|
|
0bba3b2911 | ||
|
|
f6d90c2703 | ||
|
|
83e5f622be | ||
|
|
18a00bdcf6 | ||
|
|
cdbf302d41 | ||
|
|
3b561c1880 | ||
|
|
724e410c8f | ||
|
|
cbec05b7e8 | ||
|
|
9343ffc8ec | ||
|
|
be9b789942 | ||
|
|
3aee543586 | ||
|
|
23e89ec1f7 | ||
|
|
d12d0cc9df | ||
|
|
54cfa2d206 | ||
|
|
37414c7dad | ||
|
|
97e4fcd011 | ||
|
|
75ece37751 | ||
|
|
0dcc98b053 | ||
|
|
e1a271755d | ||
|
|
3446820c88 | ||
|
|
1999deb142 | ||
|
|
02600898af | ||
|
|
ffc8cb316d |
50
.github/workflows/deploy-docs.yml
vendored
Normal file
50
.github/workflows/deploy-docs.yml
vendored
Normal file
@ -0,0 +1,50 @@
|
||||
name: Deploy docs to github pages
|
||||
|
||||
on:
|
||||
# Runs on pushes targeting the default branch
|
||||
push:
|
||||
branches: ["master", "main"]
|
||||
|
||||
# Allows you to run this workflow manually from the Actions tab
|
||||
workflow_dispatch:
|
||||
|
||||
# Sets the GITHUB_TOKEN permissions to allow deployment to GitHub Pages
|
||||
permissions:
|
||||
contents: read
|
||||
pages: write
|
||||
id-token: write
|
||||
|
||||
# Allow one concurrent deployment
|
||||
concurrency:
|
||||
group: "pages"
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
# Single deploy job since we're just deploying
|
||||
deploy:
|
||||
environment:
|
||||
name: github-pages
|
||||
url: ${{ steps.deployment.outputs.page_url }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v5
|
||||
- name: Set up Node
|
||||
uses: actions/setup-node@v6
|
||||
with:
|
||||
node-version: lts/*
|
||||
cache: "npm"
|
||||
- name: Install dependencies
|
||||
run: npm install
|
||||
- name: Build
|
||||
run: npm run typedoc && npm run docs:build
|
||||
- name: Setup Pages
|
||||
uses: actions/configure-pages@v5
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-pages-artifact@v4
|
||||
with:
|
||||
# Upload dist folder
|
||||
path: "./dist"
|
||||
- name: Deploy to GitHub Pages
|
||||
id: deployment
|
||||
uses: actions/deploy-pages@v4
|
||||
11
.gitignore
vendored
11
.gitignore
vendored
@ -1,3 +1,14 @@
|
||||
|
||||
dist/docs/
|
||||
|
||||
# typedoc
|
||||
docs/pages/api/
|
||||
|
||||
# vitepress
|
||||
docs/.vitepress/cache/
|
||||
docs/.vitepress/dist/
|
||||
docs/.vitepress/.temp/
|
||||
|
||||
# misc
|
||||
.DS_Store
|
||||
*.pem
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
{
|
||||
"printWidth": 100,
|
||||
"printWidth": 120,
|
||||
"quoteProps": "preserve"
|
||||
}
|
||||
|
||||
42
CHANGELOG.md
42
CHANGELOG.md
@ -1,5 +1,47 @@
|
||||
# planck
|
||||
|
||||
## 1.5.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- 6ede4f3: Publish add-body, add-fixture, add-joint events
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 9415379: Add fixedRotation to body serialize
|
||||
- 7791ea1: Remove temp fields from distance-joint serialization
|
||||
- 86c9079: Remove hasVertex0 and hasVertex3 from serialize Edge
|
||||
- 4fc10a7: In polygon and chain \_deserialize use Vec2Value
|
||||
|
||||
## 1.4.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 0bba3b2: Bug fix addVec2
|
||||
|
||||
## 1.4.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 9343ffc: Fix testbed drawing
|
||||
|
||||
## 1.4.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- d12d0cc: Fix shape name alias export
|
||||
|
||||
## 1.4.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- 0dcc98b: Split TestbedInterface and Testbed class
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- e1a2717: Mark serialize and deserialize functions as @hidden instead of @internal
|
||||
- 3446820: Fix AABB.rayCast
|
||||
|
||||
## 1.3.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
44
README.md
44
README.md
@ -1,3 +1,47 @@
|
||||
# planck-deterministic
|
||||
|
||||
A fork of [planck.js](https://github.com/piqnt/planck.js) (MIT, Erin Catto / Ali Shakiba)
|
||||
with a **cross-platform deterministic math kernel**.
|
||||
|
||||
## Why
|
||||
|
||||
Upstream planck calls the host `Math.sin`, `Math.cos`, `Math.atan2` and `Math.random`.
|
||||
IEEE-754 guarantees `+ - * /` and `sqrt` are correctly rounded, so those are identical
|
||||
everywhere — but ECMAScript explicitly permits an *implementation-dependent approximation*
|
||||
for the transcendental functions, and every engine forwards them to the host libm. Those
|
||||
results differ between ARM64/JavaScriptCore (iOS) and x86-64/V8 (desktop).
|
||||
|
||||
`Rot.setAngle` and `Sweep.getTransform` call sin/cos for **every rotating body on every
|
||||
step**. So a simulation shared between a mobile build and a desktop build diverges as soon
|
||||
as anything rotates. That breaks replay portability, server-side replay verification, and
|
||||
any leaderboard built on re-simulating a replay.
|
||||
|
||||
## What changed
|
||||
|
||||
- Added `src/common/DeterministicMath.ts` — `sin`, `cos`, `exp`, `atan`, `atan2`, `sqrt` and
|
||||
a seeded PRNG, built from `+ - * /` and comparisons only. Coefficients and the Cody-Waite
|
||||
range reduction follow fdlibm (Sun, freely distributable), the reference implementation
|
||||
most libms derive from. Accuracy is within a few ulp of the host libm.
|
||||
- Rewired the nine hoisted aliases in `Math.ts`, `Matrix.ts`, `Rot.ts`, `Sweep.ts` and
|
||||
`dynamics/Position.ts` to use it. **No host libm call remains anywhere in `src/`.**
|
||||
- Exported the kernel (`DeterministicMath`, `seedRandom`) so consumers can share the exact
|
||||
same functions the solver uses and seed the PRNG for reproducible replays.
|
||||
|
||||
Every upstream test still passes, plus new determinism tests including a check that a
|
||||
simulated free fall matches the closed-form analytic solution.
|
||||
|
||||
```js
|
||||
import { World, seedRandom, DeterministicMath } from "planck-deterministic";
|
||||
|
||||
seedRandom(12345); // before a run, and before replaying it
|
||||
```
|
||||
|
||||
## Upstream
|
||||
|
||||
This tracks planck.js v1.5.0. Upstream docs and API below.
|
||||
|
||||
---
|
||||
|
||||
# Planck.js
|
||||
|
||||
Planck.js is JavaScript/TypeScript rewrite of Box2D physics engine for cross-platform HTML5 game development.
|
||||
|
||||
@ -3,6 +3,8 @@ export interface TestInterface {
|
||||
createBoxShape: (hx: number, hy: number) => any;
|
||||
createBoxBody: (shape: any, x: number, y: number, density: number) => any;
|
||||
step: (timeStep: number, velocityIterations: number, positionIterations: number) => void;
|
||||
setup: () => void;
|
||||
teardown: () => void;
|
||||
}
|
||||
|
||||
export interface XY {
|
||||
|
||||
@ -59,6 +59,7 @@ const testRows = prepareTests(tests).map((test: TestInterface) => {
|
||||
row,
|
||||
test,
|
||||
begin() {
|
||||
test.setup();
|
||||
ratio.appendChild(progress);
|
||||
progress.value = 0;
|
||||
},
|
||||
@ -67,6 +68,7 @@ const testRows = prepareTests(tests).map((test: TestInterface) => {
|
||||
progress.max = max;
|
||||
},
|
||||
end(result: TestResult) {
|
||||
test.teardown();
|
||||
avg.textContent = result.avg.toFixed(2);
|
||||
p5.textContent = result.p5.toString();
|
||||
p95.textContent = result.p95.toString();
|
||||
|
||||
@ -1,33 +1,42 @@
|
||||
import "./fixprocess";
|
||||
|
||||
const { b2World, b2Vec2, b2EdgeShape, b2PolygonShape, b2_dynamicBody, b2BodyDef } = Box2D;
|
||||
const { b2Body, b2World, b2Vec2, b2EdgeShape, b2PolygonShape, b2_dynamicBody, b2BodyDef } = Box2D;
|
||||
|
||||
import type { TestFactory } from "../benchmark";
|
||||
|
||||
export const box2dJsFactory: TestFactory = (gravity, edgeV1, edgeV2, edgeDensity) => {
|
||||
const world = new b2World(new b2Vec2(gravity.x, gravity.y));
|
||||
const ground = world.CreateBody(new b2BodyDef());
|
||||
let world: typeof b2World;
|
||||
let ground: typeof b2Body;
|
||||
let edgeShape: typeof b2EdgeShape;
|
||||
|
||||
const edgeShape = new b2EdgeShape();
|
||||
edgeShape.Set(new b2Vec2(edgeV1.x, edgeV1.y), new b2Vec2(edgeV2.x, edgeV2.y));
|
||||
ground.CreateFixture(edgeShape as any, edgeDensity);
|
||||
|
||||
return {
|
||||
name: "box2d.js",
|
||||
createBoxShape(hx: number, hy: number) {
|
||||
const box = new b2PolygonShape();
|
||||
box.SetAsBox(hx, hy);
|
||||
return box;
|
||||
},
|
||||
createBoxBody(shape: any, x: number, y: number, density: number) {
|
||||
const bd = new b2BodyDef();
|
||||
bd.set_type(b2_dynamicBody);
|
||||
bd.set_position(new b2Vec2(x, y));
|
||||
const body = world.CreateBody(bd);
|
||||
body.CreateFixture(shape, density);
|
||||
},
|
||||
step(timeStep: number, velocityIterations: number, positionIterations: number) {
|
||||
world.Step(timeStep, velocityIterations, positionIterations);
|
||||
},
|
||||
};
|
||||
return {
|
||||
name: "box2d.js",
|
||||
setup() {
|
||||
world = new b2World(new b2Vec2(gravity.x, gravity.y));
|
||||
ground = world.CreateBody(new b2BodyDef());
|
||||
edgeShape = new b2EdgeShape();
|
||||
edgeShape.Set(new b2Vec2(edgeV1.x, edgeV1.y), new b2Vec2(edgeV2.x, edgeV2.y));
|
||||
ground.CreateFixture(edgeShape as any, edgeDensity);
|
||||
},
|
||||
teardown() {
|
||||
world = null;
|
||||
ground = null;
|
||||
edgeShape = null;
|
||||
},
|
||||
createBoxShape(hx: number, hy: number) {
|
||||
const box = new b2PolygonShape();
|
||||
box.SetAsBox(hx, hy);
|
||||
return box;
|
||||
},
|
||||
createBoxBody(shape: any, x: number, y: number, density: number) {
|
||||
const bd = new b2BodyDef();
|
||||
bd.set_type(b2_dynamicBody);
|
||||
bd.set_position(new b2Vec2(x, y));
|
||||
const body = world.CreateBody(bd);
|
||||
body.CreateFixture(shape, density);
|
||||
},
|
||||
step(timeStep: number, velocityIterations: number, positionIterations: number) {
|
||||
world.Step(timeStep, velocityIterations, positionIterations);
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
@ -1,30 +1,39 @@
|
||||
import { World, Vec2, Edge, Box } from "../../src/index";
|
||||
import { World, Vec2, EdgeShape, BoxShape, Body } from "../../src/index";
|
||||
|
||||
import { TestFactory } from "../benchmark";
|
||||
|
||||
export const planckFactory: TestFactory = (gravity, edgeV1, edgeV2, edgeDensity) => {
|
||||
const world = new World({
|
||||
let world: World | null = null;
|
||||
let ground: Body | null = null;
|
||||
let edgeShape: EdgeShape | null = null;
|
||||
return {
|
||||
name: "planck.js (current)",
|
||||
setup() {
|
||||
world = new World({
|
||||
gravity: new Vec2(gravity.x, gravity.y),
|
||||
});
|
||||
const ground = world.createBody({});
|
||||
});
|
||||
ground = world.createBody({});
|
||||
|
||||
const edgeShape = new Edge(new Vec2(edgeV1.x, edgeV1.y), new Vec2(edgeV2.x, edgeV2.y));
|
||||
ground.createFixture(edgeShape as any, edgeDensity);
|
||||
|
||||
return {
|
||||
name: "planck.js (current)",
|
||||
createBoxShape(hx: number, hy: number) {
|
||||
return new Box(hx, hy);
|
||||
},
|
||||
createBoxBody(shape: any, x: number, y: number, density: number) {
|
||||
const body = world.createBody({
|
||||
type: "dynamic",
|
||||
position: new Vec2(x, y),
|
||||
});
|
||||
body.createFixture(shape, density);
|
||||
},
|
||||
step(timeStep: number, velocityIterations: number, positionIterations: number) {
|
||||
world.step(timeStep, velocityIterations, positionIterations);
|
||||
},
|
||||
};
|
||||
edgeShape = new EdgeShape(new Vec2(edgeV1.x, edgeV1.y), new Vec2(edgeV2.x, edgeV2.y));
|
||||
ground.createFixture(edgeShape as any, edgeDensity);
|
||||
},
|
||||
createBoxShape(hx: number, hy: number) {
|
||||
return new BoxShape(hx, hy);
|
||||
},
|
||||
createBoxBody(shape: any, x: number, y: number, density: number) {
|
||||
const body = world?.createBody({
|
||||
type: "dynamic",
|
||||
position: new Vec2(x, y),
|
||||
});
|
||||
body?.createFixture(shape, density);
|
||||
},
|
||||
step(timeStep: number, velocityIterations: number, positionIterations: number) {
|
||||
world?.step(timeStep, velocityIterations, positionIterations);
|
||||
},
|
||||
teardown() {
|
||||
world = null;
|
||||
ground = null;
|
||||
edgeShape = null;
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
207
dist/planck-with-testbed.d.ts
vendored
207
dist/planck-with-testbed.d.ts
vendored
@ -18,6 +18,10 @@ export declare class Vec2 {
|
||||
constructor(x: number, y: number);
|
||||
constructor(obj: Vec2Value);
|
||||
constructor();
|
||||
/** @hidden */
|
||||
_serialize(): object;
|
||||
/** @hidden */
|
||||
static _deserialize(data: any): Vec2;
|
||||
static zero(): Vec2;
|
||||
/** @hidden */
|
||||
static neo(x: number, y: number): Vec2;
|
||||
@ -585,24 +589,25 @@ export interface Style {
|
||||
fill?: string;
|
||||
lineWidth?: number;
|
||||
}
|
||||
export type KEY = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "A" | "B" | "C" | "D" | "E" | "F" | "G" | "H" | "I" | "J" | "K" | "L" | "M" | "N" | "O" | "P" | "Q" | "R" | "S" | "T" | "U" | "V" | "W" | "X" | "Y" | "Z" | "right" | "left" | "up" | "down" | "fire";
|
||||
export type ActiveKeys = {
|
||||
[key in KEY]?: boolean;
|
||||
};
|
||||
export type TestbedMountOptions = {
|
||||
[key: string]: any;
|
||||
};
|
||||
export declare abstract class Testbed {
|
||||
export declare class Testbed {
|
||||
/**
|
||||
* Mounts testbed. Call start with a world to start simulation and rendering.
|
||||
*/
|
||||
static mount(options?: TestbedMountOptions): Testbed;
|
||||
static mount(options?: TestbedMountOptions): TestbedInterface;
|
||||
/**
|
||||
* Mounts testbed if needed, then starts simulation and rendering.
|
||||
*
|
||||
* If you need to customize testbed before starting, first run `const testbed = Testbed.mount()` and then `testbed.start()`.
|
||||
*/
|
||||
static start(world: World): Testbed;
|
||||
static start(world: World): TestbedInterface;
|
||||
}
|
||||
export interface TestbedInterface {
|
||||
/** World viewbox width. */
|
||||
width: number;
|
||||
/** World viewbox height. */
|
||||
@ -621,53 +626,34 @@ export declare abstract class Testbed {
|
||||
mouseForce?: number;
|
||||
activeKeys: ActiveKeys;
|
||||
/** callback, to be implemented by user */
|
||||
step: (dt: number, t: number) => void;
|
||||
step?: (dt: number, t: number) => void;
|
||||
/** callback, to be implemented by user */
|
||||
keydown: (keyCode: number, label: string) => void;
|
||||
keydown?: (keyCode: number, label: string) => void;
|
||||
/** callback, to be implemented by user */
|
||||
keyup: (keyCode: number, label: string) => void;
|
||||
abstract status(name: string, value: any): void;
|
||||
abstract status(value: object | string): void;
|
||||
abstract info(text: string): void;
|
||||
keyup?: (keyCode: number, label: string) => void;
|
||||
status(name: string, value: any): void;
|
||||
status(value: object | string): void;
|
||||
info(text: string): void;
|
||||
color(r: number, g: number, b: number): string;
|
||||
abstract drawPoint(p: {
|
||||
x: number;
|
||||
y: number;
|
||||
}, r: any, color: string): void;
|
||||
abstract drawCircle(p: {
|
||||
x: number;
|
||||
y: number;
|
||||
}, r: number, color: string): void;
|
||||
abstract drawEdge(a: {
|
||||
x: number;
|
||||
y: number;
|
||||
}, b: {
|
||||
x: number;
|
||||
y: number;
|
||||
}, color: string): void;
|
||||
abstract drawSegment(a: {
|
||||
x: number;
|
||||
y: number;
|
||||
}, b: {
|
||||
x: number;
|
||||
y: number;
|
||||
}, color: string): void;
|
||||
abstract drawPolygon(points: Array<{
|
||||
x: number;
|
||||
y: number;
|
||||
}>, color: string): void;
|
||||
abstract drawAABB(aabb: AABBValue, color: string): void;
|
||||
abstract start(world: World): void;
|
||||
abstract findOne(query: string): (Body$1 | Joint | Fixture | null);
|
||||
abstract findAll(query: string): (Body$1 | Joint | Fixture)[];
|
||||
drawPoint(p: Vec2Value, r: any, color: string): void;
|
||||
drawCircle(p: Vec2Value, r: number, color: string): void;
|
||||
drawEdge(a: Vec2Value, b: Vec2Value, color: string): void;
|
||||
drawSegment(a: Vec2Value, b: Vec2Value, color: string): void;
|
||||
drawPolygon(points: Array<Vec2Value>, color: string): void;
|
||||
drawChain(points: Array<Vec2Value>, color: string): void;
|
||||
drawAABB(aabb: AABBValue, color: string): void;
|
||||
start(world: World): void;
|
||||
findOne(query: string): Body$1 | Joint | Fixture | null;
|
||||
findAll(query: string): (Body$1 | Joint | Fixture)[];
|
||||
}
|
||||
export type TestbedFactoryOptions = string | TestbedMountOptions;
|
||||
/** @deprecated */
|
||||
export type TestbedCallback = (testbed: Testbed) => (World | undefined);
|
||||
export type TestbedCallback = (testbed: TestbedInterface) => World | undefined;
|
||||
/** @deprecated */
|
||||
export declare function testbed(callback: TestbedCallback): void;
|
||||
/** @deprecated */
|
||||
export declare function testbed(options: TestbedFactoryOptions, callback: TestbedCallback): void;
|
||||
export type KEY = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "A" | "B" | "C" | "D" | "E" | "F" | "G" | "H" | "I" | "J" | "K" | "L" | "M" | "N" | "O" | "P" | "Q" | "R" | "S" | "T" | "U" | "V" | "W" | "X" | "Y" | "Z" | "right" | "left" | "up" | "down" | "fire";
|
||||
/**
|
||||
* A shape is used for collision detection. You can create a shape however you
|
||||
* like. Shapes used for simulation in World are created automatically when a
|
||||
@ -1025,6 +1011,10 @@ export declare class Fixture {
|
||||
constructor(body: Body$1, shape: Shape, density?: number);
|
||||
/** @hidden Re-setup fixture. */
|
||||
_reset(): void;
|
||||
/** @hidden */
|
||||
_serialize(): object;
|
||||
/** @hidden */
|
||||
static _deserialize(data: any, body: any, restore: any): Fixture;
|
||||
/**
|
||||
* Get the type of the child shape. You can use this to down cast to the
|
||||
* concrete shape.
|
||||
@ -1568,6 +1558,10 @@ declare class Body$1 {
|
||||
style: Style;
|
||||
/** @hidden @experimental Similar to userData, but used by dev-tools or runtime environment. */
|
||||
appData: Record<string, any>;
|
||||
/** @hidden */
|
||||
_serialize(): object;
|
||||
/** @hidden */
|
||||
static _deserialize(data: any, world: any, restore: any): Body$1;
|
||||
isWorldLocked(): boolean;
|
||||
getWorld(): World;
|
||||
getNext(): Body$1 | null;
|
||||
@ -1962,6 +1956,10 @@ export declare class World {
|
||||
* @param def World definition or gravity vector.
|
||||
*/
|
||||
constructor(def?: WorldDef | Vec2Value);
|
||||
/** @hidden */
|
||||
_serialize(): object;
|
||||
/** @hidden */
|
||||
static _deserialize(data: any, context: any, restore: any): World;
|
||||
/**
|
||||
* Get the world body list. With the returned body, use Body.getNext to get the
|
||||
* next body in the world list. A null body indicates the end of the list.
|
||||
@ -2112,6 +2110,8 @@ export declare class World {
|
||||
* Create a joint to constrain bodies together. No reference to the definition
|
||||
* is retained. This may cause the connected bodies to cease colliding.
|
||||
*
|
||||
* Note: creating a joint doesn't wake the bodies.
|
||||
*
|
||||
* Warning: This function is locked when a world simulation step is in progress. Use queueUpdate to schedule a function to be called after the step.
|
||||
*/
|
||||
createJoint<T extends Joint>(joint: T): T | null;
|
||||
@ -2187,12 +2187,18 @@ export declare class World {
|
||||
* Warning: You cannot create/destroy world entities inside these callbacks.
|
||||
*/
|
||||
on(name: "post-solve", listener: (contact: Contact, impulse: ContactImpulse) => void): World;
|
||||
/** Listener is called whenever a body is removed. */
|
||||
/** Listener is called when a body is removed. */
|
||||
on(name: "remove-body", listener: (body: Body$1) => void): World;
|
||||
/** Listener is called whenever a joint is removed implicitly or explicitly. */
|
||||
/** Listener is called when a joint is removed implicitly or explicitly. */
|
||||
on(name: "remove-joint", listener: (joint: Joint) => void): World;
|
||||
/** Listener is called whenever a fixture is removed implicitly or explicitly. */
|
||||
/** Listener is called when a fixture is removed implicitly or explicitly. */
|
||||
on(name: "remove-fixture", listener: (fixture: Fixture) => void): World;
|
||||
/** Listener is called when a body is added. */
|
||||
on(name: "add-body", listener: (body: Body$1) => void): World;
|
||||
/** Listener is called when a joint is added. */
|
||||
on(name: "add-joint", listener: (joint: Joint) => void): World;
|
||||
/** Listener is called when a fixture is added. */
|
||||
on(name: "add-fixture", listener: (fixture: Fixture) => void): World;
|
||||
off(name: "begin-contact", listener: (contact: Contact) => void): World;
|
||||
off(name: "end-contact", listener: (contact: Contact) => void): World;
|
||||
off(name: "pre-solve", listener: (contact: Contact, oldManifold: Manifold) => void): World;
|
||||
@ -2200,6 +2206,9 @@ export declare class World {
|
||||
off(name: "remove-body", listener: (body: Body$1) => void): World;
|
||||
off(name: "remove-joint", listener: (joint: Joint) => void): World;
|
||||
off(name: "remove-fixture", listener: (fixture: Fixture) => void): World;
|
||||
off(name: "add-body", listener: (body: Body$1) => void): World;
|
||||
off(name: "add-joint", listener: (joint: Joint) => void): World;
|
||||
off(name: "add-fixture", listener: (fixture: Fixture) => void): World;
|
||||
publish(name: string, arg1?: any, arg2?: any, arg3?: any): number;
|
||||
}
|
||||
export type DataType = any;
|
||||
@ -2223,6 +2232,22 @@ export declare class Serializer<T> {
|
||||
}
|
||||
/** @ignore */
|
||||
declare const math: any;
|
||||
declare function sin(x: number): number;
|
||||
declare function cos(x: number): number;
|
||||
declare function exp(x: number): number;
|
||||
declare function atan(x: number): number;
|
||||
declare function atan2(y: number, x: number): number;
|
||||
declare function log(x: number): number;
|
||||
declare function sqrt(x: number): number;
|
||||
/**
|
||||
* Seed the deterministic PRNG.
|
||||
*
|
||||
* Call before a run and before replaying it. Upstream planck uses
|
||||
* `Math.random`, which cannot be reproduced and so cannot appear anywhere in a
|
||||
* simulation whose replay must be verifiable.
|
||||
*/
|
||||
export declare function seedRandom(seed: number): void;
|
||||
declare function random(): number;
|
||||
/** 3D vector */
|
||||
export interface Vec3Value {
|
||||
x: number;
|
||||
@ -2244,6 +2269,10 @@ export declare class Vec3 {
|
||||
constructor(obj: Vec3Value);
|
||||
constructor();
|
||||
/** @hidden */
|
||||
_serialize(): object;
|
||||
/** @hidden */
|
||||
static _deserialize(data: any): Vec3;
|
||||
/** @hidden */
|
||||
static neo(x: number, y: number, z: number): Vec3;
|
||||
static zero(): Vec3;
|
||||
static clone(v: Vec3Value): Vec3;
|
||||
@ -2378,6 +2407,10 @@ export declare class CircleShape extends Shape {
|
||||
constructor(position: Vec2Value, radius?: number);
|
||||
constructor(radius?: number);
|
||||
/** @hidden */
|
||||
_serialize(): object;
|
||||
/** @hidden */
|
||||
static _deserialize(data: any): CircleShape;
|
||||
/** @hidden */
|
||||
_reset(): void;
|
||||
getType(): "circle";
|
||||
getRadius(): number;
|
||||
@ -2422,7 +2455,6 @@ export declare class CircleShape extends Shape {
|
||||
computeMass(massData: MassData, density: number): void;
|
||||
computeDistanceProxy(proxy: DistanceProxy): void;
|
||||
}
|
||||
export declare const Circle: typeof CircleShape;
|
||||
/** @hidden @deprecated Use new keyword. */
|
||||
export function EdgeShape(v1?: Vec2Value, v2?: Vec2Value): EdgeShape;
|
||||
/**
|
||||
@ -2442,6 +2474,10 @@ export declare class EdgeShape extends Shape {
|
||||
/** @hidden */ m_hasVertex3: boolean;
|
||||
constructor(v1?: Vec2Value, v2?: Vec2Value);
|
||||
/** @hidden */
|
||||
_serialize(): object;
|
||||
/** @hidden */
|
||||
static _deserialize(data: any): EdgeShape;
|
||||
/** @hidden */
|
||||
_reset(): void;
|
||||
getRadius(): number;
|
||||
getType(): "edge";
|
||||
@ -2505,7 +2541,6 @@ export declare class EdgeShape extends Shape {
|
||||
computeMass(massData: MassData, density?: number): void;
|
||||
computeDistanceProxy(proxy: DistanceProxy): void;
|
||||
}
|
||||
export declare const Edge: typeof EdgeShape;
|
||||
/** @hidden @deprecated Use new keyword. */
|
||||
export function PolygonShape(vertices?: Vec2Value[]): PolygonShape;
|
||||
/**
|
||||
@ -2523,6 +2558,10 @@ export declare class PolygonShape extends Shape {
|
||||
/** @hidden */ m_count: number;
|
||||
/** @hidden */ m_radius: number;
|
||||
constructor(vertices?: Vec2Value[]);
|
||||
/** @hidden */
|
||||
_serialize(): object;
|
||||
/** @hidden */
|
||||
static _deserialize(data: any, fixture: any, restore: any): PolygonShape;
|
||||
getType(): "polygon";
|
||||
getRadius(): number;
|
||||
/**
|
||||
@ -2572,7 +2611,6 @@ export declare class PolygonShape extends Shape {
|
||||
validate(): boolean;
|
||||
computeDistanceProxy(proxy: DistanceProxy): void;
|
||||
}
|
||||
export declare const Polygon: typeof PolygonShape;
|
||||
/** @hidden @deprecated Use new keyword. */
|
||||
export function ChainShape(vertices?: Vec2Value[], loop?: boolean): ChainShape;
|
||||
/**
|
||||
@ -2595,6 +2633,10 @@ export declare class ChainShape extends Shape {
|
||||
/** @hidden */ m_hasNextVertex: boolean;
|
||||
/** @hidden */ m_isLoop: boolean;
|
||||
constructor(vertices?: Vec2Value[], loop?: boolean);
|
||||
/** @hidden */
|
||||
_serialize(): object;
|
||||
/** @hidden */
|
||||
static _deserialize(data: any, fixture: any, restore: any): ChainShape;
|
||||
getType(): "chain";
|
||||
getRadius(): number;
|
||||
/** @hidden */
|
||||
@ -2658,7 +2700,6 @@ export declare class ChainShape extends Shape {
|
||||
computeMass(massData: MassData, density?: number): void;
|
||||
computeDistanceProxy(proxy: DistanceProxy, childIndex: number): void;
|
||||
}
|
||||
export declare const Chain: typeof ChainShape;
|
||||
/** @hidden @deprecated Use new keyword. */
|
||||
export function BoxShape(halfWidth: number, halfHeight: number, center?: Vec2Value, angle?: number): BoxShape;
|
||||
/**
|
||||
@ -2675,15 +2716,14 @@ export declare class BoxShape extends PolygonShape {
|
||||
*/
|
||||
constructor(halfWidth: number, halfHeight: number, center?: Vec2Value, angle?: number);
|
||||
}
|
||||
export declare const Box: typeof BoxShape;
|
||||
export declare const CollideCircles: (manifold: Manifold, circleA: CircleShape, xfA: TransformValue, circleB: CircleShape, xfB: TransformValue) => void;
|
||||
export declare const CollideEdgeCircle: (manifold: Manifold, edgeA: EdgeShape, xfA: TransformValue, circleB: CircleShape, xfB: TransformValue) => void;
|
||||
/**
|
||||
*
|
||||
* Find edge normal of max separation on A - return if separating axis is found<br>
|
||||
* Find edge normal of max separation on B - return if separation axis is found<br>
|
||||
* Choose reference edge as min(minA, minB)<br>
|
||||
* Find incident edge<br>
|
||||
* Find edge normal of max separation on A - return if separating axis is found
|
||||
* Find edge normal of max separation on B - return if separation axis is found
|
||||
* Choose reference edge as min(minA, minB)
|
||||
* Find incident edge
|
||||
* Clip
|
||||
*
|
||||
* The normal points from 1 to 2
|
||||
@ -2753,6 +2793,10 @@ export declare class DistanceJoint extends Joint {
|
||||
*/
|
||||
constructor(def: DistanceJointOpt, bodyA: Body$1, bodyB: Body$1, anchorA?: Vec2Value, anchorB?: Vec2Value);
|
||||
/** @hidden */
|
||||
_serialize(): object;
|
||||
/** @hidden */
|
||||
static _deserialize(data: any, world: any, restore: any): DistanceJoint;
|
||||
/** @hidden */
|
||||
_reset(def: Partial<DistanceJointDef>): void;
|
||||
/**
|
||||
* The local anchor point relative to bodyA's origin.
|
||||
@ -2840,6 +2884,10 @@ export declare class FrictionJoint extends Joint {
|
||||
*/
|
||||
constructor(def: FrictionJointOpt, bodyA: Body$1, bodyB: Body$1, anchor?: Vec2Value);
|
||||
/** @hidden */
|
||||
_serialize(): object;
|
||||
/** @hidden */
|
||||
static _deserialize(data: any, world: any, restore: any): FrictionJoint;
|
||||
/** @hidden */
|
||||
_reset(def: Partial<FrictionJointDef>): void;
|
||||
/**
|
||||
* The local anchor point relative to bodyA's origin.
|
||||
@ -2970,6 +3018,10 @@ export declare class RevoluteJoint extends Joint {
|
||||
constructor(def: RevoluteJointDef);
|
||||
constructor(def: RevoluteJointOpt, bodyA: Body$1, bodyB: Body$1, anchor?: Vec2Value);
|
||||
/** @hidden */
|
||||
_serialize(): object;
|
||||
/** @hidden */
|
||||
static _deserialize(data: any, world: any, restore: any): RevoluteJoint;
|
||||
/** @hidden */
|
||||
_reset(def: Partial<RevoluteJointDef>): void;
|
||||
/**
|
||||
* The local anchor point relative to bodyA's origin.
|
||||
@ -3136,6 +3188,10 @@ export declare class PrismaticJoint extends Joint {
|
||||
constructor(def: PrismaticJointDef);
|
||||
constructor(def: PrismaticJointOpt, bodyA: Body$1, bodyB: Body$1, anchor?: Vec2Value, axis?: Vec2Value);
|
||||
/** @hidden */
|
||||
_serialize(): object;
|
||||
/** @hidden */
|
||||
static _deserialize(data: any, world: any, restore: any): PrismaticJoint;
|
||||
/** @hidden */
|
||||
_reset(def: Partial<PrismaticJointDef>): void;
|
||||
/**
|
||||
* The local anchor point relative to bodyA's origin.
|
||||
@ -3273,6 +3329,10 @@ export declare class GearJoint extends Joint {
|
||||
constructor(def: GearJointDef);
|
||||
constructor(def: GearJointOpt, bodyA: Body$1, bodyB: Body$1, joint1: RevoluteJoint | PrismaticJoint, joint2: RevoluteJoint | PrismaticJoint, ratio?: number);
|
||||
/** @hidden */
|
||||
_serialize(): object;
|
||||
/** @hidden */
|
||||
static _deserialize(data: any, world: any, restore: any): GearJoint;
|
||||
/** @hidden */
|
||||
_reset(def: Partial<GearJointDef>): void;
|
||||
/**
|
||||
* Get the first joint.
|
||||
@ -3357,6 +3417,10 @@ export declare class MotorJoint extends Joint {
|
||||
constructor(def: MotorJointDef);
|
||||
constructor(def: MotorJointOpt, bodyA: Body$1, bodyB: Body$1);
|
||||
/** @hidden */
|
||||
_serialize(): object;
|
||||
/** @hidden */
|
||||
static _deserialize(data: any, world: any, restore: any): MotorJoint;
|
||||
/** @hidden */
|
||||
_reset(def: Partial<MotorJointDef>): void;
|
||||
/**
|
||||
* Set the maximum friction force in N.
|
||||
@ -3468,6 +3532,10 @@ export declare class MouseJoint extends Joint {
|
||||
constructor(def: MouseJointDef);
|
||||
constructor(def: MouseJointOpt, bodyA: Body$1, bodyB: Body$1, target?: Vec2Value);
|
||||
/** @hidden */
|
||||
_serialize(): object;
|
||||
/** @hidden */
|
||||
static _deserialize(data: any, world: any, restore: any): MouseJoint;
|
||||
/** @hidden */
|
||||
_reset(def: Partial<MouseJointDef>): void;
|
||||
/**
|
||||
* Use this to update the target point.
|
||||
@ -3587,6 +3655,10 @@ export declare class PulleyJoint extends Joint {
|
||||
constructor(def: PulleyJointDef);
|
||||
constructor(def: PulleyJointOpt, bodyA: Body$1, bodyB: Body$1, groundA?: Vec2Value, groundB?: Vec2Value, anchorA?: Vec2Value, anchorB?: Vec2Value, ratio?: number);
|
||||
/** @hidden */
|
||||
_serialize(): object;
|
||||
/** @hidden */
|
||||
static _deserialize(data: any, world: any, restore: any): PulleyJoint;
|
||||
/** @hidden */
|
||||
_reset(def: Partial<PulleyJointDef>): void;
|
||||
/**
|
||||
* Get the first ground anchor.
|
||||
@ -3692,6 +3764,10 @@ export declare class RopeJoint extends Joint {
|
||||
constructor(def: RopeJointDef);
|
||||
constructor(def: RopeJointOpt, bodyA: Body$1, bodyB: Body$1, anchor?: Vec2Value);
|
||||
/** @hidden */
|
||||
_serialize(): object;
|
||||
/** @hidden */
|
||||
static _deserialize(data: any, world: any, restore: any): RopeJoint;
|
||||
/** @hidden */
|
||||
_reset(def: Partial<RopeJointDef>): void;
|
||||
/**
|
||||
* The local anchor point relative to bodyA's origin.
|
||||
@ -3781,6 +3857,10 @@ export declare class WeldJoint extends Joint {
|
||||
constructor(def: WeldJointDef);
|
||||
constructor(def: WeldJointOpt, bodyA: Body$1, bodyB: Body$1, anchor?: Vec2Value);
|
||||
/** @hidden */
|
||||
_serialize(): object;
|
||||
/** @hidden */
|
||||
static _deserialize(data: any, world: any, restore: any): WeldJoint;
|
||||
/** @hidden */
|
||||
_reset(def: Partial<WeldJointDef>): void;
|
||||
/**
|
||||
* The local anchor point relative to bodyA's origin.
|
||||
@ -3900,6 +3980,10 @@ export declare class WheelJoint extends Joint {
|
||||
constructor(def: WheelJointDef);
|
||||
constructor(def: WheelJointOpt, bodyA: Body$1, bodyB: Body$1, anchor?: Vec2Value, axis?: Vec2Value);
|
||||
/** @hidden */
|
||||
_serialize(): object;
|
||||
/** @hidden */
|
||||
static _deserialize(data: any, world: any, restore: any): WheelJoint;
|
||||
/** @hidden */
|
||||
_reset(def: Partial<WheelJointDef>): void;
|
||||
/**
|
||||
* The local anchor point relative to bodyA's origin.
|
||||
@ -4223,13 +4307,14 @@ export declare const internal: {
|
||||
toString(newline?: string): string;
|
||||
};
|
||||
};
|
||||
/** @hidden */
|
||||
export interface DataDriverListener<D, R> {
|
||||
enter: (d: D) => R | null;
|
||||
exit: (d: D, ref: R) => void;
|
||||
update: (d: D, ref: R) => void;
|
||||
}
|
||||
/**
|
||||
* @experimental
|
||||
* @experimental @hidden
|
||||
*
|
||||
* DataDriver is used it to create, update and destroy physics entities based on game objects.
|
||||
*/
|
||||
@ -4239,9 +4324,23 @@ export declare class DataDriver<D extends object, R> {
|
||||
ref(d: D): R;
|
||||
}
|
||||
|
||||
declare namespace DeterministicMath {
|
||||
export { atan, atan2, cos, exp, log, random, seedRandom, sin, sqrt };
|
||||
}
|
||||
declare namespace planck$1 {
|
||||
export { DeterministicMath };
|
||||
}
|
||||
|
||||
export {
|
||||
Body$1 as Body,
|
||||
BoxShape as Box,
|
||||
ChainShape as Chain,
|
||||
CircleShape as Circle,
|
||||
DeterministicMath,
|
||||
EdgeShape as Edge,
|
||||
PolygonShape as Polygon,
|
||||
math as Math,
|
||||
planck$1 as default,
|
||||
};
|
||||
|
||||
export {};
|
||||
|
||||
1956
dist/planck-with-testbed.js
vendored
1956
dist/planck-with-testbed.js
vendored
File diff suppressed because it is too large
Load Diff
2
dist/planck-with-testbed.js.map
vendored
2
dist/planck-with-testbed.js.map
vendored
File diff suppressed because one or more lines are too long
69
dist/planck-with-testbed.min.js
vendored
69
dist/planck-with-testbed.min.js
vendored
File diff suppressed because one or more lines are too long
2
dist/planck-with-testbed.min.js.map
vendored
2
dist/planck-with-testbed.min.js.map
vendored
File diff suppressed because one or more lines are too long
1930
dist/planck-with-testbed.mjs
vendored
1930
dist/planck-with-testbed.mjs
vendored
File diff suppressed because it is too large
Load Diff
2
dist/planck-with-testbed.mjs.map
vendored
2
dist/planck-with-testbed.mjs.map
vendored
File diff suppressed because one or more lines are too long
207
dist/planck.d.ts
vendored
207
dist/planck.d.ts
vendored
@ -18,6 +18,10 @@ export declare class Vec2 {
|
||||
constructor(x: number, y: number);
|
||||
constructor(obj: Vec2Value);
|
||||
constructor();
|
||||
/** @hidden */
|
||||
_serialize(): object;
|
||||
/** @hidden */
|
||||
static _deserialize(data: any): Vec2;
|
||||
static zero(): Vec2;
|
||||
/** @hidden */
|
||||
static neo(x: number, y: number): Vec2;
|
||||
@ -585,24 +589,25 @@ export interface Style {
|
||||
fill?: string;
|
||||
lineWidth?: number;
|
||||
}
|
||||
export type KEY = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "A" | "B" | "C" | "D" | "E" | "F" | "G" | "H" | "I" | "J" | "K" | "L" | "M" | "N" | "O" | "P" | "Q" | "R" | "S" | "T" | "U" | "V" | "W" | "X" | "Y" | "Z" | "right" | "left" | "up" | "down" | "fire";
|
||||
export type ActiveKeys = {
|
||||
[key in KEY]?: boolean;
|
||||
};
|
||||
export type TestbedMountOptions = {
|
||||
[key: string]: any;
|
||||
};
|
||||
export declare abstract class Testbed {
|
||||
export declare class Testbed {
|
||||
/**
|
||||
* Mounts testbed. Call start with a world to start simulation and rendering.
|
||||
*/
|
||||
static mount(options?: TestbedMountOptions): Testbed;
|
||||
static mount(options?: TestbedMountOptions): TestbedInterface;
|
||||
/**
|
||||
* Mounts testbed if needed, then starts simulation and rendering.
|
||||
*
|
||||
* If you need to customize testbed before starting, first run `const testbed = Testbed.mount()` and then `testbed.start()`.
|
||||
*/
|
||||
static start(world: World): Testbed;
|
||||
static start(world: World): TestbedInterface;
|
||||
}
|
||||
export interface TestbedInterface {
|
||||
/** World viewbox width. */
|
||||
width: number;
|
||||
/** World viewbox height. */
|
||||
@ -621,53 +626,34 @@ export declare abstract class Testbed {
|
||||
mouseForce?: number;
|
||||
activeKeys: ActiveKeys;
|
||||
/** callback, to be implemented by user */
|
||||
step: (dt: number, t: number) => void;
|
||||
step?: (dt: number, t: number) => void;
|
||||
/** callback, to be implemented by user */
|
||||
keydown: (keyCode: number, label: string) => void;
|
||||
keydown?: (keyCode: number, label: string) => void;
|
||||
/** callback, to be implemented by user */
|
||||
keyup: (keyCode: number, label: string) => void;
|
||||
abstract status(name: string, value: any): void;
|
||||
abstract status(value: object | string): void;
|
||||
abstract info(text: string): void;
|
||||
keyup?: (keyCode: number, label: string) => void;
|
||||
status(name: string, value: any): void;
|
||||
status(value: object | string): void;
|
||||
info(text: string): void;
|
||||
color(r: number, g: number, b: number): string;
|
||||
abstract drawPoint(p: {
|
||||
x: number;
|
||||
y: number;
|
||||
}, r: any, color: string): void;
|
||||
abstract drawCircle(p: {
|
||||
x: number;
|
||||
y: number;
|
||||
}, r: number, color: string): void;
|
||||
abstract drawEdge(a: {
|
||||
x: number;
|
||||
y: number;
|
||||
}, b: {
|
||||
x: number;
|
||||
y: number;
|
||||
}, color: string): void;
|
||||
abstract drawSegment(a: {
|
||||
x: number;
|
||||
y: number;
|
||||
}, b: {
|
||||
x: number;
|
||||
y: number;
|
||||
}, color: string): void;
|
||||
abstract drawPolygon(points: Array<{
|
||||
x: number;
|
||||
y: number;
|
||||
}>, color: string): void;
|
||||
abstract drawAABB(aabb: AABBValue, color: string): void;
|
||||
abstract start(world: World): void;
|
||||
abstract findOne(query: string): (Body$1 | Joint | Fixture | null);
|
||||
abstract findAll(query: string): (Body$1 | Joint | Fixture)[];
|
||||
drawPoint(p: Vec2Value, r: any, color: string): void;
|
||||
drawCircle(p: Vec2Value, r: number, color: string): void;
|
||||
drawEdge(a: Vec2Value, b: Vec2Value, color: string): void;
|
||||
drawSegment(a: Vec2Value, b: Vec2Value, color: string): void;
|
||||
drawPolygon(points: Array<Vec2Value>, color: string): void;
|
||||
drawChain(points: Array<Vec2Value>, color: string): void;
|
||||
drawAABB(aabb: AABBValue, color: string): void;
|
||||
start(world: World): void;
|
||||
findOne(query: string): Body$1 | Joint | Fixture | null;
|
||||
findAll(query: string): (Body$1 | Joint | Fixture)[];
|
||||
}
|
||||
export type TestbedFactoryOptions = string | TestbedMountOptions;
|
||||
/** @deprecated */
|
||||
export type TestbedCallback = (testbed: Testbed) => (World | undefined);
|
||||
export type TestbedCallback = (testbed: TestbedInterface) => World | undefined;
|
||||
/** @deprecated */
|
||||
export declare function testbed(callback: TestbedCallback): void;
|
||||
/** @deprecated */
|
||||
export declare function testbed(options: TestbedFactoryOptions, callback: TestbedCallback): void;
|
||||
export type KEY = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "A" | "B" | "C" | "D" | "E" | "F" | "G" | "H" | "I" | "J" | "K" | "L" | "M" | "N" | "O" | "P" | "Q" | "R" | "S" | "T" | "U" | "V" | "W" | "X" | "Y" | "Z" | "right" | "left" | "up" | "down" | "fire";
|
||||
/**
|
||||
* A shape is used for collision detection. You can create a shape however you
|
||||
* like. Shapes used for simulation in World are created automatically when a
|
||||
@ -1025,6 +1011,10 @@ export declare class Fixture {
|
||||
constructor(body: Body$1, shape: Shape, density?: number);
|
||||
/** @hidden Re-setup fixture. */
|
||||
_reset(): void;
|
||||
/** @hidden */
|
||||
_serialize(): object;
|
||||
/** @hidden */
|
||||
static _deserialize(data: any, body: any, restore: any): Fixture;
|
||||
/**
|
||||
* Get the type of the child shape. You can use this to down cast to the
|
||||
* concrete shape.
|
||||
@ -1568,6 +1558,10 @@ declare class Body$1 {
|
||||
style: Style;
|
||||
/** @hidden @experimental Similar to userData, but used by dev-tools or runtime environment. */
|
||||
appData: Record<string, any>;
|
||||
/** @hidden */
|
||||
_serialize(): object;
|
||||
/** @hidden */
|
||||
static _deserialize(data: any, world: any, restore: any): Body$1;
|
||||
isWorldLocked(): boolean;
|
||||
getWorld(): World;
|
||||
getNext(): Body$1 | null;
|
||||
@ -1962,6 +1956,10 @@ export declare class World {
|
||||
* @param def World definition or gravity vector.
|
||||
*/
|
||||
constructor(def?: WorldDef | Vec2Value);
|
||||
/** @hidden */
|
||||
_serialize(): object;
|
||||
/** @hidden */
|
||||
static _deserialize(data: any, context: any, restore: any): World;
|
||||
/**
|
||||
* Get the world body list. With the returned body, use Body.getNext to get the
|
||||
* next body in the world list. A null body indicates the end of the list.
|
||||
@ -2112,6 +2110,8 @@ export declare class World {
|
||||
* Create a joint to constrain bodies together. No reference to the definition
|
||||
* is retained. This may cause the connected bodies to cease colliding.
|
||||
*
|
||||
* Note: creating a joint doesn't wake the bodies.
|
||||
*
|
||||
* Warning: This function is locked when a world simulation step is in progress. Use queueUpdate to schedule a function to be called after the step.
|
||||
*/
|
||||
createJoint<T extends Joint>(joint: T): T | null;
|
||||
@ -2187,12 +2187,18 @@ export declare class World {
|
||||
* Warning: You cannot create/destroy world entities inside these callbacks.
|
||||
*/
|
||||
on(name: "post-solve", listener: (contact: Contact, impulse: ContactImpulse) => void): World;
|
||||
/** Listener is called whenever a body is removed. */
|
||||
/** Listener is called when a body is removed. */
|
||||
on(name: "remove-body", listener: (body: Body$1) => void): World;
|
||||
/** Listener is called whenever a joint is removed implicitly or explicitly. */
|
||||
/** Listener is called when a joint is removed implicitly or explicitly. */
|
||||
on(name: "remove-joint", listener: (joint: Joint) => void): World;
|
||||
/** Listener is called whenever a fixture is removed implicitly or explicitly. */
|
||||
/** Listener is called when a fixture is removed implicitly or explicitly. */
|
||||
on(name: "remove-fixture", listener: (fixture: Fixture) => void): World;
|
||||
/** Listener is called when a body is added. */
|
||||
on(name: "add-body", listener: (body: Body$1) => void): World;
|
||||
/** Listener is called when a joint is added. */
|
||||
on(name: "add-joint", listener: (joint: Joint) => void): World;
|
||||
/** Listener is called when a fixture is added. */
|
||||
on(name: "add-fixture", listener: (fixture: Fixture) => void): World;
|
||||
off(name: "begin-contact", listener: (contact: Contact) => void): World;
|
||||
off(name: "end-contact", listener: (contact: Contact) => void): World;
|
||||
off(name: "pre-solve", listener: (contact: Contact, oldManifold: Manifold) => void): World;
|
||||
@ -2200,6 +2206,9 @@ export declare class World {
|
||||
off(name: "remove-body", listener: (body: Body$1) => void): World;
|
||||
off(name: "remove-joint", listener: (joint: Joint) => void): World;
|
||||
off(name: "remove-fixture", listener: (fixture: Fixture) => void): World;
|
||||
off(name: "add-body", listener: (body: Body$1) => void): World;
|
||||
off(name: "add-joint", listener: (joint: Joint) => void): World;
|
||||
off(name: "add-fixture", listener: (fixture: Fixture) => void): World;
|
||||
publish(name: string, arg1?: any, arg2?: any, arg3?: any): number;
|
||||
}
|
||||
export type DataType = any;
|
||||
@ -2223,6 +2232,22 @@ export declare class Serializer<T> {
|
||||
}
|
||||
/** @ignore */
|
||||
declare const math: any;
|
||||
declare function sin(x: number): number;
|
||||
declare function cos(x: number): number;
|
||||
declare function exp(x: number): number;
|
||||
declare function atan(x: number): number;
|
||||
declare function atan2(y: number, x: number): number;
|
||||
declare function log(x: number): number;
|
||||
declare function sqrt(x: number): number;
|
||||
/**
|
||||
* Seed the deterministic PRNG.
|
||||
*
|
||||
* Call before a run and before replaying it. Upstream planck uses
|
||||
* `Math.random`, which cannot be reproduced and so cannot appear anywhere in a
|
||||
* simulation whose replay must be verifiable.
|
||||
*/
|
||||
export declare function seedRandom(seed: number): void;
|
||||
declare function random(): number;
|
||||
/** 3D vector */
|
||||
export interface Vec3Value {
|
||||
x: number;
|
||||
@ -2244,6 +2269,10 @@ export declare class Vec3 {
|
||||
constructor(obj: Vec3Value);
|
||||
constructor();
|
||||
/** @hidden */
|
||||
_serialize(): object;
|
||||
/** @hidden */
|
||||
static _deserialize(data: any): Vec3;
|
||||
/** @hidden */
|
||||
static neo(x: number, y: number, z: number): Vec3;
|
||||
static zero(): Vec3;
|
||||
static clone(v: Vec3Value): Vec3;
|
||||
@ -2378,6 +2407,10 @@ export declare class CircleShape extends Shape {
|
||||
constructor(position: Vec2Value, radius?: number);
|
||||
constructor(radius?: number);
|
||||
/** @hidden */
|
||||
_serialize(): object;
|
||||
/** @hidden */
|
||||
static _deserialize(data: any): CircleShape;
|
||||
/** @hidden */
|
||||
_reset(): void;
|
||||
getType(): "circle";
|
||||
getRadius(): number;
|
||||
@ -2422,7 +2455,6 @@ export declare class CircleShape extends Shape {
|
||||
computeMass(massData: MassData, density: number): void;
|
||||
computeDistanceProxy(proxy: DistanceProxy): void;
|
||||
}
|
||||
export declare const Circle: typeof CircleShape;
|
||||
/** @hidden @deprecated Use new keyword. */
|
||||
export function EdgeShape(v1?: Vec2Value, v2?: Vec2Value): EdgeShape;
|
||||
/**
|
||||
@ -2442,6 +2474,10 @@ export declare class EdgeShape extends Shape {
|
||||
/** @hidden */ m_hasVertex3: boolean;
|
||||
constructor(v1?: Vec2Value, v2?: Vec2Value);
|
||||
/** @hidden */
|
||||
_serialize(): object;
|
||||
/** @hidden */
|
||||
static _deserialize(data: any): EdgeShape;
|
||||
/** @hidden */
|
||||
_reset(): void;
|
||||
getRadius(): number;
|
||||
getType(): "edge";
|
||||
@ -2505,7 +2541,6 @@ export declare class EdgeShape extends Shape {
|
||||
computeMass(massData: MassData, density?: number): void;
|
||||
computeDistanceProxy(proxy: DistanceProxy): void;
|
||||
}
|
||||
export declare const Edge: typeof EdgeShape;
|
||||
/** @hidden @deprecated Use new keyword. */
|
||||
export function PolygonShape(vertices?: Vec2Value[]): PolygonShape;
|
||||
/**
|
||||
@ -2523,6 +2558,10 @@ export declare class PolygonShape extends Shape {
|
||||
/** @hidden */ m_count: number;
|
||||
/** @hidden */ m_radius: number;
|
||||
constructor(vertices?: Vec2Value[]);
|
||||
/** @hidden */
|
||||
_serialize(): object;
|
||||
/** @hidden */
|
||||
static _deserialize(data: any, fixture: any, restore: any): PolygonShape;
|
||||
getType(): "polygon";
|
||||
getRadius(): number;
|
||||
/**
|
||||
@ -2572,7 +2611,6 @@ export declare class PolygonShape extends Shape {
|
||||
validate(): boolean;
|
||||
computeDistanceProxy(proxy: DistanceProxy): void;
|
||||
}
|
||||
export declare const Polygon: typeof PolygonShape;
|
||||
/** @hidden @deprecated Use new keyword. */
|
||||
export function ChainShape(vertices?: Vec2Value[], loop?: boolean): ChainShape;
|
||||
/**
|
||||
@ -2595,6 +2633,10 @@ export declare class ChainShape extends Shape {
|
||||
/** @hidden */ m_hasNextVertex: boolean;
|
||||
/** @hidden */ m_isLoop: boolean;
|
||||
constructor(vertices?: Vec2Value[], loop?: boolean);
|
||||
/** @hidden */
|
||||
_serialize(): object;
|
||||
/** @hidden */
|
||||
static _deserialize(data: any, fixture: any, restore: any): ChainShape;
|
||||
getType(): "chain";
|
||||
getRadius(): number;
|
||||
/** @hidden */
|
||||
@ -2658,7 +2700,6 @@ export declare class ChainShape extends Shape {
|
||||
computeMass(massData: MassData, density?: number): void;
|
||||
computeDistanceProxy(proxy: DistanceProxy, childIndex: number): void;
|
||||
}
|
||||
export declare const Chain: typeof ChainShape;
|
||||
/** @hidden @deprecated Use new keyword. */
|
||||
export function BoxShape(halfWidth: number, halfHeight: number, center?: Vec2Value, angle?: number): BoxShape;
|
||||
/**
|
||||
@ -2675,15 +2716,14 @@ export declare class BoxShape extends PolygonShape {
|
||||
*/
|
||||
constructor(halfWidth: number, halfHeight: number, center?: Vec2Value, angle?: number);
|
||||
}
|
||||
export declare const Box: typeof BoxShape;
|
||||
export declare const CollideCircles: (manifold: Manifold, circleA: CircleShape, xfA: TransformValue, circleB: CircleShape, xfB: TransformValue) => void;
|
||||
export declare const CollideEdgeCircle: (manifold: Manifold, edgeA: EdgeShape, xfA: TransformValue, circleB: CircleShape, xfB: TransformValue) => void;
|
||||
/**
|
||||
*
|
||||
* Find edge normal of max separation on A - return if separating axis is found<br>
|
||||
* Find edge normal of max separation on B - return if separation axis is found<br>
|
||||
* Choose reference edge as min(minA, minB)<br>
|
||||
* Find incident edge<br>
|
||||
* Find edge normal of max separation on A - return if separating axis is found
|
||||
* Find edge normal of max separation on B - return if separation axis is found
|
||||
* Choose reference edge as min(minA, minB)
|
||||
* Find incident edge
|
||||
* Clip
|
||||
*
|
||||
* The normal points from 1 to 2
|
||||
@ -2753,6 +2793,10 @@ export declare class DistanceJoint extends Joint {
|
||||
*/
|
||||
constructor(def: DistanceJointOpt, bodyA: Body$1, bodyB: Body$1, anchorA?: Vec2Value, anchorB?: Vec2Value);
|
||||
/** @hidden */
|
||||
_serialize(): object;
|
||||
/** @hidden */
|
||||
static _deserialize(data: any, world: any, restore: any): DistanceJoint;
|
||||
/** @hidden */
|
||||
_reset(def: Partial<DistanceJointDef>): void;
|
||||
/**
|
||||
* The local anchor point relative to bodyA's origin.
|
||||
@ -2840,6 +2884,10 @@ export declare class FrictionJoint extends Joint {
|
||||
*/
|
||||
constructor(def: FrictionJointOpt, bodyA: Body$1, bodyB: Body$1, anchor?: Vec2Value);
|
||||
/** @hidden */
|
||||
_serialize(): object;
|
||||
/** @hidden */
|
||||
static _deserialize(data: any, world: any, restore: any): FrictionJoint;
|
||||
/** @hidden */
|
||||
_reset(def: Partial<FrictionJointDef>): void;
|
||||
/**
|
||||
* The local anchor point relative to bodyA's origin.
|
||||
@ -2970,6 +3018,10 @@ export declare class RevoluteJoint extends Joint {
|
||||
constructor(def: RevoluteJointDef);
|
||||
constructor(def: RevoluteJointOpt, bodyA: Body$1, bodyB: Body$1, anchor?: Vec2Value);
|
||||
/** @hidden */
|
||||
_serialize(): object;
|
||||
/** @hidden */
|
||||
static _deserialize(data: any, world: any, restore: any): RevoluteJoint;
|
||||
/** @hidden */
|
||||
_reset(def: Partial<RevoluteJointDef>): void;
|
||||
/**
|
||||
* The local anchor point relative to bodyA's origin.
|
||||
@ -3136,6 +3188,10 @@ export declare class PrismaticJoint extends Joint {
|
||||
constructor(def: PrismaticJointDef);
|
||||
constructor(def: PrismaticJointOpt, bodyA: Body$1, bodyB: Body$1, anchor?: Vec2Value, axis?: Vec2Value);
|
||||
/** @hidden */
|
||||
_serialize(): object;
|
||||
/** @hidden */
|
||||
static _deserialize(data: any, world: any, restore: any): PrismaticJoint;
|
||||
/** @hidden */
|
||||
_reset(def: Partial<PrismaticJointDef>): void;
|
||||
/**
|
||||
* The local anchor point relative to bodyA's origin.
|
||||
@ -3273,6 +3329,10 @@ export declare class GearJoint extends Joint {
|
||||
constructor(def: GearJointDef);
|
||||
constructor(def: GearJointOpt, bodyA: Body$1, bodyB: Body$1, joint1: RevoluteJoint | PrismaticJoint, joint2: RevoluteJoint | PrismaticJoint, ratio?: number);
|
||||
/** @hidden */
|
||||
_serialize(): object;
|
||||
/** @hidden */
|
||||
static _deserialize(data: any, world: any, restore: any): GearJoint;
|
||||
/** @hidden */
|
||||
_reset(def: Partial<GearJointDef>): void;
|
||||
/**
|
||||
* Get the first joint.
|
||||
@ -3357,6 +3417,10 @@ export declare class MotorJoint extends Joint {
|
||||
constructor(def: MotorJointDef);
|
||||
constructor(def: MotorJointOpt, bodyA: Body$1, bodyB: Body$1);
|
||||
/** @hidden */
|
||||
_serialize(): object;
|
||||
/** @hidden */
|
||||
static _deserialize(data: any, world: any, restore: any): MotorJoint;
|
||||
/** @hidden */
|
||||
_reset(def: Partial<MotorJointDef>): void;
|
||||
/**
|
||||
* Set the maximum friction force in N.
|
||||
@ -3468,6 +3532,10 @@ export declare class MouseJoint extends Joint {
|
||||
constructor(def: MouseJointDef);
|
||||
constructor(def: MouseJointOpt, bodyA: Body$1, bodyB: Body$1, target?: Vec2Value);
|
||||
/** @hidden */
|
||||
_serialize(): object;
|
||||
/** @hidden */
|
||||
static _deserialize(data: any, world: any, restore: any): MouseJoint;
|
||||
/** @hidden */
|
||||
_reset(def: Partial<MouseJointDef>): void;
|
||||
/**
|
||||
* Use this to update the target point.
|
||||
@ -3587,6 +3655,10 @@ export declare class PulleyJoint extends Joint {
|
||||
constructor(def: PulleyJointDef);
|
||||
constructor(def: PulleyJointOpt, bodyA: Body$1, bodyB: Body$1, groundA?: Vec2Value, groundB?: Vec2Value, anchorA?: Vec2Value, anchorB?: Vec2Value, ratio?: number);
|
||||
/** @hidden */
|
||||
_serialize(): object;
|
||||
/** @hidden */
|
||||
static _deserialize(data: any, world: any, restore: any): PulleyJoint;
|
||||
/** @hidden */
|
||||
_reset(def: Partial<PulleyJointDef>): void;
|
||||
/**
|
||||
* Get the first ground anchor.
|
||||
@ -3692,6 +3764,10 @@ export declare class RopeJoint extends Joint {
|
||||
constructor(def: RopeJointDef);
|
||||
constructor(def: RopeJointOpt, bodyA: Body$1, bodyB: Body$1, anchor?: Vec2Value);
|
||||
/** @hidden */
|
||||
_serialize(): object;
|
||||
/** @hidden */
|
||||
static _deserialize(data: any, world: any, restore: any): RopeJoint;
|
||||
/** @hidden */
|
||||
_reset(def: Partial<RopeJointDef>): void;
|
||||
/**
|
||||
* The local anchor point relative to bodyA's origin.
|
||||
@ -3781,6 +3857,10 @@ export declare class WeldJoint extends Joint {
|
||||
constructor(def: WeldJointDef);
|
||||
constructor(def: WeldJointOpt, bodyA: Body$1, bodyB: Body$1, anchor?: Vec2Value);
|
||||
/** @hidden */
|
||||
_serialize(): object;
|
||||
/** @hidden */
|
||||
static _deserialize(data: any, world: any, restore: any): WeldJoint;
|
||||
/** @hidden */
|
||||
_reset(def: Partial<WeldJointDef>): void;
|
||||
/**
|
||||
* The local anchor point relative to bodyA's origin.
|
||||
@ -3900,6 +3980,10 @@ export declare class WheelJoint extends Joint {
|
||||
constructor(def: WheelJointDef);
|
||||
constructor(def: WheelJointOpt, bodyA: Body$1, bodyB: Body$1, anchor?: Vec2Value, axis?: Vec2Value);
|
||||
/** @hidden */
|
||||
_serialize(): object;
|
||||
/** @hidden */
|
||||
static _deserialize(data: any, world: any, restore: any): WheelJoint;
|
||||
/** @hidden */
|
||||
_reset(def: Partial<WheelJointDef>): void;
|
||||
/**
|
||||
* The local anchor point relative to bodyA's origin.
|
||||
@ -4223,13 +4307,14 @@ export declare const internal: {
|
||||
toString(newline?: string): string;
|
||||
};
|
||||
};
|
||||
/** @hidden */
|
||||
export interface DataDriverListener<D, R> {
|
||||
enter: (d: D) => R | null;
|
||||
exit: (d: D, ref: R) => void;
|
||||
update: (d: D, ref: R) => void;
|
||||
}
|
||||
/**
|
||||
* @experimental
|
||||
* @experimental @hidden
|
||||
*
|
||||
* DataDriver is used it to create, update and destroy physics entities based on game objects.
|
||||
*/
|
||||
@ -4239,9 +4324,23 @@ export declare class DataDriver<D extends object, R> {
|
||||
ref(d: D): R;
|
||||
}
|
||||
|
||||
declare namespace DeterministicMath {
|
||||
export { atan, atan2, cos, exp, log, random, seedRandom, sin, sqrt };
|
||||
}
|
||||
declare namespace planck$1 {
|
||||
export { DeterministicMath };
|
||||
}
|
||||
|
||||
export {
|
||||
Body$1 as Body,
|
||||
BoxShape as Box,
|
||||
ChainShape as Chain,
|
||||
CircleShape as Circle,
|
||||
DeterministicMath,
|
||||
EdgeShape as Edge,
|
||||
PolygonShape as Polygon,
|
||||
math as Math,
|
||||
planck$1 as default,
|
||||
};
|
||||
|
||||
export {};
|
||||
|
||||
778
dist/planck.js
vendored
778
dist/planck.js
vendored
File diff suppressed because it is too large
Load Diff
2
dist/planck.js.map
vendored
2
dist/planck.js.map
vendored
File diff suppressed because one or more lines are too long
22
dist/planck.min.js
vendored
22
dist/planck.min.js
vendored
File diff suppressed because one or more lines are too long
2
dist/planck.min.js.map
vendored
2
dist/planck.min.js.map
vendored
File diff suppressed because one or more lines are too long
774
dist/planck.mjs
vendored
774
dist/planck.mjs
vendored
File diff suppressed because it is too large
Load Diff
2
dist/planck.mjs.map
vendored
2
dist/planck.mjs.map
vendored
File diff suppressed because one or more lines are too long
96
docs/.vitepress/config.ts
Normal file
96
docs/.vitepress/config.ts
Normal file
@ -0,0 +1,96 @@
|
||||
import { defineConfig } from "vitepress";
|
||||
|
||||
// https://vitepress.dev/reference/site-config
|
||||
export default defineConfig({
|
||||
title: "Planck.js Docs",
|
||||
description: "2D Physics Engine for JavaScript",
|
||||
srcDir: "./pages",
|
||||
base: "/planck.js/docs/",
|
||||
outDir: "../dist/docs",
|
||||
themeConfig: {
|
||||
// https://vitepress.dev/reference/default-theme-config
|
||||
search: {
|
||||
provider: "local",
|
||||
},
|
||||
nav: [
|
||||
{ text: "API Reference", link: "/api/" },
|
||||
{ text: "Playground", link: "https://piqnt.com/" },
|
||||
{ text: "GitHub", link: "https://github.com/piqnt/planck.js/" },
|
||||
{ text: "Discord", link: "https://discord.gg/znjh6J7" },
|
||||
],
|
||||
sidebar: [
|
||||
{ link: "/", text: "Introduction" },
|
||||
{
|
||||
text: "Get Started",
|
||||
collapsed: true,
|
||||
items: [
|
||||
{ link: "/run-your-code", text: "Run Your Code" },
|
||||
{ link: "/hello-world", text: "Hello World" },
|
||||
{ link: "/core-concepts", text: "Core Concepts" },
|
||||
{ link: "/install", text: "Install" },
|
||||
],
|
||||
},
|
||||
|
||||
{
|
||||
text: "API Conventions",
|
||||
collapsed: true,
|
||||
items: [
|
||||
{ link: "/api-conventions/units", text: "Units" },
|
||||
{ link: "/api-conventions/factories-and-definitions", text: "Factories and Definitions" },
|
||||
{ link: "/api-conventions/implicit-destruction", text: "Implicit Destruction" },
|
||||
{ link: "/api-conventions/user-data", text: "User Data" },
|
||||
],
|
||||
},
|
||||
|
||||
{ link: "/world", text: "World" },
|
||||
{ link: "/body", text: "Body" },
|
||||
{ link: "/fixture", text: "Fixture" },
|
||||
|
||||
{
|
||||
text: "Shape",
|
||||
collapsed: true,
|
||||
link: "/shape",
|
||||
items: [
|
||||
{ link: "/shape", text: "Shape" },
|
||||
{ link: "/shape/circle", text: "Circle" },
|
||||
{ link: "/shape/polygon", text: "Polygon" },
|
||||
{ link: "/shape/edge", text: "Edge" },
|
||||
{ link: "/shape/chain", text: "Chain" },
|
||||
],
|
||||
},
|
||||
|
||||
{
|
||||
text: "Joint",
|
||||
collapsed: true,
|
||||
link: "/joint",
|
||||
items: [
|
||||
{ link: "/joint", text: "Joint" },
|
||||
{ link: "/joint/distance-joint", text: "Distance Joint" },
|
||||
{ link: "/joint/friction-joint", text: "Friction Joint" },
|
||||
{ link: "/joint/gear-joint", text: "Gear Joint" },
|
||||
{ link: "/joint/motor-joint", text: "Motor Joint" },
|
||||
{ link: "/joint/prismatic-joint", text: "Prismatic Joint" },
|
||||
{ link: "/joint/pulley", text: "Pulley" },
|
||||
{ link: "/joint/revolute-joint", text: "Revolute Joint" },
|
||||
{ link: "/joint/rope-joint", text: "Rope Joint" },
|
||||
{ link: "/joint/weld-joint", text: "Weld Joint" },
|
||||
{ link: "/joint/wheel-joint", text: "Wheel Joint" },
|
||||
{ link: "/joint/mouse-joint", text: "Mouse Joint" },
|
||||
],
|
||||
},
|
||||
|
||||
{ link: "/contacts", text: "Contacts" },
|
||||
{ link: "/collision", text: "Collision" },
|
||||
|
||||
{ link: "/world/simulation", text: "Simulation" },
|
||||
{ link: "/rendering", text: "Rendering" },
|
||||
|
||||
{ link: "/testbed", text: "Testbed" },
|
||||
|
||||
{ link: "/limitations", text: "Limitations" },
|
||||
{ link: "/api/", text: "API Reference" },
|
||||
{ link: "/references-resources", text: "References & Resources" },
|
||||
{ link: "/credits", text: "Credits & License" },
|
||||
],
|
||||
},
|
||||
});
|
||||
12923
docs/package-lock.json
generated
12923
docs/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -1,18 +0,0 @@
|
||||
{
|
||||
"private": true,
|
||||
"name": "stage-docs",
|
||||
"version": "0.0.0",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vocs dev",
|
||||
"build": "vocs build",
|
||||
"preview": "vocs preview"
|
||||
},
|
||||
"dependencies": {
|
||||
"@types/react": "latest",
|
||||
"react": "latest",
|
||||
"react-dom": "latest",
|
||||
"typescript": "latest",
|
||||
"vocs": "^1.0.0-alpha.62"
|
||||
}
|
||||
}
|
||||
@ -1,297 +0,0 @@
|
||||
# Class: AABB
|
||||
|
||||
Axis-aligned bounding box
|
||||
|
||||
## Constructors
|
||||
|
||||
### new AABB()
|
||||
|
||||
> **new AABB**(`lower`?, `upper`?): [`AABB`](/api/classes/AABB)
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **lower?**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
• **upper?**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`AABB`](/api/classes/AABB)
|
||||
|
||||
## Properties
|
||||
|
||||
### lowerBound
|
||||
|
||||
> **lowerBound**: [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
***
|
||||
|
||||
### upperBound
|
||||
|
||||
> **upperBound**: [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
## Methods
|
||||
|
||||
### combine()
|
||||
|
||||
> **combine**(`a`, `b`?): `void`
|
||||
|
||||
Combine one or two AABB into this one.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **a**: [`AABBValue`](/api/interfaces/AABBValue)
|
||||
|
||||
• **b?**: [`AABBValue`](/api/interfaces/AABBValue)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### combinePoints()
|
||||
|
||||
> **combinePoints**(`a`, `b`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **a**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
• **b**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### contains()
|
||||
|
||||
> **contains**(`aabb`): `boolean`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **aabb**: [`AABBValue`](/api/interfaces/AABBValue)
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
***
|
||||
|
||||
### extend()
|
||||
|
||||
> **extend**(`value`): [`AABB`](/api/classes/AABB)
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **value**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
[`AABB`](/api/classes/AABB)
|
||||
|
||||
***
|
||||
|
||||
### getCenter()
|
||||
|
||||
> **getCenter**(): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
Get the center of the AABB.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
***
|
||||
|
||||
### getExtents()
|
||||
|
||||
> **getExtents**(): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
Get the extents of the AABB (half-widths).
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
***
|
||||
|
||||
### getPerimeter()
|
||||
|
||||
> **getPerimeter**(): `number`
|
||||
|
||||
Get the perimeter length.
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### isValid()
|
||||
|
||||
> **isValid**(): `boolean`
|
||||
|
||||
Verify that the bounds are sorted.
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
***
|
||||
|
||||
### rayCast()
|
||||
|
||||
> **rayCast**(`output`, `input`): `boolean`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **output**: [`RayCastOutput`](/api/interfaces/RayCastOutput)
|
||||
|
||||
• **input**: [`RayCastInput`](/api/interfaces/RayCastInput)
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
***
|
||||
|
||||
### set()
|
||||
|
||||
> **set**(`aabb`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **aabb**: [`AABBValue`](/api/interfaces/AABBValue)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### areEqual()
|
||||
|
||||
> `static` **areEqual**(`a`, `b`): `boolean`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **a**: [`AABBValue`](/api/interfaces/AABBValue)
|
||||
|
||||
• **b**: [`AABBValue`](/api/interfaces/AABBValue)
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
***
|
||||
|
||||
### assert()
|
||||
|
||||
> `static` **assert**(`o`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **o**: `any`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### combinedPerimeter()
|
||||
|
||||
> `static` **combinedPerimeter**(`a`, `b`): `number`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **a**: [`AABBValue`](/api/interfaces/AABBValue)
|
||||
|
||||
• **b**: [`AABBValue`](/api/interfaces/AABBValue)
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### combinePoints()
|
||||
|
||||
> `static` **combinePoints**(`out`, `a`, `b`): [`AABBValue`](/api/interfaces/AABBValue)
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **out**: [`AABBValue`](/api/interfaces/AABBValue)
|
||||
|
||||
• **a**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
• **b**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`AABBValue`](/api/interfaces/AABBValue)
|
||||
|
||||
***
|
||||
|
||||
### diff()
|
||||
|
||||
> `static` **diff**(`a`, `b`): `number`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **a**: [`AABBValue`](/api/interfaces/AABBValue)
|
||||
|
||||
• **b**: [`AABBValue`](/api/interfaces/AABBValue)
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### extend()
|
||||
|
||||
> `static` **extend**(`out`, `value`): [`AABBValue`](/api/interfaces/AABBValue)
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **out**: [`AABBValue`](/api/interfaces/AABBValue)
|
||||
|
||||
• **value**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
[`AABBValue`](/api/interfaces/AABBValue)
|
||||
|
||||
***
|
||||
|
||||
### isValid()
|
||||
|
||||
> `static` **isValid**(`obj`): `boolean`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **obj**: `any`
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
***
|
||||
|
||||
### testOverlap()
|
||||
|
||||
> `static` **testOverlap**(`a`, `b`): `boolean`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **a**: [`AABBValue`](/api/interfaces/AABBValue)
|
||||
|
||||
• **b**: [`AABBValue`](/api/interfaces/AABBValue)
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,279 +0,0 @@
|
||||
# Class: BoxShape
|
||||
|
||||
A rectangle polygon which extend PolygonShape.
|
||||
|
||||
## Extends
|
||||
|
||||
- [`PolygonShape`](/api/classes/PolygonShape)
|
||||
|
||||
## Constructors
|
||||
|
||||
### new BoxShape()
|
||||
|
||||
> **new BoxShape**(`halfWidth`, `halfHeight`, `center`?, `angle`?): [`BoxShape`](/api/classes/BoxShape)
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **halfWidth**: `number`
|
||||
|
||||
• **halfHeight**: `number`
|
||||
|
||||
• **center?**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
coordinate of the center of the box relative to the body
|
||||
|
||||
• **angle?**: `number`
|
||||
|
||||
angle of the box relative to the body
|
||||
|
||||
#### Returns
|
||||
|
||||
[`BoxShape`](/api/classes/BoxShape)
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`PolygonShape`](/api/classes/PolygonShape).[`constructor`](/api/classes/PolygonShape#constructors)
|
||||
|
||||
## Properties
|
||||
|
||||
### style
|
||||
|
||||
> **style**: [`Style`](/api/interfaces/Style) = `{}`
|
||||
|
||||
Styling for dev-tools.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`PolygonShape`](/api/classes/PolygonShape).[`style`](/api/classes/PolygonShape#style)
|
||||
|
||||
***
|
||||
|
||||
### TYPE
|
||||
|
||||
> `static` **TYPE**: `"polygon"`
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`PolygonShape`](/api/classes/PolygonShape).[`TYPE`](/api/classes/PolygonShape#type)
|
||||
|
||||
## Methods
|
||||
|
||||
### computeAABB()
|
||||
|
||||
> **computeAABB**(`aabb`, `xf`, `childIndex`): `void`
|
||||
|
||||
Given a transform, compute the associated axis aligned bounding box for a
|
||||
child shape.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **aabb**: [`AABBValue`](/api/interfaces/AABBValue)
|
||||
|
||||
Returns the axis aligned box.
|
||||
|
||||
• **xf**: [`TransformValue`](/api/type-aliases/TransformValue)
|
||||
|
||||
The world transform of the shape.
|
||||
|
||||
• **childIndex**: `number`
|
||||
|
||||
The child shape
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`PolygonShape`](/api/classes/PolygonShape).[`computeAABB`](/api/classes/PolygonShape#computeaabb)
|
||||
|
||||
***
|
||||
|
||||
### computeDistanceProxy()
|
||||
|
||||
> **computeDistanceProxy**(`proxy`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **proxy**: [`DistanceProxy`](/api/classes/DistanceProxy)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`PolygonShape`](/api/classes/PolygonShape).[`computeDistanceProxy`](/api/classes/PolygonShape#computedistanceproxy)
|
||||
|
||||
***
|
||||
|
||||
### computeMass()
|
||||
|
||||
> **computeMass**(`massData`, `density`): `void`
|
||||
|
||||
Compute the mass properties of this shape using its dimensions and density.
|
||||
The inertia tensor is computed about the local origin.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **massData**: [`MassData`](/api/interfaces/MassData)
|
||||
|
||||
Returns the mass data for this shape.
|
||||
|
||||
• **density**: `number`
|
||||
|
||||
The density in kilograms per meter squared.
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`PolygonShape`](/api/classes/PolygonShape).[`computeMass`](/api/classes/PolygonShape#computemass)
|
||||
|
||||
***
|
||||
|
||||
### getChildCount()
|
||||
|
||||
> **getChildCount**(): `1`
|
||||
|
||||
Get the number of child primitives.
|
||||
|
||||
#### Returns
|
||||
|
||||
`1`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`PolygonShape`](/api/classes/PolygonShape).[`getChildCount`](/api/classes/PolygonShape#getchildcount)
|
||||
|
||||
***
|
||||
|
||||
### getRadius()
|
||||
|
||||
> **getRadius**(): `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`PolygonShape`](/api/classes/PolygonShape).[`getRadius`](/api/classes/PolygonShape#getradius)
|
||||
|
||||
***
|
||||
|
||||
### getType()
|
||||
|
||||
> **getType**(): `"polygon"`
|
||||
|
||||
Get the type of this shape. You can use this to down cast to the concrete
|
||||
shape.
|
||||
|
||||
#### Returns
|
||||
|
||||
`"polygon"`
|
||||
|
||||
the shape type.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`PolygonShape`](/api/classes/PolygonShape).[`getType`](/api/classes/PolygonShape#gettype)
|
||||
|
||||
***
|
||||
|
||||
### rayCast()
|
||||
|
||||
> **rayCast**(`output`, `input`, `xf`, `childIndex`): `boolean`
|
||||
|
||||
Cast a ray against a child shape.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **output**: [`RayCastOutput`](/api/interfaces/RayCastOutput)
|
||||
|
||||
The ray-cast results.
|
||||
|
||||
• **input**: [`RayCastInput`](/api/interfaces/RayCastInput)
|
||||
|
||||
The ray-cast input parameters.
|
||||
|
||||
• **xf**: [`Transform`](/api/classes/Transform)
|
||||
|
||||
The transform to be applied to the shape.
|
||||
|
||||
• **childIndex**: `number`
|
||||
|
||||
The child shape index
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`PolygonShape`](/api/classes/PolygonShape).[`rayCast`](/api/classes/PolygonShape#raycast)
|
||||
|
||||
***
|
||||
|
||||
### testPoint()
|
||||
|
||||
> **testPoint**(`xf`, `p`): `boolean`
|
||||
|
||||
Test a point for containment in this shape. This only works for convex
|
||||
shapes.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **xf**: [`TransformValue`](/api/type-aliases/TransformValue)
|
||||
|
||||
The shape world transform.
|
||||
|
||||
• **p**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
A point in world coordinates.
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`PolygonShape`](/api/classes/PolygonShape).[`testPoint`](/api/classes/PolygonShape#testpoint)
|
||||
|
||||
***
|
||||
|
||||
### validate()
|
||||
|
||||
> **validate**(): `boolean`
|
||||
|
||||
Validate convexity. This is a very time consuming operation.
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
true if valid
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`PolygonShape`](/api/classes/PolygonShape).[`validate`](/api/classes/PolygonShape#validate)
|
||||
|
||||
***
|
||||
|
||||
### isValid()
|
||||
|
||||
> `static` **isValid**(`obj`): `boolean`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **obj**: `any`
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`PolygonShape`](/api/classes/PolygonShape).[`isValid`](/api/classes/PolygonShape#isvalid)
|
||||
@ -1,341 +0,0 @@
|
||||
# Class: BroadPhase
|
||||
|
||||
The broad-phase wraps and extends a dynamic-tree to keep track of moved
|
||||
objects and query them on update.
|
||||
|
||||
## Constructors
|
||||
|
||||
### new BroadPhase()
|
||||
|
||||
> **new BroadPhase**(): [`BroadPhase`](/api/classes/BroadPhase)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`BroadPhase`](/api/classes/BroadPhase)
|
||||
|
||||
## Properties
|
||||
|
||||
### m\_callback()
|
||||
|
||||
> **m\_callback**: (`userDataA`, `userDataB`) => `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **userDataA**: `any`
|
||||
|
||||
• **userDataB**: `any`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### m\_moveBuffer
|
||||
|
||||
> **m\_moveBuffer**: `number`[] = `[]`
|
||||
|
||||
***
|
||||
|
||||
### m\_queryProxyId
|
||||
|
||||
> **m\_queryProxyId**: `number`
|
||||
|
||||
***
|
||||
|
||||
### m\_tree
|
||||
|
||||
> **m\_tree**: [`DynamicTree`](/api/classes/DynamicTree)\<[`FixtureProxy`](/api/classes/FixtureProxy)\>
|
||||
|
||||
## Methods
|
||||
|
||||
### bufferMove()
|
||||
|
||||
> **bufferMove**(`proxyId`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **proxyId**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### createProxy()
|
||||
|
||||
> **createProxy**(`aabb`, `userData`): `number`
|
||||
|
||||
Create a proxy with an initial AABB. Pairs are not reported until UpdatePairs
|
||||
is called.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **aabb**: [`AABBValue`](/api/interfaces/AABBValue)
|
||||
|
||||
• **userData**: [`FixtureProxy`](/api/classes/FixtureProxy)
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### destroyProxy()
|
||||
|
||||
> **destroyProxy**(`proxyId`): `void`
|
||||
|
||||
Destroy a proxy. It is up to the client to remove any pairs.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **proxyId**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### getFatAABB()
|
||||
|
||||
> **getFatAABB**(`proxyId`): [`AABB`](/api/classes/AABB)
|
||||
|
||||
Get the fat AABB for a proxy.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **proxyId**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
[`AABB`](/api/classes/AABB)
|
||||
|
||||
***
|
||||
|
||||
### getProxyCount()
|
||||
|
||||
> **getProxyCount**(): `number`
|
||||
|
||||
Get the number of proxies.
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### getTreeBalance()
|
||||
|
||||
> **getTreeBalance**(): `number`
|
||||
|
||||
Get the balance (integer) of the embedded tree.
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### getTreeHeight()
|
||||
|
||||
> **getTreeHeight**(): `number`
|
||||
|
||||
Get the height of the embedded tree.
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### getTreeQuality()
|
||||
|
||||
> **getTreeQuality**(): `number`
|
||||
|
||||
Get the quality metric of the embedded tree.
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### getUserData()
|
||||
|
||||
> **getUserData**(`proxyId`): [`FixtureProxy`](/api/classes/FixtureProxy)
|
||||
|
||||
Get user data from a proxy. Returns null if the id is invalid.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **proxyId**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
[`FixtureProxy`](/api/classes/FixtureProxy)
|
||||
|
||||
***
|
||||
|
||||
### moveProxy()
|
||||
|
||||
> **moveProxy**(`proxyId`, `aabb`, `displacement`): `void`
|
||||
|
||||
Call moveProxy as many times as you like, then when you are done call
|
||||
UpdatePairs to finalized the proxy pairs (for your time step).
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **proxyId**: `number`
|
||||
|
||||
• **aabb**: [`AABB`](/api/classes/AABB)
|
||||
|
||||
• **displacement**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### query()
|
||||
|
||||
> **query**(`aabb`, `queryCallback`): `void`
|
||||
|
||||
Query an AABB for overlapping proxies. The callback class is called for each
|
||||
proxy that overlaps the supplied AABB.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **aabb**: [`AABBValue`](/api/interfaces/AABBValue)
|
||||
|
||||
• **queryCallback**: [`DynamicTreeQueryCallback`](/api/type-aliases/DynamicTreeQueryCallback)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### queryCallback()
|
||||
|
||||
> **queryCallback**(`proxyId`): `boolean`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **proxyId**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
***
|
||||
|
||||
### rayCast()
|
||||
|
||||
> **rayCast**(`input`, `rayCastCallback`): `void`
|
||||
|
||||
Ray-cast against the proxies in the tree. This relies on the callback to
|
||||
perform a exact ray-cast in the case were the proxy contains a shape. The
|
||||
callback also performs the any collision filtering. This has performance
|
||||
roughly equal to k * log(n), where k is the number of collisions and n is the
|
||||
number of proxies in the tree.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **input**: [`RayCastInput`](/api/interfaces/RayCastInput)
|
||||
|
||||
The ray-cast input data. The ray extends from `p1` to `p1 + maxFraction * (p2 - p1)`.
|
||||
|
||||
• **rayCastCallback**: [`RayCastCallback`](/api/type-aliases/RayCastCallback)
|
||||
|
||||
A function that is called for each proxy that is hit by the ray. If the return value is a positive number it will update the maxFraction of the ray cast input, and if it is zero it will terminate they ray cast.
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### shiftOrigin()
|
||||
|
||||
> **shiftOrigin**(`newOrigin`): `void`
|
||||
|
||||
Shift the world origin. Useful for large worlds. The shift formula is:
|
||||
position -= newOrigin
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **newOrigin**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
The new origin with respect to the old origin
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### testOverlap()
|
||||
|
||||
> **testOverlap**(`proxyIdA`, `proxyIdB`): `boolean`
|
||||
|
||||
Test overlap of fat AABBs.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **proxyIdA**: `number`
|
||||
|
||||
• **proxyIdB**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
***
|
||||
|
||||
### touchProxy()
|
||||
|
||||
> **touchProxy**(`proxyId`): `void`
|
||||
|
||||
Call to trigger a re-processing of it's pairs on the next call to
|
||||
UpdatePairs.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **proxyId**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### unbufferMove()
|
||||
|
||||
> **unbufferMove**(`proxyId`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **proxyId**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### updatePairs()
|
||||
|
||||
> **updatePairs**(`addPairCallback`): `void`
|
||||
|
||||
Update the pairs. This results in pair callbacks. This can only add pairs.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **addPairCallback**
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
@ -1,354 +0,0 @@
|
||||
# Class: ChainShape
|
||||
|
||||
A chain shape is a free form sequence of line segments. The chain has
|
||||
two-sided collision, so you can use inside and outside collision. Therefore,
|
||||
you may use any winding order. Connectivity information is used to create
|
||||
smooth collisions.
|
||||
|
||||
WARNING: The chain will not collide properly if there are self-intersections.
|
||||
|
||||
## Extends
|
||||
|
||||
- [`Shape`](/api/classes/Shape)
|
||||
|
||||
## Constructors
|
||||
|
||||
### new ChainShape()
|
||||
|
||||
> **new ChainShape**(`vertices`?, `loop`?): [`ChainShape`](/api/classes/ChainShape)
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **vertices?**: [`Vec2Value`](/api/interfaces/Vec2Value)[]
|
||||
|
||||
• **loop?**: `boolean`
|
||||
|
||||
#### Returns
|
||||
|
||||
[`ChainShape`](/api/classes/ChainShape)
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Shape`](/api/classes/Shape).[`constructor`](/api/classes/Shape#constructors)
|
||||
|
||||
## Properties
|
||||
|
||||
### style
|
||||
|
||||
> **style**: [`Style`](/api/interfaces/Style) = `{}`
|
||||
|
||||
Styling for dev-tools.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Shape`](/api/classes/Shape).[`style`](/api/classes/Shape#style)
|
||||
|
||||
***
|
||||
|
||||
### TYPE
|
||||
|
||||
> `static` **TYPE**: `"chain"`
|
||||
|
||||
## Methods
|
||||
|
||||
### computeAABB()
|
||||
|
||||
> **computeAABB**(`aabb`, `xf`, `childIndex`): `void`
|
||||
|
||||
Given a transform, compute the associated axis aligned bounding box for a
|
||||
child shape.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **aabb**: [`AABBValue`](/api/interfaces/AABBValue)
|
||||
|
||||
Returns the axis aligned box.
|
||||
|
||||
• **xf**: [`TransformValue`](/api/type-aliases/TransformValue)
|
||||
|
||||
The world transform of the shape.
|
||||
|
||||
• **childIndex**: `number`
|
||||
|
||||
The child shape
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Shape`](/api/classes/Shape).[`computeAABB`](/api/classes/Shape#computeaabb)
|
||||
|
||||
***
|
||||
|
||||
### computeDistanceProxy()
|
||||
|
||||
> **computeDistanceProxy**(`proxy`, `childIndex`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **proxy**: [`DistanceProxy`](/api/classes/DistanceProxy)
|
||||
|
||||
• **childIndex**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Shape`](/api/classes/Shape).[`computeDistanceProxy`](/api/classes/Shape#computedistanceproxy)
|
||||
|
||||
***
|
||||
|
||||
### computeMass()
|
||||
|
||||
> **computeMass**(`massData`, `density`?): `void`
|
||||
|
||||
Compute the mass properties of this shape using its dimensions and density.
|
||||
The inertia tensor is computed about the local origin.
|
||||
|
||||
Chains have zero mass.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **massData**: [`MassData`](/api/interfaces/MassData)
|
||||
|
||||
Returns the mass data for this shape.
|
||||
|
||||
• **density?**: `number`
|
||||
|
||||
The density in kilograms per meter squared.
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Shape`](/api/classes/Shape).[`computeMass`](/api/classes/Shape#computemass)
|
||||
|
||||
***
|
||||
|
||||
### getChildCount()
|
||||
|
||||
> **getChildCount**(): `number`
|
||||
|
||||
Get the number of child primitives.
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Shape`](/api/classes/Shape).[`getChildCount`](/api/classes/Shape#getchildcount)
|
||||
|
||||
***
|
||||
|
||||
### getChildEdge()
|
||||
|
||||
> **getChildEdge**(`edge`, `childIndex`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **edge**: [`EdgeShape`](/api/classes/EdgeShape)
|
||||
|
||||
• **childIndex**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### getNextVertex()
|
||||
|
||||
> **getNextVertex**(): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
***
|
||||
|
||||
### getPrevVertex()
|
||||
|
||||
> **getPrevVertex**(): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
***
|
||||
|
||||
### getRadius()
|
||||
|
||||
> **getRadius**(): `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Shape`](/api/classes/Shape).[`getRadius`](/api/classes/Shape#getradius)
|
||||
|
||||
***
|
||||
|
||||
### getType()
|
||||
|
||||
> **getType**(): `"chain"`
|
||||
|
||||
Get the type of this shape. You can use this to down cast to the concrete
|
||||
shape.
|
||||
|
||||
#### Returns
|
||||
|
||||
`"chain"`
|
||||
|
||||
the shape type.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Shape`](/api/classes/Shape).[`getType`](/api/classes/Shape#gettype)
|
||||
|
||||
***
|
||||
|
||||
### getVertex()
|
||||
|
||||
> **getVertex**(`index`): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **index**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
***
|
||||
|
||||
### isLoop()
|
||||
|
||||
> **isLoop**(): `boolean`
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
***
|
||||
|
||||
### rayCast()
|
||||
|
||||
> **rayCast**(`output`, `input`, `xf`, `childIndex`): `boolean`
|
||||
|
||||
Cast a ray against a child shape.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **output**: [`RayCastOutput`](/api/interfaces/RayCastOutput)
|
||||
|
||||
The ray-cast results.
|
||||
|
||||
• **input**: [`RayCastInput`](/api/interfaces/RayCastInput)
|
||||
|
||||
The ray-cast input parameters.
|
||||
|
||||
• **xf**: [`Transform`](/api/classes/Transform)
|
||||
|
||||
The transform to be applied to the shape.
|
||||
|
||||
• **childIndex**: `number`
|
||||
|
||||
The child shape index
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Shape`](/api/classes/Shape).[`rayCast`](/api/classes/Shape#raycast)
|
||||
|
||||
***
|
||||
|
||||
### setNextVertex()
|
||||
|
||||
> **setNextVertex**(`nextVertex`): `void`
|
||||
|
||||
Establish connectivity to a vertex that follows the last vertex. Don't call
|
||||
this for loops.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **nextVertex**: [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### setPrevVertex()
|
||||
|
||||
> **setPrevVertex**(`prevVertex`): `void`
|
||||
|
||||
Establish connectivity to a vertex that precedes the first vertex. Don't call
|
||||
this for loops.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **prevVertex**: [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### testPoint()
|
||||
|
||||
> **testPoint**(`xf`, `p`): `false`
|
||||
|
||||
Test a point for containment in this shape. This only works for convex
|
||||
shapes.
|
||||
|
||||
This always return false.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **xf**: [`TransformValue`](/api/type-aliases/TransformValue)
|
||||
|
||||
The shape world transform.
|
||||
|
||||
• **p**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
A point in world coordinates.
|
||||
|
||||
#### Returns
|
||||
|
||||
`false`
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Shape`](/api/classes/Shape).[`testPoint`](/api/classes/Shape#testpoint)
|
||||
|
||||
***
|
||||
|
||||
### isValid()
|
||||
|
||||
> `static` **isValid**(`obj`): `boolean`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **obj**: `any`
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Shape`](/api/classes/Shape).[`isValid`](/api/classes/Shape#isvalid)
|
||||
@ -1,275 +0,0 @@
|
||||
# Class: CircleShape
|
||||
|
||||
Circle shape.
|
||||
|
||||
## Extends
|
||||
|
||||
- [`Shape`](/api/classes/Shape)
|
||||
|
||||
## Constructors
|
||||
|
||||
### new CircleShape()
|
||||
|
||||
> **new CircleShape**(`position`, `radius`?): [`CircleShape`](/api/classes/CircleShape)
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **position**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
• **radius?**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
[`CircleShape`](/api/classes/CircleShape)
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Shape`](/api/classes/Shape).[`constructor`](/api/classes/Shape#constructors)
|
||||
|
||||
### new CircleShape()
|
||||
|
||||
> **new CircleShape**(`radius`?): [`CircleShape`](/api/classes/CircleShape)
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **radius?**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
[`CircleShape`](/api/classes/CircleShape)
|
||||
|
||||
#### Overrides
|
||||
|
||||
`Shape.constructor`
|
||||
|
||||
## Properties
|
||||
|
||||
### style
|
||||
|
||||
> **style**: [`Style`](/api/interfaces/Style) = `{}`
|
||||
|
||||
Styling for dev-tools.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Shape`](/api/classes/Shape).[`style`](/api/classes/Shape#style)
|
||||
|
||||
***
|
||||
|
||||
### TYPE
|
||||
|
||||
> `static` **TYPE**: `"circle"`
|
||||
|
||||
## Methods
|
||||
|
||||
### computeAABB()
|
||||
|
||||
> **computeAABB**(`aabb`, `xf`, `childIndex`): `void`
|
||||
|
||||
Given a transform, compute the associated axis aligned bounding box for a
|
||||
child shape.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **aabb**: [`AABBValue`](/api/interfaces/AABBValue)
|
||||
|
||||
Returns the axis aligned box.
|
||||
|
||||
• **xf**: [`TransformValue`](/api/type-aliases/TransformValue)
|
||||
|
||||
The world transform of the shape.
|
||||
|
||||
• **childIndex**: `number`
|
||||
|
||||
The child shape
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Shape`](/api/classes/Shape).[`computeAABB`](/api/classes/Shape#computeaabb)
|
||||
|
||||
***
|
||||
|
||||
### computeDistanceProxy()
|
||||
|
||||
> **computeDistanceProxy**(`proxy`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **proxy**: [`DistanceProxy`](/api/classes/DistanceProxy)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Shape`](/api/classes/Shape).[`computeDistanceProxy`](/api/classes/Shape#computedistanceproxy)
|
||||
|
||||
***
|
||||
|
||||
### computeMass()
|
||||
|
||||
> **computeMass**(`massData`, `density`): `void`
|
||||
|
||||
Compute the mass properties of this shape using its dimensions and density.
|
||||
The inertia tensor is computed about the local origin.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **massData**: [`MassData`](/api/interfaces/MassData)
|
||||
|
||||
Returns the mass data for this shape.
|
||||
|
||||
• **density**: `number`
|
||||
|
||||
The density in kilograms per meter squared.
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Shape`](/api/classes/Shape).[`computeMass`](/api/classes/Shape#computemass)
|
||||
|
||||
***
|
||||
|
||||
### getCenter()
|
||||
|
||||
> **getCenter**(): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
***
|
||||
|
||||
### getChildCount()
|
||||
|
||||
> **getChildCount**(): `1`
|
||||
|
||||
Get the number of child primitives.
|
||||
|
||||
#### Returns
|
||||
|
||||
`1`
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Shape`](/api/classes/Shape).[`getChildCount`](/api/classes/Shape#getchildcount)
|
||||
|
||||
***
|
||||
|
||||
### getRadius()
|
||||
|
||||
> **getRadius**(): `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Shape`](/api/classes/Shape).[`getRadius`](/api/classes/Shape#getradius)
|
||||
|
||||
***
|
||||
|
||||
### getType()
|
||||
|
||||
> **getType**(): `"circle"`
|
||||
|
||||
Get the type of this shape. You can use this to down cast to the concrete
|
||||
shape.
|
||||
|
||||
#### Returns
|
||||
|
||||
`"circle"`
|
||||
|
||||
the shape type.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Shape`](/api/classes/Shape).[`getType`](/api/classes/Shape#gettype)
|
||||
|
||||
***
|
||||
|
||||
### rayCast()
|
||||
|
||||
> **rayCast**(`output`, `input`, `xf`, `childIndex`): `boolean`
|
||||
|
||||
Cast a ray against a child shape.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **output**: [`RayCastOutput`](/api/interfaces/RayCastOutput)
|
||||
|
||||
The ray-cast results.
|
||||
|
||||
• **input**: [`RayCastInput`](/api/interfaces/RayCastInput)
|
||||
|
||||
The ray-cast input parameters.
|
||||
|
||||
• **xf**: [`Transform`](/api/classes/Transform)
|
||||
|
||||
The transform to be applied to the shape.
|
||||
|
||||
• **childIndex**: `number`
|
||||
|
||||
The child shape index
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Shape`](/api/classes/Shape).[`rayCast`](/api/classes/Shape#raycast)
|
||||
|
||||
***
|
||||
|
||||
### testPoint()
|
||||
|
||||
> **testPoint**(`xf`, `p`): `boolean`
|
||||
|
||||
Test a point for containment in this shape. This only works for convex
|
||||
shapes.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **xf**: [`TransformValue`](/api/type-aliases/TransformValue)
|
||||
|
||||
The shape world transform.
|
||||
|
||||
• **p**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
A point in world coordinates.
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Shape`](/api/classes/Shape).[`testPoint`](/api/classes/Shape#testpoint)
|
||||
|
||||
***
|
||||
|
||||
### isValid()
|
||||
|
||||
> `static` **isValid**(`obj`): `boolean`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **obj**: `any`
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Shape`](/api/classes/Shape).[`isValid`](/api/classes/Shape#isvalid)
|
||||
@ -1,49 +0,0 @@
|
||||
# Class: ClipVertex
|
||||
|
||||
Used for computing contact manifolds.
|
||||
|
||||
## Constructors
|
||||
|
||||
### new ClipVertex()
|
||||
|
||||
> **new ClipVertex**(): [`ClipVertex`](/api/classes/ClipVertex)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`ClipVertex`](/api/classes/ClipVertex)
|
||||
|
||||
## Properties
|
||||
|
||||
### id
|
||||
|
||||
> **id**: [`ContactID`](/api/classes/ContactID)
|
||||
|
||||
***
|
||||
|
||||
### v
|
||||
|
||||
> **v**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
## Methods
|
||||
|
||||
### recycle()
|
||||
|
||||
> **recycle**(): `void`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### set()
|
||||
|
||||
> **set**(`o`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **o**: [`ClipVertex`](/api/classes/ClipVertex)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
@ -1,415 +0,0 @@
|
||||
# Class: Contact
|
||||
|
||||
The class manages contact between two shapes. A contact exists for each
|
||||
overlapping AABB in the broad-phase (except if filtered). Therefore a contact
|
||||
object may exist that has no contact points.
|
||||
|
||||
## Constructors
|
||||
|
||||
### new Contact()
|
||||
|
||||
> **new Contact**(): [`Contact`](/api/classes/Contact)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Contact`](/api/classes/Contact)
|
||||
|
||||
## Methods
|
||||
|
||||
### evaluate()
|
||||
|
||||
> **evaluate**(`manifold`, `xfA`, `xfB`): `void`
|
||||
|
||||
Called by Update method, and implemented by subclasses.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **manifold**: [`Manifold`](/api/classes/Manifold)
|
||||
|
||||
• **xfA**: [`TransformValue`](/api/type-aliases/TransformValue)
|
||||
|
||||
• **xfB**: [`TransformValue`](/api/type-aliases/TransformValue)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### flagForFiltering()
|
||||
|
||||
> **flagForFiltering**(): `void`
|
||||
|
||||
Flag this contact for filtering. Filtering will occur the next time step.
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### getChildIndexA()
|
||||
|
||||
> **getChildIndexA**(): `number`
|
||||
|
||||
Get the child primitive index for fixture A.
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### getChildIndexB()
|
||||
|
||||
> **getChildIndexB**(): `number`
|
||||
|
||||
Get the child primitive index for fixture B.
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### getFixtureA()
|
||||
|
||||
> **getFixtureA**(): [`Fixture`](/api/classes/Fixture)
|
||||
|
||||
Get fixture A in this contact.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Fixture`](/api/classes/Fixture)
|
||||
|
||||
***
|
||||
|
||||
### getFixtureB()
|
||||
|
||||
> **getFixtureB**(): [`Fixture`](/api/classes/Fixture)
|
||||
|
||||
Get fixture B in this contact.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Fixture`](/api/classes/Fixture)
|
||||
|
||||
***
|
||||
|
||||
### getFriction()
|
||||
|
||||
> **getFriction**(): `number`
|
||||
|
||||
Get the friction.
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### getManifold()
|
||||
|
||||
> **getManifold**(): [`Manifold`](/api/classes/Manifold)
|
||||
|
||||
Get the contact manifold. Do not modify the manifold unless you understand
|
||||
the internals of the library.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Manifold`](/api/classes/Manifold)
|
||||
|
||||
***
|
||||
|
||||
### getNext()
|
||||
|
||||
> **getNext**(): [`Contact`](/api/classes/Contact)
|
||||
|
||||
Get the next contact in the world's contact list.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Contact`](/api/classes/Contact)
|
||||
|
||||
***
|
||||
|
||||
### getRestitution()
|
||||
|
||||
> **getRestitution**(): `number`
|
||||
|
||||
Get the restitution.
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### getTangentSpeed()
|
||||
|
||||
> **getTangentSpeed**(): `number`
|
||||
|
||||
Get the desired tangent speed. In meters per second.
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### getWorldManifold()
|
||||
|
||||
> **getWorldManifold**(`worldManifold`): [`WorldManifold`](/api/classes/WorldManifold)
|
||||
|
||||
Get the world manifold.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **worldManifold**: [`WorldManifold`](/api/classes/WorldManifold)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`WorldManifold`](/api/classes/WorldManifold)
|
||||
|
||||
***
|
||||
|
||||
### initConstraint()
|
||||
|
||||
> **initConstraint**(`step`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **step**: [`TimeStep`](/api/classes/TimeStep)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### initVelocityConstraint()
|
||||
|
||||
> **initVelocityConstraint**(`step`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **step**: [`TimeStep`](/api/classes/TimeStep)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### isEnabled()
|
||||
|
||||
> **isEnabled**(): `boolean`
|
||||
|
||||
Has this contact been disabled?
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
***
|
||||
|
||||
### isTouching()
|
||||
|
||||
> **isTouching**(): `boolean`
|
||||
|
||||
Is this contact touching?
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
***
|
||||
|
||||
### resetFriction()
|
||||
|
||||
> **resetFriction**(): `void`
|
||||
|
||||
Reset the friction mixture to the default value.
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### resetRestitution()
|
||||
|
||||
> **resetRestitution**(): `void`
|
||||
|
||||
Reset the restitution to the default value.
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### setEnabled()
|
||||
|
||||
> **setEnabled**(`flag`): `void`
|
||||
|
||||
Enable/disable this contact. This can be used inside the pre-solve contact
|
||||
listener. The contact is only disabled for the current time step (or sub-step
|
||||
in continuous collisions).
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **flag**: `boolean`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### setFriction()
|
||||
|
||||
> **setFriction**(`friction`): `void`
|
||||
|
||||
Override the default friction mixture. You can call this in
|
||||
"pre-solve" callback. This value persists until set or reset.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **friction**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### setRestitution()
|
||||
|
||||
> **setRestitution**(`restitution`): `void`
|
||||
|
||||
Override the default restitution mixture. You can call this in
|
||||
"pre-solve" callback. The value persists until you set or reset.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **restitution**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### setTangentSpeed()
|
||||
|
||||
> **setTangentSpeed**(`speed`): `void`
|
||||
|
||||
Set the desired tangent speed for a conveyor belt behavior. In meters per
|
||||
second.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **speed**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### solvePositionConstraint()
|
||||
|
||||
> **solvePositionConstraint**(`step`): `number`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **step**: [`TimeStep`](/api/classes/TimeStep)
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### solvePositionConstraintTOI()
|
||||
|
||||
> **solvePositionConstraintTOI**(`step`, `toiA`, `toiB`): `number`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **step**: [`TimeStep`](/api/classes/TimeStep)
|
||||
|
||||
• **toiA**: [`Body`](/api/classes/Body)
|
||||
|
||||
• **toiB**: [`Body`](/api/classes/Body)
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### solveVelocityConstraint()
|
||||
|
||||
> **solveVelocityConstraint**(`step`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **step**: [`TimeStep`](/api/classes/TimeStep)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### storeConstraintImpulses()
|
||||
|
||||
> **storeConstraintImpulses**(`step`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **step**: [`TimeStep`](/api/classes/TimeStep)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### update()
|
||||
|
||||
> **update**(`listener`?): `void`
|
||||
|
||||
Updates the contact manifold and touching status.
|
||||
|
||||
Note: do not assume the fixture AABBs are overlapping or are valid.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **listener?**
|
||||
|
||||
• **listener.beginContact?**
|
||||
|
||||
• **listener.endContact?**
|
||||
|
||||
• **listener.preSolve?**
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### warmStartConstraint()
|
||||
|
||||
> **warmStartConstraint**(`step`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **step**: [`TimeStep`](/api/classes/TimeStep)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
@ -1,44 +0,0 @@
|
||||
# Class: ContactEdge
|
||||
|
||||
A contact edge is used to connect bodies and contacts together in a contact
|
||||
graph where each body is a node and each contact is an edge. A contact edge
|
||||
belongs to a doubly linked list maintained in each attached body. Each
|
||||
contact has two contact nodes, one for each attached body.
|
||||
|
||||
## Constructors
|
||||
|
||||
### new ContactEdge()
|
||||
|
||||
> **new ContactEdge**(`contact`): [`ContactEdge`](/api/classes/ContactEdge)
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **contact**: [`Contact`](/api/classes/Contact)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`ContactEdge`](/api/classes/ContactEdge)
|
||||
|
||||
## Properties
|
||||
|
||||
### contact
|
||||
|
||||
> **contact**: [`Contact`](/api/classes/Contact)
|
||||
|
||||
***
|
||||
|
||||
### next
|
||||
|
||||
> **next**: [`ContactEdge`](/api/classes/ContactEdge) = `null`
|
||||
|
||||
***
|
||||
|
||||
### other
|
||||
|
||||
> **other**: [`Body`](/api/classes/Body) = `null`
|
||||
|
||||
***
|
||||
|
||||
### prev
|
||||
|
||||
> **prev**: [`ContactEdge`](/api/classes/ContactEdge) = `null`
|
||||
@ -1,109 +0,0 @@
|
||||
# Class: ContactID
|
||||
|
||||
Contact ids to facilitate warm starting.
|
||||
|
||||
ContactFeature: The features that intersect to form the contact point.
|
||||
|
||||
## Constructors
|
||||
|
||||
### new ContactID()
|
||||
|
||||
> **new ContactID**(): [`ContactID`](/api/classes/ContactID)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`ContactID`](/api/classes/ContactID)
|
||||
|
||||
## Properties
|
||||
|
||||
### indexA
|
||||
|
||||
> **indexA**: `number` = `-1`
|
||||
|
||||
ContactFeature index on shapeA
|
||||
|
||||
***
|
||||
|
||||
### indexB
|
||||
|
||||
> **indexB**: `number` = `-1`
|
||||
|
||||
ContactFeature index on shapeB
|
||||
|
||||
***
|
||||
|
||||
### key
|
||||
|
||||
> **key**: `number` = `-1`
|
||||
|
||||
Used to quickly compare contact ids.
|
||||
|
||||
***
|
||||
|
||||
### typeA
|
||||
|
||||
> **typeA**: [`ContactFeatureType`](/api/enumerations/ContactFeatureType) = `ContactFeatureType.e_unset`
|
||||
|
||||
ContactFeature type on shapeA
|
||||
|
||||
***
|
||||
|
||||
### typeB
|
||||
|
||||
> **typeB**: [`ContactFeatureType`](/api/enumerations/ContactFeatureType) = `ContactFeatureType.e_unset`
|
||||
|
||||
ContactFeature type on shapeB
|
||||
|
||||
## Methods
|
||||
|
||||
### recycle()
|
||||
|
||||
> **recycle**(): `void`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### set()
|
||||
|
||||
> **set**(`that`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **that**: [`ContactID`](/api/classes/ContactID)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### setFeatures()
|
||||
|
||||
> **setFeatures**(`indexA`, `typeA`, `indexB`, `typeB`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **indexA**: `number`
|
||||
|
||||
• **typeA**: [`ContactFeatureType`](/api/enumerations/ContactFeatureType)
|
||||
|
||||
• **indexB**: `number`
|
||||
|
||||
• **typeB**: [`ContactFeatureType`](/api/enumerations/ContactFeatureType)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### swapFeatures()
|
||||
|
||||
> **swapFeatures**(): `void`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
@ -1,53 +0,0 @@
|
||||
# Class: ContactImpulse
|
||||
|
||||
Contact impulses for reporting. Impulses are used instead of forces because
|
||||
sub-step forces may approach infinity for rigid body collisions. These match
|
||||
up one-to-one with the contact points in Manifold.
|
||||
|
||||
## Constructors
|
||||
|
||||
### new ContactImpulse()
|
||||
|
||||
> **new ContactImpulse**(`contact`): [`ContactImpulse`](/api/classes/ContactImpulse)
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **contact**: [`Contact`](/api/classes/Contact)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`ContactImpulse`](/api/classes/ContactImpulse)
|
||||
|
||||
## Accessors
|
||||
|
||||
### normalImpulses
|
||||
|
||||
#### Get Signature
|
||||
|
||||
> **get** **normalImpulses**(): `number`[]
|
||||
|
||||
##### Returns
|
||||
|
||||
`number`[]
|
||||
|
||||
***
|
||||
|
||||
### tangentImpulses
|
||||
|
||||
#### Get Signature
|
||||
|
||||
> **get** **tangentImpulses**(): `number`[]
|
||||
|
||||
##### Returns
|
||||
|
||||
`number`[]
|
||||
|
||||
## Methods
|
||||
|
||||
### recycle()
|
||||
|
||||
> **recycle**(): `void`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
@ -1,54 +0,0 @@
|
||||
# Class: DistanceInput
|
||||
|
||||
Input for Distance. You have to option to use the shape radii in the
|
||||
computation. Even
|
||||
|
||||
## Constructors
|
||||
|
||||
### new DistanceInput()
|
||||
|
||||
> **new DistanceInput**(): [`DistanceInput`](/api/classes/DistanceInput)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`DistanceInput`](/api/classes/DistanceInput)
|
||||
|
||||
## Properties
|
||||
|
||||
### proxyA
|
||||
|
||||
> `readonly` **proxyA**: [`DistanceProxy`](/api/classes/DistanceProxy)
|
||||
|
||||
***
|
||||
|
||||
### proxyB
|
||||
|
||||
> `readonly` **proxyB**: [`DistanceProxy`](/api/classes/DistanceProxy)
|
||||
|
||||
***
|
||||
|
||||
### transformA
|
||||
|
||||
> `readonly` **transformA**: [`Transform`](/api/classes/Transform)
|
||||
|
||||
***
|
||||
|
||||
### transformB
|
||||
|
||||
> `readonly` **transformB**: [`Transform`](/api/classes/Transform)
|
||||
|
||||
***
|
||||
|
||||
### useRadii
|
||||
|
||||
> **useRadii**: `boolean` = `false`
|
||||
|
||||
## Methods
|
||||
|
||||
### recycle()
|
||||
|
||||
> **recycle**(): `void`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
@ -1,453 +0,0 @@
|
||||
# Class: DistanceJoint
|
||||
|
||||
A distance joint constrains two points on two bodies to remain at a fixed
|
||||
distance from each other. You can view this as a massless, rigid rod.
|
||||
|
||||
## Extends
|
||||
|
||||
- [`Joint`](/api/classes/Joint)
|
||||
|
||||
## Constructors
|
||||
|
||||
### new DistanceJoint()
|
||||
|
||||
> **new DistanceJoint**(`def`): [`DistanceJoint`](/api/classes/DistanceJoint)
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **def**: [`DistanceJointDef`](/api/interfaces/DistanceJointDef)
|
||||
|
||||
DistanceJoint definition.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`DistanceJoint`](/api/classes/DistanceJoint)
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`constructor`](/api/classes/Joint#constructors)
|
||||
|
||||
### new DistanceJoint()
|
||||
|
||||
> **new DistanceJoint**(`def`, `bodyA`, `bodyB`, `anchorA`?, `anchorB`?): [`DistanceJoint`](/api/classes/DistanceJoint)
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **def**: [`DistanceJointOpt`](/api/interfaces/DistanceJointOpt)
|
||||
|
||||
• **bodyA**: [`Body`](/api/classes/Body)
|
||||
|
||||
• **bodyB**: [`Body`](/api/classes/Body)
|
||||
|
||||
• **anchorA?**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
Anchor A in global coordination.
|
||||
|
||||
• **anchorB?**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
Anchor B in global coordination.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`DistanceJoint`](/api/classes/DistanceJoint)
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`constructor`](/api/classes/Joint#constructors)
|
||||
|
||||
## Properties
|
||||
|
||||
### style
|
||||
|
||||
> **style**: [`Style`](/api/interfaces/Style) = `{}`
|
||||
|
||||
Styling for dev-tools.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`style`](/api/classes/Joint#style)
|
||||
|
||||
***
|
||||
|
||||
### TYPE
|
||||
|
||||
> `static` **TYPE**: `"distance-joint"`
|
||||
|
||||
## Methods
|
||||
|
||||
### getAnchorA()
|
||||
|
||||
> **getAnchorA**(): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
Get the anchor point on bodyA in world coordinates.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getAnchorA`](/api/classes/Joint#getanchora)
|
||||
|
||||
***
|
||||
|
||||
### getAnchorB()
|
||||
|
||||
> **getAnchorB**(): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
Get the anchor point on bodyB in world coordinates.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getAnchorB`](/api/classes/Joint#getanchorb)
|
||||
|
||||
***
|
||||
|
||||
### getBodyA()
|
||||
|
||||
> **getBodyA**(): [`Body`](/api/classes/Body)
|
||||
|
||||
Get the first body attached to this joint.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Body`](/api/classes/Body)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getBodyA`](/api/classes/Joint#getbodya)
|
||||
|
||||
***
|
||||
|
||||
### getBodyB()
|
||||
|
||||
> **getBodyB**(): [`Body`](/api/classes/Body)
|
||||
|
||||
Get the second body attached to this joint.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Body`](/api/classes/Body)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getBodyB`](/api/classes/Joint#getbodyb)
|
||||
|
||||
***
|
||||
|
||||
### getCollideConnected()
|
||||
|
||||
> **getCollideConnected**(): `boolean`
|
||||
|
||||
Get collide connected. Note: modifying the collide connect flag won't work
|
||||
correctly because the flag is only checked when fixture AABBs begin to
|
||||
overlap.
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getCollideConnected`](/api/classes/Joint#getcollideconnected)
|
||||
|
||||
***
|
||||
|
||||
### getDampingRatio()
|
||||
|
||||
> **getDampingRatio**(): `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### getFrequency()
|
||||
|
||||
> **getFrequency**(): `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### getLength()
|
||||
|
||||
> **getLength**(): `number`
|
||||
|
||||
Get the natural length.
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### getLocalAnchorA()
|
||||
|
||||
> **getLocalAnchorA**(): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
The local anchor point relative to bodyA's origin.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
***
|
||||
|
||||
### getLocalAnchorB()
|
||||
|
||||
> **getLocalAnchorB**(): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
The local anchor point relative to bodyB's origin.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
***
|
||||
|
||||
### getNext()
|
||||
|
||||
> **getNext**(): [`Joint`](/api/classes/Joint)
|
||||
|
||||
Get the next joint the world joint list.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Joint`](/api/classes/Joint)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getNext`](/api/classes/Joint#getnext)
|
||||
|
||||
***
|
||||
|
||||
### getReactionForce()
|
||||
|
||||
> **getReactionForce**(`inv_dt`): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
Get the reaction force on bodyB at the joint anchor in Newtons.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **inv\_dt**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getReactionForce`](/api/classes/Joint#getreactionforce)
|
||||
|
||||
***
|
||||
|
||||
### getReactionTorque()
|
||||
|
||||
> **getReactionTorque**(`inv_dt`): `number`
|
||||
|
||||
Get the reaction torque on bodyB in N*m.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **inv\_dt**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getReactionTorque`](/api/classes/Joint#getreactiontorque)
|
||||
|
||||
***
|
||||
|
||||
### getType()
|
||||
|
||||
> **getType**(): `string`
|
||||
|
||||
Get the type of the concrete joint.
|
||||
|
||||
#### Returns
|
||||
|
||||
`string`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getType`](/api/classes/Joint#gettype)
|
||||
|
||||
***
|
||||
|
||||
### getUserData()
|
||||
|
||||
> **getUserData**(): `unknown`
|
||||
|
||||
#### Returns
|
||||
|
||||
`unknown`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getUserData`](/api/classes/Joint#getuserdata)
|
||||
|
||||
***
|
||||
|
||||
### initVelocityConstraints()
|
||||
|
||||
> **initVelocityConstraints**(`step`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **step**: [`TimeStep`](/api/classes/TimeStep)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`initVelocityConstraints`](/api/classes/Joint#initvelocityconstraints)
|
||||
|
||||
***
|
||||
|
||||
### isActive()
|
||||
|
||||
> **isActive**(): `boolean`
|
||||
|
||||
Short-cut function to determine if either body is inactive.
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`isActive`](/api/classes/Joint#isactive)
|
||||
|
||||
***
|
||||
|
||||
### setDampingRatio()
|
||||
|
||||
> **setDampingRatio**(`ratio`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **ratio**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### setFrequency()
|
||||
|
||||
> **setFrequency**(`hz`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **hz**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### setLength()
|
||||
|
||||
> **setLength**(`length`): `void`
|
||||
|
||||
Set the natural length. Manipulating the length can lead to non-physical
|
||||
behavior when the frequency is zero.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **length**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### setUserData()
|
||||
|
||||
> **setUserData**(`data`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **data**: `unknown`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`setUserData`](/api/classes/Joint#setuserdata)
|
||||
|
||||
***
|
||||
|
||||
### shiftOrigin()
|
||||
|
||||
> **shiftOrigin**(`newOrigin`): `void`
|
||||
|
||||
Shift the origin for any points stored in world coordinates.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **newOrigin**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`shiftOrigin`](/api/classes/Joint#shiftorigin)
|
||||
|
||||
***
|
||||
|
||||
### solvePositionConstraints()
|
||||
|
||||
> **solvePositionConstraints**(`step`): `boolean`
|
||||
|
||||
This returns true if the position errors are within tolerance.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **step**: [`TimeStep`](/api/classes/TimeStep)
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`solvePositionConstraints`](/api/classes/Joint#solvepositionconstraints)
|
||||
|
||||
***
|
||||
|
||||
### solveVelocityConstraints()
|
||||
|
||||
> **solveVelocityConstraints**(`step`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **step**: [`TimeStep`](/api/classes/TimeStep)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`solveVelocityConstraints`](/api/classes/Joint#solvevelocityconstraints)
|
||||
@ -1,53 +0,0 @@
|
||||
# Class: DistanceOutput
|
||||
|
||||
Output for Distance.
|
||||
|
||||
## Constructors
|
||||
|
||||
### new DistanceOutput()
|
||||
|
||||
> **new DistanceOutput**(): [`DistanceOutput`](/api/classes/DistanceOutput)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`DistanceOutput`](/api/classes/DistanceOutput)
|
||||
|
||||
## Properties
|
||||
|
||||
### distance
|
||||
|
||||
> **distance**: `number` = `0`
|
||||
|
||||
***
|
||||
|
||||
### iterations
|
||||
|
||||
> **iterations**: `number` = `0`
|
||||
|
||||
iterations number of GJK iterations used
|
||||
|
||||
***
|
||||
|
||||
### pointA
|
||||
|
||||
> **pointA**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
closest point on shapeA
|
||||
|
||||
***
|
||||
|
||||
### pointB
|
||||
|
||||
> **pointB**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
closest point on shapeB
|
||||
|
||||
## Methods
|
||||
|
||||
### recycle()
|
||||
|
||||
> **recycle**(): `void`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
@ -1,123 +0,0 @@
|
||||
# Class: DistanceProxy
|
||||
|
||||
A distance proxy is used by the GJK algorithm. It encapsulates any shape.
|
||||
|
||||
## Constructors
|
||||
|
||||
### new DistanceProxy()
|
||||
|
||||
> **new DistanceProxy**(): [`DistanceProxy`](/api/classes/DistanceProxy)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`DistanceProxy`](/api/classes/DistanceProxy)
|
||||
|
||||
## Methods
|
||||
|
||||
### getSupport()
|
||||
|
||||
> **getSupport**(`d`): `number`
|
||||
|
||||
Get the supporting vertex index in the given direction.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **d**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### getSupportVertex()
|
||||
|
||||
> **getSupportVertex**(`d`): [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
Get the supporting vertex in the given direction.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **d**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
***
|
||||
|
||||
### getVertex()
|
||||
|
||||
> **getVertex**(`index`): [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
Get a vertex by index. Used by Distance.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **index**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
***
|
||||
|
||||
### getVertexCount()
|
||||
|
||||
> **getVertexCount**(): `number`
|
||||
|
||||
Get the vertex count.
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### recycle()
|
||||
|
||||
> **recycle**(): `void`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### set()
|
||||
|
||||
> **set**(`shape`, `index`): `void`
|
||||
|
||||
Initialize the proxy using the given shape. The shape must remain in scope
|
||||
while the proxy is in use.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **shape**: [`Shape`](/api/classes/Shape)
|
||||
|
||||
• **index**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### setVertices()
|
||||
|
||||
> **setVertices**(`vertices`, `count`, `radius`): `void`
|
||||
|
||||
Initialize the proxy using a vertex cloud and radius. The vertices
|
||||
must remain in scope while the proxy is in use.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **vertices**: [`Vec2Value`](/api/interfaces/Vec2Value)[]
|
||||
|
||||
• **count**: `number`
|
||||
|
||||
• **radius**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
@ -1,385 +0,0 @@
|
||||
# Class: DynamicTree\<T\>
|
||||
|
||||
A dynamic AABB tree broad-phase, inspired by Nathanael Presson's btDbvt. A
|
||||
dynamic tree arranges data in a binary tree to accelerate queries such as
|
||||
volume queries and ray casts. Leafs are proxies with an AABB. In the tree we
|
||||
expand the proxy AABB by `aabbExtension` so that the proxy AABB is bigger
|
||||
than the client object. This allows the client object to move by small
|
||||
amounts without triggering a tree update.
|
||||
|
||||
Nodes are pooled and relocatable, so we use node indices rather than
|
||||
pointers.
|
||||
|
||||
## Type Parameters
|
||||
|
||||
• **T**
|
||||
|
||||
## Constructors
|
||||
|
||||
### new DynamicTree()
|
||||
|
||||
> **new DynamicTree**\<`T`\>(): [`DynamicTree`](/api/classes/DynamicTree)\<`T`\>
|
||||
|
||||
#### Returns
|
||||
|
||||
[`DynamicTree`](/api/classes/DynamicTree)\<`T`\>
|
||||
|
||||
## Properties
|
||||
|
||||
### m\_lastProxyId
|
||||
|
||||
> **m\_lastProxyId**: `number`
|
||||
|
||||
***
|
||||
|
||||
### m\_nodes
|
||||
|
||||
> **m\_nodes**: `object`
|
||||
|
||||
#### Index Signature
|
||||
|
||||
\[`id`: `number`\]: [`TreeNode`](/api/classes/TreeNode)\<`T`\>
|
||||
|
||||
***
|
||||
|
||||
### m\_root
|
||||
|
||||
> **m\_root**: [`TreeNode`](/api/classes/TreeNode)\<`T`\>
|
||||
|
||||
## Methods
|
||||
|
||||
### allocateNode()
|
||||
|
||||
> **allocateNode**(): [`TreeNode`](/api/classes/TreeNode)\<`T`\>
|
||||
|
||||
#### Returns
|
||||
|
||||
[`TreeNode`](/api/classes/TreeNode)\<`T`\>
|
||||
|
||||
***
|
||||
|
||||
### balance()
|
||||
|
||||
> **balance**(`iA`): [`TreeNode`](/api/classes/TreeNode)\<`T`\>
|
||||
|
||||
Perform a left or right rotation if node A is imbalanced. Returns the new
|
||||
root index.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **iA**: [`TreeNode`](/api/classes/TreeNode)\<`T`\>
|
||||
|
||||
#### Returns
|
||||
|
||||
[`TreeNode`](/api/classes/TreeNode)\<`T`\>
|
||||
|
||||
***
|
||||
|
||||
### computeHeight()
|
||||
|
||||
> **computeHeight**(`id`?): `number`
|
||||
|
||||
Compute the height of a sub-tree.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **id?**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### createProxy()
|
||||
|
||||
> **createProxy**(`aabb`, `userData`): `number`
|
||||
|
||||
Create a proxy in the tree as a leaf node. We return the index of the node
|
||||
instead of a pointer so that we can grow the node pool.
|
||||
|
||||
Create a proxy. Provide a tight fitting AABB and a userData pointer.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **aabb**: [`AABBValue`](/api/interfaces/AABBValue)
|
||||
|
||||
• **userData**: `T`
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### destroyProxy()
|
||||
|
||||
> **destroyProxy**(`id`): `void`
|
||||
|
||||
Destroy a proxy. This asserts if the id is invalid.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **id**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### freeNode()
|
||||
|
||||
> **freeNode**(`node`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **node**: [`TreeNode`](/api/classes/TreeNode)\<`T`\>
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### getAreaRatio()
|
||||
|
||||
> **getAreaRatio**(): `number`
|
||||
|
||||
Get the ratio of the sum of the node areas to the root area.
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### getFatAABB()
|
||||
|
||||
> **getFatAABB**(`id`): [`AABB`](/api/classes/AABB)
|
||||
|
||||
Get the fat AABB for a node id.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **id**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
[`AABB`](/api/classes/AABB)
|
||||
|
||||
the proxy user data or 0 if the id is invalid.
|
||||
|
||||
***
|
||||
|
||||
### getHeight()
|
||||
|
||||
> **getHeight**(): `number`
|
||||
|
||||
Compute the height of the binary tree in O(N) time. Should not be called
|
||||
often.
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### getMaxBalance()
|
||||
|
||||
> **getMaxBalance**(): `number`
|
||||
|
||||
Get the maximum balance of an node in the tree. The balance is the difference
|
||||
in height of the two children of a node.
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### getUserData()
|
||||
|
||||
> **getUserData**(`id`): `T`
|
||||
|
||||
Get proxy user data.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **id**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`T`
|
||||
|
||||
the proxy user data or 0 if the id is invalid.
|
||||
|
||||
***
|
||||
|
||||
### insertLeaf()
|
||||
|
||||
> **insertLeaf**(`leaf`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **leaf**: [`TreeNode`](/api/classes/TreeNode)\<`T`\>
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### moveProxy()
|
||||
|
||||
> **moveProxy**(`id`, `aabb`, `d`): `boolean`
|
||||
|
||||
Move a proxy with a swepted AABB. If the proxy has moved outside of its
|
||||
fattened AABB, then the proxy is removed from the tree and re-inserted.
|
||||
Otherwise the function returns immediately.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **id**: `number`
|
||||
|
||||
• **aabb**: [`AABBValue`](/api/interfaces/AABBValue)
|
||||
|
||||
• **d**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
Displacement
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
true if the proxy was re-inserted.
|
||||
|
||||
***
|
||||
|
||||
### query()
|
||||
|
||||
> **query**(`aabb`, `queryCallback`): `void`
|
||||
|
||||
Query an AABB for overlapping proxies. The callback class is called for each
|
||||
proxy that overlaps the supplied AABB.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **aabb**: [`AABBValue`](/api/interfaces/AABBValue)
|
||||
|
||||
• **queryCallback**: [`DynamicTreeQueryCallback`](/api/type-aliases/DynamicTreeQueryCallback)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### rayCast()
|
||||
|
||||
> **rayCast**(`input`, `rayCastCallback`): `void`
|
||||
|
||||
Ray-cast against the proxies in the tree. This relies on the callback to
|
||||
perform a exact ray-cast in the case were the proxy contains a shape. The
|
||||
callback also performs the any collision filtering. This has performance
|
||||
roughly equal to k * log(n), where k is the number of collisions and n is the
|
||||
number of proxies in the tree.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **input**: [`RayCastInput`](/api/interfaces/RayCastInput)
|
||||
|
||||
The ray-cast input data. The ray extends from `p1` to `p1 + maxFraction * (p2 - p1)`.
|
||||
|
||||
• **rayCastCallback**: [`RayCastCallback`](/api/type-aliases/RayCastCallback)
|
||||
|
||||
A function that is called for each proxy that is hit by the ray. If the return value is a positive number it will update the maxFraction of the ray cast input, and if it is zero it will terminate they ray cast.
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### rebuildBottomUp()
|
||||
|
||||
> **rebuildBottomUp**(): `void`
|
||||
|
||||
Build an optimal tree. Very expensive. For testing.
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### removeLeaf()
|
||||
|
||||
> **removeLeaf**(`leaf`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **leaf**: [`TreeNode`](/api/classes/TreeNode)\<`T`\>
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### shiftOrigin()
|
||||
|
||||
> **shiftOrigin**(`newOrigin`): `void`
|
||||
|
||||
Shift the world origin. Useful for large worlds. The shift formula is:
|
||||
position -= newOrigin
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **newOrigin**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
The new origin with respect to the old origin
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### validate()
|
||||
|
||||
> **validate**(): `void`
|
||||
|
||||
Validate this tree. For testing.
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### validateMetrics()
|
||||
|
||||
> **validateMetrics**(`node`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **node**: [`TreeNode`](/api/classes/TreeNode)\<`T`\>
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### validateStructure()
|
||||
|
||||
> **validateStructure**(`node`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **node**: [`TreeNode`](/api/classes/TreeNode)\<`T`\>
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
@ -1,325 +0,0 @@
|
||||
# Class: EdgeShape
|
||||
|
||||
A line segment (edge) shape. These can be connected in chains or loops to
|
||||
other edge shapes. The connectivity information is used to ensure correct
|
||||
contact normals.
|
||||
|
||||
## Extends
|
||||
|
||||
- [`Shape`](/api/classes/Shape)
|
||||
|
||||
## Constructors
|
||||
|
||||
### new EdgeShape()
|
||||
|
||||
> **new EdgeShape**(`v1`?, `v2`?): [`EdgeShape`](/api/classes/EdgeShape)
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **v1?**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
• **v2?**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`EdgeShape`](/api/classes/EdgeShape)
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Shape`](/api/classes/Shape).[`constructor`](/api/classes/Shape#constructors)
|
||||
|
||||
## Properties
|
||||
|
||||
### style
|
||||
|
||||
> **style**: [`Style`](/api/interfaces/Style) = `{}`
|
||||
|
||||
Styling for dev-tools.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Shape`](/api/classes/Shape).[`style`](/api/classes/Shape#style)
|
||||
|
||||
***
|
||||
|
||||
### TYPE
|
||||
|
||||
> `static` **TYPE**: `"edge"`
|
||||
|
||||
## Methods
|
||||
|
||||
### \_set()
|
||||
|
||||
> **\_set**(`v1`, `v2`): [`EdgeShape`](/api/classes/EdgeShape)
|
||||
|
||||
Set this as an isolated edge.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **v1**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
• **v2**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`EdgeShape`](/api/classes/EdgeShape)
|
||||
|
||||
***
|
||||
|
||||
### computeAABB()
|
||||
|
||||
> **computeAABB**(`aabb`, `xf`, `childIndex`): `void`
|
||||
|
||||
Given a transform, compute the associated axis aligned bounding box for a
|
||||
child shape.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **aabb**: [`AABBValue`](/api/interfaces/AABBValue)
|
||||
|
||||
Returns the axis aligned box.
|
||||
|
||||
• **xf**: [`TransformValue`](/api/type-aliases/TransformValue)
|
||||
|
||||
The world transform of the shape.
|
||||
|
||||
• **childIndex**: `number`
|
||||
|
||||
The child shape
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Shape`](/api/classes/Shape).[`computeAABB`](/api/classes/Shape#computeaabb)
|
||||
|
||||
***
|
||||
|
||||
### computeDistanceProxy()
|
||||
|
||||
> **computeDistanceProxy**(`proxy`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **proxy**: [`DistanceProxy`](/api/classes/DistanceProxy)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Shape`](/api/classes/Shape).[`computeDistanceProxy`](/api/classes/Shape#computedistanceproxy)
|
||||
|
||||
***
|
||||
|
||||
### computeMass()
|
||||
|
||||
> **computeMass**(`massData`, `density`?): `void`
|
||||
|
||||
Compute the mass properties of this shape using its dimensions and density.
|
||||
The inertia tensor is computed about the local origin.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **massData**: [`MassData`](/api/interfaces/MassData)
|
||||
|
||||
Returns the mass data for this shape.
|
||||
|
||||
• **density?**: `number`
|
||||
|
||||
The density in kilograms per meter squared.
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Shape`](/api/classes/Shape).[`computeMass`](/api/classes/Shape#computemass)
|
||||
|
||||
***
|
||||
|
||||
### getChildCount()
|
||||
|
||||
> **getChildCount**(): `1`
|
||||
|
||||
Get the number of child primitives.
|
||||
|
||||
#### Returns
|
||||
|
||||
`1`
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Shape`](/api/classes/Shape).[`getChildCount`](/api/classes/Shape#getchildcount)
|
||||
|
||||
***
|
||||
|
||||
### getNextVertex()
|
||||
|
||||
> **getNextVertex**(): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
Optional next vertex, used for smooth collision.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
***
|
||||
|
||||
### getPrevVertex()
|
||||
|
||||
> **getPrevVertex**(): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
Optional prev vertex, used for smooth collision.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
***
|
||||
|
||||
### getRadius()
|
||||
|
||||
> **getRadius**(): `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Shape`](/api/classes/Shape).[`getRadius`](/api/classes/Shape#getradius)
|
||||
|
||||
***
|
||||
|
||||
### getType()
|
||||
|
||||
> **getType**(): `"edge"`
|
||||
|
||||
Get the type of this shape. You can use this to down cast to the concrete
|
||||
shape.
|
||||
|
||||
#### Returns
|
||||
|
||||
`"edge"`
|
||||
|
||||
the shape type.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Shape`](/api/classes/Shape).[`getType`](/api/classes/Shape#gettype)
|
||||
|
||||
***
|
||||
|
||||
### rayCast()
|
||||
|
||||
> **rayCast**(`output`, `input`, `xf`, `childIndex`): `boolean`
|
||||
|
||||
Cast a ray against a child shape.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **output**: [`RayCastOutput`](/api/interfaces/RayCastOutput)
|
||||
|
||||
The ray-cast results.
|
||||
|
||||
• **input**: [`RayCastInput`](/api/interfaces/RayCastInput)
|
||||
|
||||
The ray-cast input parameters.
|
||||
|
||||
• **xf**: [`Transform`](/api/classes/Transform)
|
||||
|
||||
The transform to be applied to the shape.
|
||||
|
||||
• **childIndex**: `number`
|
||||
|
||||
The child shape index
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Shape`](/api/classes/Shape).[`rayCast`](/api/classes/Shape#raycast)
|
||||
|
||||
***
|
||||
|
||||
### setNextVertex()
|
||||
|
||||
> **setNextVertex**(`v`?): [`EdgeShape`](/api/classes/EdgeShape)
|
||||
|
||||
Optional next vertex, used for smooth collision.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **v?**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`EdgeShape`](/api/classes/EdgeShape)
|
||||
|
||||
***
|
||||
|
||||
### setPrevVertex()
|
||||
|
||||
> **setPrevVertex**(`v`?): [`EdgeShape`](/api/classes/EdgeShape)
|
||||
|
||||
Optional prev vertex, used for smooth collision.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **v?**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`EdgeShape`](/api/classes/EdgeShape)
|
||||
|
||||
***
|
||||
|
||||
### testPoint()
|
||||
|
||||
> **testPoint**(`xf`, `p`): `false`
|
||||
|
||||
Test a point for containment in this shape. This only works for convex
|
||||
shapes.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **xf**: [`TransformValue`](/api/type-aliases/TransformValue)
|
||||
|
||||
The shape world transform.
|
||||
|
||||
• **p**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
A point in world coordinates.
|
||||
|
||||
#### Returns
|
||||
|
||||
`false`
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Shape`](/api/classes/Shape).[`testPoint`](/api/classes/Shape#testpoint)
|
||||
|
||||
***
|
||||
|
||||
### isValid()
|
||||
|
||||
> `static` **isValid**(`obj`): `boolean`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **obj**: `any`
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Shape`](/api/classes/Shape).[`isValid`](/api/classes/Shape#isvalid)
|
||||
@ -1,468 +0,0 @@
|
||||
# Class: Fixture
|
||||
|
||||
A fixture is used to attach a shape to a body for collision detection. A
|
||||
fixture inherits its transform from its parent. Fixtures hold additional
|
||||
non-geometric data such as friction, collision filters, etc.
|
||||
|
||||
To create a new Fixture use [Body.createFixture](/api/classes/Body#createfixture).
|
||||
|
||||
## Properties
|
||||
|
||||
### style
|
||||
|
||||
> **style**: [`Style`](/api/interfaces/Style) = `{}`
|
||||
|
||||
Styling for dev-tools.
|
||||
|
||||
## Methods
|
||||
|
||||
### createProxies()
|
||||
|
||||
> **createProxies**(`broadPhase`, `xf`): `void`
|
||||
|
||||
These support body activation/deactivation.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **broadPhase**: [`BroadPhase`](/api/classes/BroadPhase)
|
||||
|
||||
• **xf**: [`TransformValue`](/api/type-aliases/TransformValue)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### destroyProxies()
|
||||
|
||||
> **destroyProxies**(`broadPhase`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **broadPhase**: [`BroadPhase`](/api/classes/BroadPhase)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### getAABB()
|
||||
|
||||
> **getAABB**(`childIndex`): [`AABB`](/api/classes/AABB)
|
||||
|
||||
Get the fixture's AABB. This AABB may be enlarge and/or stale. If you need a
|
||||
more accurate AABB, compute it using the shape and the body transform.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **childIndex**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
[`AABB`](/api/classes/AABB)
|
||||
|
||||
***
|
||||
|
||||
### getBody()
|
||||
|
||||
> **getBody**(): [`Body`](/api/classes/Body)
|
||||
|
||||
Get the parent body of this fixture. This is null if the fixture is not
|
||||
attached.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Body`](/api/classes/Body)
|
||||
|
||||
***
|
||||
|
||||
### getDensity()
|
||||
|
||||
> **getDensity**(): `number`
|
||||
|
||||
Get the density of this fixture.
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### getFilterCategoryBits()
|
||||
|
||||
> **getFilterCategoryBits**(): `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### getFilterGroupIndex()
|
||||
|
||||
> **getFilterGroupIndex**(): `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### getFilterMaskBits()
|
||||
|
||||
> **getFilterMaskBits**(): `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### getFriction()
|
||||
|
||||
> **getFriction**(): `number`
|
||||
|
||||
Get the coefficient of friction, usually in the range [0,1].
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### getMassData()
|
||||
|
||||
> **getMassData**(`massData`): `void`
|
||||
|
||||
Get the mass data for this fixture. The mass data is based on the density and
|
||||
the shape. The rotational inertia is about the shape's origin. This operation
|
||||
may be expensive.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **massData**: [`MassData`](/api/interfaces/MassData)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### getNext()
|
||||
|
||||
> **getNext**(): [`Fixture`](/api/classes/Fixture)
|
||||
|
||||
Get the next fixture in the parent body's fixture list.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Fixture`](/api/classes/Fixture)
|
||||
|
||||
***
|
||||
|
||||
### getRestitution()
|
||||
|
||||
> **getRestitution**(): `number`
|
||||
|
||||
Get the coefficient of restitution.
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### getShape()
|
||||
|
||||
> **getShape**(): [`Shape`](/api/classes/Shape)
|
||||
|
||||
Get the child shape. You can modify the child shape, however you should not
|
||||
change the number of vertices because this will crash some collision caching
|
||||
mechanisms. Manipulating the shape may lead to non-physical behavior.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Shape`](/api/classes/Shape)
|
||||
|
||||
***
|
||||
|
||||
### getType()
|
||||
|
||||
> **getType**(): [`ShapeType`](/api/type-aliases/ShapeType)
|
||||
|
||||
Get the type of the child shape. You can use this to down cast to the
|
||||
concrete shape.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`ShapeType`](/api/type-aliases/ShapeType)
|
||||
|
||||
***
|
||||
|
||||
### getUserData()
|
||||
|
||||
> **getUserData**(): `unknown`
|
||||
|
||||
Get the user data that was assigned in the fixture definition. Use this to
|
||||
store your application specific data.
|
||||
|
||||
#### Returns
|
||||
|
||||
`unknown`
|
||||
|
||||
***
|
||||
|
||||
### isSensor()
|
||||
|
||||
> **isSensor**(): `boolean`
|
||||
|
||||
A sensor shape collects contact information but never generates a collision
|
||||
response.
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
***
|
||||
|
||||
### rayCast()
|
||||
|
||||
> **rayCast**(`output`, `input`, `childIndex`): `boolean`
|
||||
|
||||
Cast a ray against this shape.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **output**: [`RayCastOutput`](/api/interfaces/RayCastOutput)
|
||||
|
||||
• **input**: [`RayCastInput`](/api/interfaces/RayCastInput)
|
||||
|
||||
• **childIndex**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
***
|
||||
|
||||
### refilter()
|
||||
|
||||
> **refilter**(): `void`
|
||||
|
||||
Call this if you want to establish collision that was previously disabled by
|
||||
ContactFilter.
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### setDensity()
|
||||
|
||||
> **setDensity**(`density`): `void`
|
||||
|
||||
Set the density of this fixture. This will _not_ automatically adjust the
|
||||
mass of the body. You must call Body.resetMassData to update the body's mass.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **density**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### setFilterCategoryBits()
|
||||
|
||||
> **setFilterCategoryBits**(`categoryBits`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **categoryBits**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### setFilterData()
|
||||
|
||||
> **setFilterData**(`filter`): `void`
|
||||
|
||||
Set the contact filtering data. This will not update contacts until the next
|
||||
time step when either parent body is active and awake. This automatically
|
||||
calls refilter.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **filter**
|
||||
|
||||
• **filter.categoryBits**: `number`
|
||||
|
||||
• **filter.groupIndex**: `number`
|
||||
|
||||
• **filter.maskBits**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### setFilterGroupIndex()
|
||||
|
||||
> **setFilterGroupIndex**(`groupIndex`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **groupIndex**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### setFilterMaskBits()
|
||||
|
||||
> **setFilterMaskBits**(`maskBits`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **maskBits**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### setFriction()
|
||||
|
||||
> **setFriction**(`friction`): `void`
|
||||
|
||||
Set the coefficient of friction. This will not change the friction of
|
||||
existing contacts.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **friction**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### setRestitution()
|
||||
|
||||
> **setRestitution**(`restitution`): `void`
|
||||
|
||||
Set the coefficient of restitution. This will not change the restitution of
|
||||
existing contacts.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **restitution**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### setSensor()
|
||||
|
||||
> **setSensor**(`sensor`): `void`
|
||||
|
||||
Set if this fixture is a sensor.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **sensor**: `boolean`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### setUserData()
|
||||
|
||||
> **setUserData**(`data`): `void`
|
||||
|
||||
Set the user data. Use this to store your application specific data.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **data**: `unknown`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### shouldCollide()
|
||||
|
||||
> **shouldCollide**(`that`): `boolean`
|
||||
|
||||
Implement this method to provide collision filtering, if you want finer
|
||||
control over contact creation.
|
||||
|
||||
Return true if contact calculations should be performed between these two
|
||||
fixtures.
|
||||
|
||||
Warning: for performance reasons this is only called when the AABBs begin to
|
||||
overlap.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **that**: [`Fixture`](/api/classes/Fixture)
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
***
|
||||
|
||||
### synchronize()
|
||||
|
||||
> **synchronize**(`broadPhase`, `xf1`, `xf2`): `void`
|
||||
|
||||
Updates this fixture proxy in broad-phase (with combined AABB of current and
|
||||
next transformation).
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **broadPhase**: [`BroadPhase`](/api/classes/BroadPhase)
|
||||
|
||||
• **xf1**: [`TransformValue`](/api/type-aliases/TransformValue)
|
||||
|
||||
• **xf2**: [`TransformValue`](/api/type-aliases/TransformValue)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### testPoint()
|
||||
|
||||
> **testPoint**(`p`): `boolean`
|
||||
|
||||
Test a point in world coordinates for containment in this fixture.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **p**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
@ -1,43 +0,0 @@
|
||||
# Class: FixtureProxy
|
||||
|
||||
This proxy is used internally to connect shape children to the broad-phase.
|
||||
|
||||
## Constructors
|
||||
|
||||
### new FixtureProxy()
|
||||
|
||||
> **new FixtureProxy**(`fixture`, `childIndex`): [`FixtureProxy`](/api/classes/FixtureProxy)
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **fixture**: [`Fixture`](/api/classes/Fixture)
|
||||
|
||||
• **childIndex**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
[`FixtureProxy`](/api/classes/FixtureProxy)
|
||||
|
||||
## Properties
|
||||
|
||||
### aabb
|
||||
|
||||
> **aabb**: [`AABB`](/api/classes/AABB)
|
||||
|
||||
***
|
||||
|
||||
### childIndex
|
||||
|
||||
> **childIndex**: `number`
|
||||
|
||||
***
|
||||
|
||||
### fixture
|
||||
|
||||
> **fixture**: [`Fixture`](/api/classes/Fixture)
|
||||
|
||||
***
|
||||
|
||||
### proxyId
|
||||
|
||||
> **proxyId**: `number`
|
||||
@ -1,426 +0,0 @@
|
||||
# Class: FrictionJoint
|
||||
|
||||
Friction joint. This is used for top-down friction. It provides 2D
|
||||
translational friction and angular friction.
|
||||
|
||||
## Extends
|
||||
|
||||
- [`Joint`](/api/classes/Joint)
|
||||
|
||||
## Constructors
|
||||
|
||||
### new FrictionJoint()
|
||||
|
||||
> **new FrictionJoint**(`def`): [`FrictionJoint`](/api/classes/FrictionJoint)
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **def**: [`FrictionJointDef`](/api/interfaces/FrictionJointDef)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`FrictionJoint`](/api/classes/FrictionJoint)
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`constructor`](/api/classes/Joint#constructors)
|
||||
|
||||
### new FrictionJoint()
|
||||
|
||||
> **new FrictionJoint**(`def`, `bodyA`, `bodyB`, `anchor`?): [`FrictionJoint`](/api/classes/FrictionJoint)
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **def**: [`FrictionJointOpt`](/api/interfaces/FrictionJointOpt)
|
||||
|
||||
• **bodyA**: [`Body`](/api/classes/Body)
|
||||
|
||||
• **bodyB**: [`Body`](/api/classes/Body)
|
||||
|
||||
• **anchor?**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
Anchor in global coordination.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`FrictionJoint`](/api/classes/FrictionJoint)
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`constructor`](/api/classes/Joint#constructors)
|
||||
|
||||
## Properties
|
||||
|
||||
### style
|
||||
|
||||
> **style**: [`Style`](/api/interfaces/Style) = `{}`
|
||||
|
||||
Styling for dev-tools.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`style`](/api/classes/Joint#style)
|
||||
|
||||
***
|
||||
|
||||
### TYPE
|
||||
|
||||
> `static` **TYPE**: `"friction-joint"`
|
||||
|
||||
## Methods
|
||||
|
||||
### getAnchorA()
|
||||
|
||||
> **getAnchorA**(): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
Get the anchor point on bodyA in world coordinates.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getAnchorA`](/api/classes/Joint#getanchora)
|
||||
|
||||
***
|
||||
|
||||
### getAnchorB()
|
||||
|
||||
> **getAnchorB**(): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
Get the anchor point on bodyB in world coordinates.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getAnchorB`](/api/classes/Joint#getanchorb)
|
||||
|
||||
***
|
||||
|
||||
### getBodyA()
|
||||
|
||||
> **getBodyA**(): [`Body`](/api/classes/Body)
|
||||
|
||||
Get the first body attached to this joint.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Body`](/api/classes/Body)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getBodyA`](/api/classes/Joint#getbodya)
|
||||
|
||||
***
|
||||
|
||||
### getBodyB()
|
||||
|
||||
> **getBodyB**(): [`Body`](/api/classes/Body)
|
||||
|
||||
Get the second body attached to this joint.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Body`](/api/classes/Body)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getBodyB`](/api/classes/Joint#getbodyb)
|
||||
|
||||
***
|
||||
|
||||
### getCollideConnected()
|
||||
|
||||
> **getCollideConnected**(): `boolean`
|
||||
|
||||
Get collide connected. Note: modifying the collide connect flag won't work
|
||||
correctly because the flag is only checked when fixture AABBs begin to
|
||||
overlap.
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getCollideConnected`](/api/classes/Joint#getcollideconnected)
|
||||
|
||||
***
|
||||
|
||||
### getLocalAnchorA()
|
||||
|
||||
> **getLocalAnchorA**(): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
The local anchor point relative to bodyA's origin.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
***
|
||||
|
||||
### getLocalAnchorB()
|
||||
|
||||
> **getLocalAnchorB**(): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
The local anchor point relative to bodyB's origin.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
***
|
||||
|
||||
### getMaxForce()
|
||||
|
||||
> **getMaxForce**(): `number`
|
||||
|
||||
Get the maximum friction force in N.
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### getMaxTorque()
|
||||
|
||||
> **getMaxTorque**(): `number`
|
||||
|
||||
Get the maximum friction torque in N*m.
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### getNext()
|
||||
|
||||
> **getNext**(): [`Joint`](/api/classes/Joint)
|
||||
|
||||
Get the next joint the world joint list.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Joint`](/api/classes/Joint)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getNext`](/api/classes/Joint#getnext)
|
||||
|
||||
***
|
||||
|
||||
### getReactionForce()
|
||||
|
||||
> **getReactionForce**(`inv_dt`): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
Get the reaction force on bodyB at the joint anchor in Newtons.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **inv\_dt**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getReactionForce`](/api/classes/Joint#getreactionforce)
|
||||
|
||||
***
|
||||
|
||||
### getReactionTorque()
|
||||
|
||||
> **getReactionTorque**(`inv_dt`): `number`
|
||||
|
||||
Get the reaction torque on bodyB in N*m.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **inv\_dt**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getReactionTorque`](/api/classes/Joint#getreactiontorque)
|
||||
|
||||
***
|
||||
|
||||
### getType()
|
||||
|
||||
> **getType**(): `string`
|
||||
|
||||
Get the type of the concrete joint.
|
||||
|
||||
#### Returns
|
||||
|
||||
`string`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getType`](/api/classes/Joint#gettype)
|
||||
|
||||
***
|
||||
|
||||
### getUserData()
|
||||
|
||||
> **getUserData**(): `unknown`
|
||||
|
||||
#### Returns
|
||||
|
||||
`unknown`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getUserData`](/api/classes/Joint#getuserdata)
|
||||
|
||||
***
|
||||
|
||||
### initVelocityConstraints()
|
||||
|
||||
> **initVelocityConstraints**(`step`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **step**: [`TimeStep`](/api/classes/TimeStep)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`initVelocityConstraints`](/api/classes/Joint#initvelocityconstraints)
|
||||
|
||||
***
|
||||
|
||||
### isActive()
|
||||
|
||||
> **isActive**(): `boolean`
|
||||
|
||||
Short-cut function to determine if either body is inactive.
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`isActive`](/api/classes/Joint#isactive)
|
||||
|
||||
***
|
||||
|
||||
### setMaxForce()
|
||||
|
||||
> **setMaxForce**(`force`): `void`
|
||||
|
||||
Set the maximum friction force in N.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **force**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### setMaxTorque()
|
||||
|
||||
> **setMaxTorque**(`torque`): `void`
|
||||
|
||||
Set the maximum friction torque in N*m.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **torque**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### setUserData()
|
||||
|
||||
> **setUserData**(`data`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **data**: `unknown`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`setUserData`](/api/classes/Joint#setuserdata)
|
||||
|
||||
***
|
||||
|
||||
### shiftOrigin()
|
||||
|
||||
> **shiftOrigin**(`newOrigin`): `void`
|
||||
|
||||
Shift the origin for any points stored in world coordinates.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **newOrigin**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`shiftOrigin`](/api/classes/Joint#shiftorigin)
|
||||
|
||||
***
|
||||
|
||||
### solvePositionConstraints()
|
||||
|
||||
> **solvePositionConstraints**(`step`): `boolean`
|
||||
|
||||
This returns true if the position errors are within tolerance.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **step**: [`TimeStep`](/api/classes/TimeStep)
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`solvePositionConstraints`](/api/classes/Joint#solvepositionconstraints)
|
||||
|
||||
***
|
||||
|
||||
### solveVelocityConstraints()
|
||||
|
||||
> **solveVelocityConstraints**(`step`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **step**: [`TimeStep`](/api/classes/TimeStep)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`solveVelocityConstraints`](/api/classes/Joint#solvevelocityconstraints)
|
||||
@ -1,409 +0,0 @@
|
||||
# Class: GearJoint
|
||||
|
||||
A gear joint is used to connect two joints together. Either joint can be a
|
||||
revolute or prismatic joint. You specify a gear ratio to bind the motions
|
||||
together: coordinate1 + ratio * coordinate2 = constant
|
||||
|
||||
The ratio can be negative or positive. If one joint is a revolute joint and
|
||||
the other joint is a prismatic joint, then the ratio will have units of
|
||||
length or units of 1/length. Warning: You have to manually destroy the gear
|
||||
joint if joint1 or joint2 is destroyed.
|
||||
|
||||
This definition requires two existing revolute or prismatic joints (any
|
||||
combination will work).
|
||||
|
||||
## Extends
|
||||
|
||||
- [`Joint`](/api/classes/Joint)
|
||||
|
||||
## Constructors
|
||||
|
||||
### new GearJoint()
|
||||
|
||||
> **new GearJoint**(`def`): [`GearJoint`](/api/classes/GearJoint)
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **def**: [`GearJointDef`](/api/interfaces/GearJointDef)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`GearJoint`](/api/classes/GearJoint)
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`constructor`](/api/classes/Joint#constructors)
|
||||
|
||||
### new GearJoint()
|
||||
|
||||
> **new GearJoint**(`def`, `bodyA`, `bodyB`, `joint1`, `joint2`, `ratio`?): [`GearJoint`](/api/classes/GearJoint)
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **def**: [`GearJointOpt`](/api/interfaces/GearJointOpt)
|
||||
|
||||
• **bodyA**: [`Body`](/api/classes/Body)
|
||||
|
||||
• **bodyB**: [`Body`](/api/classes/Body)
|
||||
|
||||
• **joint1**: [`RevoluteJoint`](/api/classes/RevoluteJoint) \| [`PrismaticJoint`](/api/classes/PrismaticJoint)
|
||||
|
||||
• **joint2**: [`RevoluteJoint`](/api/classes/RevoluteJoint) \| [`PrismaticJoint`](/api/classes/PrismaticJoint)
|
||||
|
||||
• **ratio?**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
[`GearJoint`](/api/classes/GearJoint)
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`constructor`](/api/classes/Joint#constructors)
|
||||
|
||||
## Properties
|
||||
|
||||
### style
|
||||
|
||||
> **style**: [`Style`](/api/interfaces/Style) = `{}`
|
||||
|
||||
Styling for dev-tools.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`style`](/api/classes/Joint#style)
|
||||
|
||||
***
|
||||
|
||||
### TYPE
|
||||
|
||||
> `static` **TYPE**: `"gear-joint"`
|
||||
|
||||
## Methods
|
||||
|
||||
### getAnchorA()
|
||||
|
||||
> **getAnchorA**(): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
Get the anchor point on bodyA in world coordinates.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getAnchorA`](/api/classes/Joint#getanchora)
|
||||
|
||||
***
|
||||
|
||||
### getAnchorB()
|
||||
|
||||
> **getAnchorB**(): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
Get the anchor point on bodyB in world coordinates.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getAnchorB`](/api/classes/Joint#getanchorb)
|
||||
|
||||
***
|
||||
|
||||
### getBodyA()
|
||||
|
||||
> **getBodyA**(): [`Body`](/api/classes/Body)
|
||||
|
||||
Get the first body attached to this joint.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Body`](/api/classes/Body)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getBodyA`](/api/classes/Joint#getbodya)
|
||||
|
||||
***
|
||||
|
||||
### getBodyB()
|
||||
|
||||
> **getBodyB**(): [`Body`](/api/classes/Body)
|
||||
|
||||
Get the second body attached to this joint.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Body`](/api/classes/Body)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getBodyB`](/api/classes/Joint#getbodyb)
|
||||
|
||||
***
|
||||
|
||||
### getCollideConnected()
|
||||
|
||||
> **getCollideConnected**(): `boolean`
|
||||
|
||||
Get collide connected. Note: modifying the collide connect flag won't work
|
||||
correctly because the flag is only checked when fixture AABBs begin to
|
||||
overlap.
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getCollideConnected`](/api/classes/Joint#getcollideconnected)
|
||||
|
||||
***
|
||||
|
||||
### getJoint1()
|
||||
|
||||
> **getJoint1**(): [`Joint`](/api/classes/Joint)
|
||||
|
||||
Get the first joint.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Joint`](/api/classes/Joint)
|
||||
|
||||
***
|
||||
|
||||
### getJoint2()
|
||||
|
||||
> **getJoint2**(): [`Joint`](/api/classes/Joint)
|
||||
|
||||
Get the second joint.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Joint`](/api/classes/Joint)
|
||||
|
||||
***
|
||||
|
||||
### getNext()
|
||||
|
||||
> **getNext**(): [`Joint`](/api/classes/Joint)
|
||||
|
||||
Get the next joint the world joint list.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Joint`](/api/classes/Joint)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getNext`](/api/classes/Joint#getnext)
|
||||
|
||||
***
|
||||
|
||||
### getRatio()
|
||||
|
||||
> **getRatio**(): `number`
|
||||
|
||||
Get the gear ratio.
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### getReactionForce()
|
||||
|
||||
> **getReactionForce**(`inv_dt`): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
Get the reaction force on bodyB at the joint anchor in Newtons.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **inv\_dt**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getReactionForce`](/api/classes/Joint#getreactionforce)
|
||||
|
||||
***
|
||||
|
||||
### getReactionTorque()
|
||||
|
||||
> **getReactionTorque**(`inv_dt`): `number`
|
||||
|
||||
Get the reaction torque on bodyB in N*m.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **inv\_dt**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getReactionTorque`](/api/classes/Joint#getreactiontorque)
|
||||
|
||||
***
|
||||
|
||||
### getType()
|
||||
|
||||
> **getType**(): `string`
|
||||
|
||||
Get the type of the concrete joint.
|
||||
|
||||
#### Returns
|
||||
|
||||
`string`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getType`](/api/classes/Joint#gettype)
|
||||
|
||||
***
|
||||
|
||||
### getUserData()
|
||||
|
||||
> **getUserData**(): `unknown`
|
||||
|
||||
#### Returns
|
||||
|
||||
`unknown`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getUserData`](/api/classes/Joint#getuserdata)
|
||||
|
||||
***
|
||||
|
||||
### initVelocityConstraints()
|
||||
|
||||
> **initVelocityConstraints**(`step`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **step**: [`TimeStep`](/api/classes/TimeStep)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`initVelocityConstraints`](/api/classes/Joint#initvelocityconstraints)
|
||||
|
||||
***
|
||||
|
||||
### isActive()
|
||||
|
||||
> **isActive**(): `boolean`
|
||||
|
||||
Short-cut function to determine if either body is inactive.
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`isActive`](/api/classes/Joint#isactive)
|
||||
|
||||
***
|
||||
|
||||
### setRatio()
|
||||
|
||||
> **setRatio**(`ratio`): `void`
|
||||
|
||||
Set the gear ratio.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **ratio**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### setUserData()
|
||||
|
||||
> **setUserData**(`data`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **data**: `unknown`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`setUserData`](/api/classes/Joint#setuserdata)
|
||||
|
||||
***
|
||||
|
||||
### shiftOrigin()
|
||||
|
||||
> **shiftOrigin**(`newOrigin`): `void`
|
||||
|
||||
Shift the origin for any points stored in world coordinates.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **newOrigin**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`shiftOrigin`](/api/classes/Joint#shiftorigin)
|
||||
|
||||
***
|
||||
|
||||
### solvePositionConstraints()
|
||||
|
||||
> **solvePositionConstraints**(`step`): `boolean`
|
||||
|
||||
This returns true if the position errors are within tolerance.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **step**: [`TimeStep`](/api/classes/TimeStep)
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`solvePositionConstraints`](/api/classes/Joint#solvepositionconstraints)
|
||||
|
||||
***
|
||||
|
||||
### solveVelocityConstraints()
|
||||
|
||||
> **solveVelocityConstraints**(`step`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **step**: [`TimeStep`](/api/classes/TimeStep)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`solveVelocityConstraints`](/api/classes/Joint#solvevelocityconstraints)
|
||||
@ -1,270 +0,0 @@
|
||||
# Class: `abstract` Joint
|
||||
|
||||
The base joint class. Joints are used to constraint two bodies together in
|
||||
various fashions. Some joints also feature limits and motors.
|
||||
|
||||
## Extended by
|
||||
|
||||
- [`DistanceJoint`](/api/classes/DistanceJoint)
|
||||
- [`FrictionJoint`](/api/classes/FrictionJoint)
|
||||
- [`GearJoint`](/api/classes/GearJoint)
|
||||
- [`MotorJoint`](/api/classes/MotorJoint)
|
||||
- [`MouseJoint`](/api/classes/MouseJoint)
|
||||
- [`PrismaticJoint`](/api/classes/PrismaticJoint)
|
||||
- [`PulleyJoint`](/api/classes/PulleyJoint)
|
||||
- [`RevoluteJoint`](/api/classes/RevoluteJoint)
|
||||
- [`RopeJoint`](/api/classes/RopeJoint)
|
||||
- [`WeldJoint`](/api/classes/WeldJoint)
|
||||
- [`WheelJoint`](/api/classes/WheelJoint)
|
||||
|
||||
## Constructors
|
||||
|
||||
### new Joint()
|
||||
|
||||
> **new Joint**(`def`): [`Joint`](/api/classes/Joint)
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **def**: [`JointDef`](/api/interfaces/JointDef)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Joint`](/api/classes/Joint)
|
||||
|
||||
### new Joint()
|
||||
|
||||
> **new Joint**(`def`, `bodyA`, `bodyB`): [`Joint`](/api/classes/Joint)
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **def**: [`JointOpt`](/api/interfaces/JointOpt)
|
||||
|
||||
• **bodyA**: [`Body`](/api/classes/Body)
|
||||
|
||||
• **bodyB**: [`Body`](/api/classes/Body)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Joint`](/api/classes/Joint)
|
||||
|
||||
## Properties
|
||||
|
||||
### style
|
||||
|
||||
> **style**: [`Style`](/api/interfaces/Style) = `{}`
|
||||
|
||||
Styling for dev-tools.
|
||||
|
||||
## Methods
|
||||
|
||||
### getAnchorA()
|
||||
|
||||
> `abstract` **getAnchorA**(): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
Get the anchor point on bodyA in world coordinates.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
***
|
||||
|
||||
### getAnchorB()
|
||||
|
||||
> `abstract` **getAnchorB**(): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
Get the anchor point on bodyB in world coordinates.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
***
|
||||
|
||||
### getBodyA()
|
||||
|
||||
> **getBodyA**(): [`Body`](/api/classes/Body)
|
||||
|
||||
Get the first body attached to this joint.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Body`](/api/classes/Body)
|
||||
|
||||
***
|
||||
|
||||
### getBodyB()
|
||||
|
||||
> **getBodyB**(): [`Body`](/api/classes/Body)
|
||||
|
||||
Get the second body attached to this joint.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Body`](/api/classes/Body)
|
||||
|
||||
***
|
||||
|
||||
### getCollideConnected()
|
||||
|
||||
> **getCollideConnected**(): `boolean`
|
||||
|
||||
Get collide connected. Note: modifying the collide connect flag won't work
|
||||
correctly because the flag is only checked when fixture AABBs begin to
|
||||
overlap.
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
***
|
||||
|
||||
### getNext()
|
||||
|
||||
> **getNext**(): [`Joint`](/api/classes/Joint)
|
||||
|
||||
Get the next joint the world joint list.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Joint`](/api/classes/Joint)
|
||||
|
||||
***
|
||||
|
||||
### getReactionForce()
|
||||
|
||||
> `abstract` **getReactionForce**(`inv_dt`): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
Get the reaction force on bodyB at the joint anchor in Newtons.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **inv\_dt**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
***
|
||||
|
||||
### getReactionTorque()
|
||||
|
||||
> `abstract` **getReactionTorque**(`inv_dt`): `number`
|
||||
|
||||
Get the reaction torque on bodyB in N*m.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **inv\_dt**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### getType()
|
||||
|
||||
> **getType**(): `string`
|
||||
|
||||
Get the type of the concrete joint.
|
||||
|
||||
#### Returns
|
||||
|
||||
`string`
|
||||
|
||||
***
|
||||
|
||||
### getUserData()
|
||||
|
||||
> **getUserData**(): `unknown`
|
||||
|
||||
#### Returns
|
||||
|
||||
`unknown`
|
||||
|
||||
***
|
||||
|
||||
### initVelocityConstraints()
|
||||
|
||||
> `abstract` **initVelocityConstraints**(`step`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **step**: [`TimeStep`](/api/classes/TimeStep)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### isActive()
|
||||
|
||||
> **isActive**(): `boolean`
|
||||
|
||||
Short-cut function to determine if either body is inactive.
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
***
|
||||
|
||||
### setUserData()
|
||||
|
||||
> **setUserData**(`data`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **data**: `unknown`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### shiftOrigin()
|
||||
|
||||
> **shiftOrigin**(`newOrigin`): `void`
|
||||
|
||||
Shift the origin for any points stored in world coordinates.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **newOrigin**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### solvePositionConstraints()
|
||||
|
||||
> `abstract` **solvePositionConstraints**(`step`): `boolean`
|
||||
|
||||
This returns true if the position errors are within tolerance.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **step**: [`TimeStep`](/api/classes/TimeStep)
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
***
|
||||
|
||||
### solveVelocityConstraints()
|
||||
|
||||
> `abstract` **solveVelocityConstraints**(`step`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **step**: [`TimeStep`](/api/classes/TimeStep)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
@ -1,48 +0,0 @@
|
||||
# Class: JointEdge
|
||||
|
||||
A joint edge is used to connect bodies and joints together in a joint graph
|
||||
where each body is a node and each joint is an edge. A joint edge belongs to
|
||||
a doubly linked list maintained in each attached body. Each joint has two
|
||||
joint nodes, one for each attached body.
|
||||
|
||||
## Constructors
|
||||
|
||||
### new JointEdge()
|
||||
|
||||
> **new JointEdge**(): [`JointEdge`](/api/classes/JointEdge)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`JointEdge`](/api/classes/JointEdge)
|
||||
|
||||
## Properties
|
||||
|
||||
### joint
|
||||
|
||||
> **joint**: [`Joint`](/api/classes/Joint) = `null`
|
||||
|
||||
the joint
|
||||
|
||||
***
|
||||
|
||||
### next
|
||||
|
||||
> **next**: [`JointEdge`](/api/classes/JointEdge) = `null`
|
||||
|
||||
the next joint edge in the body's joint list
|
||||
|
||||
***
|
||||
|
||||
### other
|
||||
|
||||
> **other**: [`Body`](/api/classes/Body) = `null`
|
||||
|
||||
provides quick access to the other body attached.
|
||||
|
||||
***
|
||||
|
||||
### prev
|
||||
|
||||
> **prev**: [`JointEdge`](/api/classes/JointEdge) = `null`
|
||||
|
||||
prev the previous joint edge in the body's joint list
|
||||
@ -1,176 +0,0 @@
|
||||
# Class: Manifold
|
||||
|
||||
A manifold for two touching convex shapes. Manifolds are created in `evaluate`
|
||||
method of Contact subclasses.
|
||||
|
||||
Supported manifold types are e_faceA or e_faceB for clip point versus plane
|
||||
with radius and e_circles point versus point with radius.
|
||||
|
||||
We store contacts in this way so that position correction can account for
|
||||
movement, which is critical for continuous physics. All contact scenarios
|
||||
must be expressed in one of these types. This structure is stored across time
|
||||
steps, so we keep it small.
|
||||
|
||||
## Constructors
|
||||
|
||||
### new Manifold()
|
||||
|
||||
> **new Manifold**(): [`Manifold`](/api/classes/Manifold)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Manifold`](/api/classes/Manifold)
|
||||
|
||||
## Properties
|
||||
|
||||
### localNormal
|
||||
|
||||
> **localNormal**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
Usage depends on manifold type:
|
||||
- circles: not used
|
||||
- faceA: the normal on polygonA
|
||||
- faceB: the normal on polygonB
|
||||
|
||||
***
|
||||
|
||||
### localPoint
|
||||
|
||||
> **localPoint**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
Usage depends on manifold type:
|
||||
- circles: the local center of circleA
|
||||
- faceA: the center of faceA
|
||||
- faceB: the center of faceB
|
||||
|
||||
***
|
||||
|
||||
### pointCount
|
||||
|
||||
> **pointCount**: `number` = `0`
|
||||
|
||||
The number of manifold points
|
||||
|
||||
***
|
||||
|
||||
### points
|
||||
|
||||
> **points**: [`ManifoldPoint`](/api/classes/ManifoldPoint)[]
|
||||
|
||||
The points of contact
|
||||
|
||||
***
|
||||
|
||||
### type
|
||||
|
||||
> **type**: [`ManifoldType`](/api/enumerations/ManifoldType)
|
||||
|
||||
***
|
||||
|
||||
### clipSegmentToLine()
|
||||
|
||||
> `static` **clipSegmentToLine**: (`vOut`, `vIn`, `normal`, `offset`, `vertexIndexA`) => `number`
|
||||
|
||||
Clipping for contact manifolds. Sutherland-Hodgman clipping.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **vOut**: [`ClipVertex`](/api/classes/ClipVertex)[]
|
||||
|
||||
• **vIn**: [`ClipVertex`](/api/classes/ClipVertex)[]
|
||||
|
||||
• **normal**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
• **offset**: `number`
|
||||
|
||||
• **vertexIndexA**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### ClipVertex
|
||||
|
||||
> `static` **ClipVertex**: *typeof* [`ClipVertex`](/api/classes/ClipVertex)
|
||||
|
||||
***
|
||||
|
||||
### getPointStates()
|
||||
|
||||
> `static` **getPointStates**: (`state1`, `state2`, `manifold1`, `manifold2`) => `void`
|
||||
|
||||
Compute the point states given two manifolds. The states pertain to the
|
||||
transition from manifold1 to manifold2. So state1 is either persist or remove
|
||||
while state2 is either add or persist.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **state1**: [`PointState`](/api/enumerations/PointState)[]
|
||||
|
||||
• **state2**: [`PointState`](/api/enumerations/PointState)[]
|
||||
|
||||
• **manifold1**: [`Manifold`](/api/classes/Manifold)
|
||||
|
||||
• **manifold2**: [`Manifold`](/api/classes/Manifold)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### PointState
|
||||
|
||||
> `static` **PointState**: *typeof* [`PointState`](/api/enumerations/PointState)
|
||||
|
||||
## Methods
|
||||
|
||||
### getWorldManifold()
|
||||
|
||||
> **getWorldManifold**(`wm`, `xfA`, `radiusA`, `xfB`, `radiusB`): [`WorldManifold`](/api/classes/WorldManifold)
|
||||
|
||||
Evaluate the manifold with supplied transforms. This assumes modest motion
|
||||
from the original state. This does not change the point count, impulses, etc.
|
||||
The radii must come from the shapes that generated the manifold.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **wm**: [`WorldManifold`](/api/classes/WorldManifold)
|
||||
|
||||
• **xfA**: [`TransformValue`](/api/type-aliases/TransformValue)
|
||||
|
||||
• **radiusA**: `number`
|
||||
|
||||
• **xfB**: [`TransformValue`](/api/type-aliases/TransformValue)
|
||||
|
||||
• **radiusB**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
[`WorldManifold`](/api/classes/WorldManifold)
|
||||
|
||||
***
|
||||
|
||||
### recycle()
|
||||
|
||||
> **recycle**(): `void`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### set()
|
||||
|
||||
> **set**(`that`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **that**: [`Manifold`](/api/classes/Manifold)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
@ -1,78 +0,0 @@
|
||||
# Class: ManifoldPoint
|
||||
|
||||
A manifold point is a contact point belonging to a contact manifold. It holds
|
||||
details related to the geometry and dynamics of the contact points.
|
||||
|
||||
This structure is stored across time steps, so we keep it small.
|
||||
|
||||
Note: impulses are used for internal caching and may not provide reliable
|
||||
contact forces, especially for high speed collisions.
|
||||
|
||||
## Constructors
|
||||
|
||||
### new ManifoldPoint()
|
||||
|
||||
> **new ManifoldPoint**(): [`ManifoldPoint`](/api/classes/ManifoldPoint)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`ManifoldPoint`](/api/classes/ManifoldPoint)
|
||||
|
||||
## Properties
|
||||
|
||||
### id
|
||||
|
||||
> `readonly` **id**: [`ContactID`](/api/classes/ContactID)
|
||||
|
||||
Uniquely identifies a contact point between two shapes to facilitate warm starting
|
||||
|
||||
***
|
||||
|
||||
### localPoint
|
||||
|
||||
> **localPoint**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
Usage depends on manifold type:
|
||||
- circles: the local center of circleB
|
||||
- faceA: the local center of circleB or the clip point of polygonB
|
||||
- faceB: the clip point of polygonA
|
||||
|
||||
***
|
||||
|
||||
### normalImpulse
|
||||
|
||||
> **normalImpulse**: `number` = `0`
|
||||
|
||||
The non-penetration impulse
|
||||
|
||||
***
|
||||
|
||||
### tangentImpulse
|
||||
|
||||
> **tangentImpulse**: `number` = `0`
|
||||
|
||||
The friction impulse
|
||||
|
||||
## Methods
|
||||
|
||||
### recycle()
|
||||
|
||||
> **recycle**(): `void`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### set()
|
||||
|
||||
> **set**(`that`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **that**: [`ManifoldPoint`](/api/classes/ManifoldPoint)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
@ -1,353 +0,0 @@
|
||||
# Class: Mat22
|
||||
|
||||
A 2-by-2 matrix. Stored in column-major order.
|
||||
|
||||
## Constructors
|
||||
|
||||
### new Mat22()
|
||||
|
||||
> **new Mat22**(`a`, `b`, `c`, `d`): [`Mat22`](/api/classes/Mat22)
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **a**: `number`
|
||||
|
||||
• **b**: `number`
|
||||
|
||||
• **c**: `number`
|
||||
|
||||
• **d**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Mat22`](/api/classes/Mat22)
|
||||
|
||||
### new Mat22()
|
||||
|
||||
> **new Mat22**(`a`, `b`): [`Mat22`](/api/classes/Mat22)
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **a**
|
||||
|
||||
• **a.x**: `number`
|
||||
|
||||
• **a.y**: `number`
|
||||
|
||||
• **b**
|
||||
|
||||
• **b.x**: `number`
|
||||
|
||||
• **b.y**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Mat22`](/api/classes/Mat22)
|
||||
|
||||
### new Mat22()
|
||||
|
||||
> **new Mat22**(): [`Mat22`](/api/classes/Mat22)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Mat22`](/api/classes/Mat22)
|
||||
|
||||
## Properties
|
||||
|
||||
### ex
|
||||
|
||||
> **ex**: [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
***
|
||||
|
||||
### ey
|
||||
|
||||
> **ey**: [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
## Methods
|
||||
|
||||
### getInverse()
|
||||
|
||||
> **getInverse**(): [`Mat22`](/api/classes/Mat22)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Mat22`](/api/classes/Mat22)
|
||||
|
||||
***
|
||||
|
||||
### set()
|
||||
|
||||
#### set(a)
|
||||
|
||||
> **set**(`a`): `void`
|
||||
|
||||
##### Parameters
|
||||
|
||||
• **a**: [`Mat22`](/api/classes/Mat22)
|
||||
|
||||
##### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### set(a, b)
|
||||
|
||||
> **set**(`a`, `b`): `void`
|
||||
|
||||
##### Parameters
|
||||
|
||||
• **a**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
• **b**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
##### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### set(a, b, c, d)
|
||||
|
||||
> **set**(`a`, `b`, `c`, `d`): `void`
|
||||
|
||||
##### Parameters
|
||||
|
||||
• **a**: `number`
|
||||
|
||||
• **b**: `number`
|
||||
|
||||
• **c**: `number`
|
||||
|
||||
• **d**: `number`
|
||||
|
||||
##### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### setIdentity()
|
||||
|
||||
> **setIdentity**(): `void`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### setZero()
|
||||
|
||||
> **setZero**(): `void`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### solve()
|
||||
|
||||
> **solve**(`v`): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
Solve A * x = b, where b is a column vector. This is more efficient than
|
||||
computing the inverse in one-shot cases.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **v**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
***
|
||||
|
||||
### abs()
|
||||
|
||||
> `static` **abs**(`mx`): [`Mat22`](/api/classes/Mat22)
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **mx**: [`Mat22`](/api/classes/Mat22)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Mat22`](/api/classes/Mat22)
|
||||
|
||||
***
|
||||
|
||||
### add()
|
||||
|
||||
> `static` **add**(`mx1`, `mx2`): [`Mat22`](/api/classes/Mat22)
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **mx1**: [`Mat22`](/api/classes/Mat22)
|
||||
|
||||
• **mx2**: [`Mat22`](/api/classes/Mat22)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Mat22`](/api/classes/Mat22)
|
||||
|
||||
***
|
||||
|
||||
### assert()
|
||||
|
||||
> `static` **assert**(`o`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **o**: `any`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### isValid()
|
||||
|
||||
> `static` **isValid**(`obj`): `boolean`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **obj**: `any`
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
***
|
||||
|
||||
### mul()
|
||||
|
||||
#### mul(mx, my)
|
||||
|
||||
> `static` **mul**(`mx`, `my`): [`Mat22`](/api/classes/Mat22)
|
||||
|
||||
Multiply a matrix times a vector. If a rotation matrix is provided, then this
|
||||
transforms the vector from one frame to another.
|
||||
|
||||
##### Parameters
|
||||
|
||||
• **mx**: [`Mat22`](/api/classes/Mat22)
|
||||
|
||||
• **my**: [`Mat22`](/api/classes/Mat22)
|
||||
|
||||
##### Returns
|
||||
|
||||
[`Mat22`](/api/classes/Mat22)
|
||||
|
||||
#### mul(mx, v)
|
||||
|
||||
> `static` **mul**(`mx`, `v`): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
##### Parameters
|
||||
|
||||
• **mx**: [`Mat22`](/api/classes/Mat22)
|
||||
|
||||
• **v**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
##### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
***
|
||||
|
||||
### mulMat22()
|
||||
|
||||
> `static` **mulMat22**(`mx`, `v`): [`Mat22`](/api/classes/Mat22)
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **mx**: [`Mat22`](/api/classes/Mat22)
|
||||
|
||||
• **v**: [`Mat22`](/api/classes/Mat22)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Mat22`](/api/classes/Mat22)
|
||||
|
||||
***
|
||||
|
||||
### mulT()
|
||||
|
||||
#### mulT(mx, my)
|
||||
|
||||
> `static` **mulT**(`mx`, `my`): [`Mat22`](/api/classes/Mat22)
|
||||
|
||||
Multiply a matrix transpose times a vector. If a rotation matrix is provided,
|
||||
then this transforms the vector from one frame to another (inverse
|
||||
transform).
|
||||
|
||||
##### Parameters
|
||||
|
||||
• **mx**: [`Mat22`](/api/classes/Mat22)
|
||||
|
||||
• **my**: [`Mat22`](/api/classes/Mat22)
|
||||
|
||||
##### Returns
|
||||
|
||||
[`Mat22`](/api/classes/Mat22)
|
||||
|
||||
#### mulT(mx, v)
|
||||
|
||||
> `static` **mulT**(`mx`, `v`): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
##### Parameters
|
||||
|
||||
• **mx**: [`Mat22`](/api/classes/Mat22)
|
||||
|
||||
• **v**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
##### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
***
|
||||
|
||||
### mulTMat22()
|
||||
|
||||
> `static` **mulTMat22**(`mx`, `v`): [`Mat22`](/api/classes/Mat22)
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **mx**: [`Mat22`](/api/classes/Mat22)
|
||||
|
||||
• **v**: [`Mat22`](/api/classes/Mat22)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Mat22`](/api/classes/Mat22)
|
||||
|
||||
***
|
||||
|
||||
### mulTVec2()
|
||||
|
||||
> `static` **mulTVec2**(`mx`, `v`): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **mx**: [`Mat22`](/api/classes/Mat22)
|
||||
|
||||
• **v**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
***
|
||||
|
||||
### mulVec2()
|
||||
|
||||
> `static` **mulVec2**(`mx`, `v`): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **mx**: [`Mat22`](/api/classes/Mat22)
|
||||
|
||||
• **v**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
@ -1,238 +0,0 @@
|
||||
# Class: Mat33
|
||||
|
||||
A 3-by-3 matrix. Stored in column-major order.
|
||||
|
||||
## Constructors
|
||||
|
||||
### new Mat33()
|
||||
|
||||
> **new Mat33**(`a`, `b`, `c`): [`Mat33`](/api/classes/Mat33)
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **a**: [`Vec3Value`](/api/interfaces/Vec3Value)
|
||||
|
||||
• **b**: [`Vec3Value`](/api/interfaces/Vec3Value)
|
||||
|
||||
• **c**: [`Vec3Value`](/api/interfaces/Vec3Value)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Mat33`](/api/classes/Mat33)
|
||||
|
||||
### new Mat33()
|
||||
|
||||
> **new Mat33**(): [`Mat33`](/api/classes/Mat33)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Mat33`](/api/classes/Mat33)
|
||||
|
||||
## Properties
|
||||
|
||||
### ex
|
||||
|
||||
> **ex**: [`Vec3`](/api/classes/Vec3)
|
||||
|
||||
***
|
||||
|
||||
### ey
|
||||
|
||||
> **ey**: [`Vec3`](/api/classes/Vec3)
|
||||
|
||||
***
|
||||
|
||||
### ez
|
||||
|
||||
> **ez**: [`Vec3`](/api/classes/Vec3)
|
||||
|
||||
## Methods
|
||||
|
||||
### getInverse22()
|
||||
|
||||
> **getInverse22**(`M`): `void`
|
||||
|
||||
Get the inverse of this matrix as a 2-by-2. Returns the zero matrix if
|
||||
singular.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **M**: [`Mat33`](/api/classes/Mat33)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### getSymInverse33()
|
||||
|
||||
> **getSymInverse33**(`M`): `void`
|
||||
|
||||
Get the symmetric inverse of this matrix as a 3-by-3. Returns the zero matrix
|
||||
if singular.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **M**: [`Mat33`](/api/classes/Mat33)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### setZero()
|
||||
|
||||
> **setZero**(): [`Mat33`](/api/classes/Mat33)
|
||||
|
||||
Set this matrix to all zeros.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Mat33`](/api/classes/Mat33)
|
||||
|
||||
***
|
||||
|
||||
### solve22()
|
||||
|
||||
> **solve22**(`v`): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
Solve A * x = b, where b is a column vector. This is more efficient than
|
||||
computing the inverse in one-shot cases. Solve only the upper 2-by-2 matrix
|
||||
equation.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **v**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
***
|
||||
|
||||
### solve33()
|
||||
|
||||
> **solve33**(`v`): [`Vec3`](/api/classes/Vec3)
|
||||
|
||||
Solve A * x = b, where b is a column vector. This is more efficient than
|
||||
computing the inverse in one-shot cases.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **v**: [`Vec3Value`](/api/interfaces/Vec3Value)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec3`](/api/classes/Vec3)
|
||||
|
||||
***
|
||||
|
||||
### add()
|
||||
|
||||
> `static` **add**(`a`, `b`): [`Mat33`](/api/classes/Mat33)
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **a**: [`Mat33`](/api/classes/Mat33)
|
||||
|
||||
• **b**: [`Mat33`](/api/classes/Mat33)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Mat33`](/api/classes/Mat33)
|
||||
|
||||
***
|
||||
|
||||
### assert()
|
||||
|
||||
> `static` **assert**(`o`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **o**: `any`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### isValid()
|
||||
|
||||
> `static` **isValid**(`obj`): `boolean`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **obj**: `any`
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
***
|
||||
|
||||
### mul()
|
||||
|
||||
#### mul(a, b)
|
||||
|
||||
> `static` **mul**(`a`, `b`): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
Multiply a matrix times a vector.
|
||||
|
||||
##### Parameters
|
||||
|
||||
• **a**: [`Mat33`](/api/classes/Mat33)
|
||||
|
||||
• **b**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
##### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
#### mul(a, b)
|
||||
|
||||
> `static` **mul**(`a`, `b`): [`Vec3`](/api/classes/Vec3)
|
||||
|
||||
##### Parameters
|
||||
|
||||
• **a**: [`Mat33`](/api/classes/Mat33)
|
||||
|
||||
• **b**: [`Vec3Value`](/api/interfaces/Vec3Value)
|
||||
|
||||
##### Returns
|
||||
|
||||
[`Vec3`](/api/classes/Vec3)
|
||||
|
||||
***
|
||||
|
||||
### mulVec2()
|
||||
|
||||
> `static` **mulVec2**(`a`, `b`): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **a**: [`Mat33`](/api/classes/Mat33)
|
||||
|
||||
• **b**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
***
|
||||
|
||||
### mulVec3()
|
||||
|
||||
> `static` **mulVec3**(`a`, `b`): [`Vec3`](/api/classes/Vec3)
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **a**: [`Mat33`](/api/classes/Mat33)
|
||||
|
||||
• **b**: [`Vec3Value`](/api/interfaces/Vec3Value)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec3`](/api/classes/Vec3)
|
||||
@ -1,479 +0,0 @@
|
||||
# Class: MotorJoint
|
||||
|
||||
A motor joint is used to control the relative motion between two bodies. A
|
||||
typical usage is to control the movement of a dynamic body with respect to
|
||||
the ground.
|
||||
|
||||
## Extends
|
||||
|
||||
- [`Joint`](/api/classes/Joint)
|
||||
|
||||
## Constructors
|
||||
|
||||
### new MotorJoint()
|
||||
|
||||
> **new MotorJoint**(`def`): [`MotorJoint`](/api/classes/MotorJoint)
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **def**: [`MotorJointDef`](/api/interfaces/MotorJointDef)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`MotorJoint`](/api/classes/MotorJoint)
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`constructor`](/api/classes/Joint#constructors)
|
||||
|
||||
### new MotorJoint()
|
||||
|
||||
> **new MotorJoint**(`def`, `bodyA`, `bodyB`): [`MotorJoint`](/api/classes/MotorJoint)
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **def**: [`MotorJointOpt`](/api/interfaces/MotorJointOpt)
|
||||
|
||||
• **bodyA**: [`Body`](/api/classes/Body)
|
||||
|
||||
• **bodyB**: [`Body`](/api/classes/Body)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`MotorJoint`](/api/classes/MotorJoint)
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`constructor`](/api/classes/Joint#constructors)
|
||||
|
||||
## Properties
|
||||
|
||||
### style
|
||||
|
||||
> **style**: [`Style`](/api/interfaces/Style) = `{}`
|
||||
|
||||
Styling for dev-tools.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`style`](/api/classes/Joint#style)
|
||||
|
||||
***
|
||||
|
||||
### TYPE
|
||||
|
||||
> `static` **TYPE**: `"motor-joint"`
|
||||
|
||||
## Methods
|
||||
|
||||
### getAnchorA()
|
||||
|
||||
> **getAnchorA**(): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
Get the anchor point on bodyA in world coordinates.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getAnchorA`](/api/classes/Joint#getanchora)
|
||||
|
||||
***
|
||||
|
||||
### getAnchorB()
|
||||
|
||||
> **getAnchorB**(): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
Get the anchor point on bodyB in world coordinates.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getAnchorB`](/api/classes/Joint#getanchorb)
|
||||
|
||||
***
|
||||
|
||||
### getAngularOffset()
|
||||
|
||||
> **getAngularOffset**(): `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### getBodyA()
|
||||
|
||||
> **getBodyA**(): [`Body`](/api/classes/Body)
|
||||
|
||||
Get the first body attached to this joint.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Body`](/api/classes/Body)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getBodyA`](/api/classes/Joint#getbodya)
|
||||
|
||||
***
|
||||
|
||||
### getBodyB()
|
||||
|
||||
> **getBodyB**(): [`Body`](/api/classes/Body)
|
||||
|
||||
Get the second body attached to this joint.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Body`](/api/classes/Body)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getBodyB`](/api/classes/Joint#getbodyb)
|
||||
|
||||
***
|
||||
|
||||
### getCollideConnected()
|
||||
|
||||
> **getCollideConnected**(): `boolean`
|
||||
|
||||
Get collide connected. Note: modifying the collide connect flag won't work
|
||||
correctly because the flag is only checked when fixture AABBs begin to
|
||||
overlap.
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getCollideConnected`](/api/classes/Joint#getcollideconnected)
|
||||
|
||||
***
|
||||
|
||||
### getCorrectionFactor()
|
||||
|
||||
> **getCorrectionFactor**(): `number`
|
||||
|
||||
Get the position correction factor in the range [0,1].
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### getLinearOffset()
|
||||
|
||||
> **getLinearOffset**(): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
***
|
||||
|
||||
### getMaxForce()
|
||||
|
||||
> **getMaxForce**(): `number`
|
||||
|
||||
Get the maximum friction force in N.
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### getMaxTorque()
|
||||
|
||||
> **getMaxTorque**(): `number`
|
||||
|
||||
Get the maximum friction torque in N*m.
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### getNext()
|
||||
|
||||
> **getNext**(): [`Joint`](/api/classes/Joint)
|
||||
|
||||
Get the next joint the world joint list.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Joint`](/api/classes/Joint)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getNext`](/api/classes/Joint#getnext)
|
||||
|
||||
***
|
||||
|
||||
### getReactionForce()
|
||||
|
||||
> **getReactionForce**(`inv_dt`): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
Get the reaction force on bodyB at the joint anchor in Newtons.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **inv\_dt**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getReactionForce`](/api/classes/Joint#getreactionforce)
|
||||
|
||||
***
|
||||
|
||||
### getReactionTorque()
|
||||
|
||||
> **getReactionTorque**(`inv_dt`): `number`
|
||||
|
||||
Get the reaction torque on bodyB in N*m.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **inv\_dt**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getReactionTorque`](/api/classes/Joint#getreactiontorque)
|
||||
|
||||
***
|
||||
|
||||
### getType()
|
||||
|
||||
> **getType**(): `string`
|
||||
|
||||
Get the type of the concrete joint.
|
||||
|
||||
#### Returns
|
||||
|
||||
`string`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getType`](/api/classes/Joint#gettype)
|
||||
|
||||
***
|
||||
|
||||
### getUserData()
|
||||
|
||||
> **getUserData**(): `unknown`
|
||||
|
||||
#### Returns
|
||||
|
||||
`unknown`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getUserData`](/api/classes/Joint#getuserdata)
|
||||
|
||||
***
|
||||
|
||||
### initVelocityConstraints()
|
||||
|
||||
> **initVelocityConstraints**(`step`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **step**: [`TimeStep`](/api/classes/TimeStep)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`initVelocityConstraints`](/api/classes/Joint#initvelocityconstraints)
|
||||
|
||||
***
|
||||
|
||||
### isActive()
|
||||
|
||||
> **isActive**(): `boolean`
|
||||
|
||||
Short-cut function to determine if either body is inactive.
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`isActive`](/api/classes/Joint#isactive)
|
||||
|
||||
***
|
||||
|
||||
### setAngularOffset()
|
||||
|
||||
> **setAngularOffset**(`angularOffset`): `void`
|
||||
|
||||
Set/get the target angular offset, in radians.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **angularOffset**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### setCorrectionFactor()
|
||||
|
||||
> **setCorrectionFactor**(`factor`): `void`
|
||||
|
||||
Set the position correction factor in the range [0,1].
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **factor**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### setLinearOffset()
|
||||
|
||||
> **setLinearOffset**(`linearOffset`): `void`
|
||||
|
||||
Set/get the target linear offset, in frame A, in meters.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **linearOffset**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### setMaxForce()
|
||||
|
||||
> **setMaxForce**(`force`): `void`
|
||||
|
||||
Set the maximum friction force in N.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **force**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### setMaxTorque()
|
||||
|
||||
> **setMaxTorque**(`torque`): `void`
|
||||
|
||||
Set the maximum friction torque in N*m.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **torque**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### setUserData()
|
||||
|
||||
> **setUserData**(`data`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **data**: `unknown`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`setUserData`](/api/classes/Joint#setuserdata)
|
||||
|
||||
***
|
||||
|
||||
### shiftOrigin()
|
||||
|
||||
> **shiftOrigin**(`newOrigin`): `void`
|
||||
|
||||
Shift the origin for any points stored in world coordinates.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **newOrigin**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`shiftOrigin`](/api/classes/Joint#shiftorigin)
|
||||
|
||||
***
|
||||
|
||||
### solvePositionConstraints()
|
||||
|
||||
> **solvePositionConstraints**(`step`): `boolean`
|
||||
|
||||
This returns true if the position errors are within tolerance.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **step**: [`TimeStep`](/api/classes/TimeStep)
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`solvePositionConstraints`](/api/classes/Joint#solvepositionconstraints)
|
||||
|
||||
***
|
||||
|
||||
### solveVelocityConstraints()
|
||||
|
||||
> **solveVelocityConstraints**(`step`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **step**: [`TimeStep`](/api/classes/TimeStep)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`solveVelocityConstraints`](/api/classes/Joint#solvevelocityconstraints)
|
||||
@ -1,462 +0,0 @@
|
||||
# Class: MouseJoint
|
||||
|
||||
A mouse joint is used to make a point on a body track a specified world
|
||||
point. This a soft constraint with a maximum force. This allows the
|
||||
constraint to stretch and without applying huge forces.
|
||||
|
||||
You need to call setTarget(target) every time that mouse is
|
||||
moved, to track the new location of the mouse.
|
||||
|
||||
NOTE: this joint is not documented in the manual because it was developed to
|
||||
be used in the testbed. If you want to learn how to use the mouse joint, look
|
||||
at the testbed.
|
||||
|
||||
## Extends
|
||||
|
||||
- [`Joint`](/api/classes/Joint)
|
||||
|
||||
## Constructors
|
||||
|
||||
### new MouseJoint()
|
||||
|
||||
> **new MouseJoint**(`def`): [`MouseJoint`](/api/classes/MouseJoint)
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **def**: [`MouseJointDef`](/api/interfaces/MouseJointDef)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`MouseJoint`](/api/classes/MouseJoint)
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`constructor`](/api/classes/Joint#constructors)
|
||||
|
||||
### new MouseJoint()
|
||||
|
||||
> **new MouseJoint**(`def`, `bodyA`, `bodyB`, `target`?): [`MouseJoint`](/api/classes/MouseJoint)
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **def**: [`MouseJointOpt`](/api/interfaces/MouseJointOpt)
|
||||
|
||||
• **bodyA**: [`Body`](/api/classes/Body)
|
||||
|
||||
• **bodyB**: [`Body`](/api/classes/Body)
|
||||
|
||||
• **target?**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`MouseJoint`](/api/classes/MouseJoint)
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`constructor`](/api/classes/Joint#constructors)
|
||||
|
||||
## Properties
|
||||
|
||||
### style
|
||||
|
||||
> **style**: [`Style`](/api/interfaces/Style) = `{}`
|
||||
|
||||
Styling for dev-tools.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`style`](/api/classes/Joint#style)
|
||||
|
||||
***
|
||||
|
||||
### TYPE
|
||||
|
||||
> `static` **TYPE**: `"mouse-joint"`
|
||||
|
||||
## Methods
|
||||
|
||||
### getAnchorA()
|
||||
|
||||
> **getAnchorA**(): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
Get the anchor point on bodyA in world coordinates.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getAnchorA`](/api/classes/Joint#getanchora)
|
||||
|
||||
***
|
||||
|
||||
### getAnchorB()
|
||||
|
||||
> **getAnchorB**(): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
Get the anchor point on bodyB in world coordinates.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getAnchorB`](/api/classes/Joint#getanchorb)
|
||||
|
||||
***
|
||||
|
||||
### getBodyA()
|
||||
|
||||
> **getBodyA**(): [`Body`](/api/classes/Body)
|
||||
|
||||
Get the first body attached to this joint.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Body`](/api/classes/Body)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getBodyA`](/api/classes/Joint#getbodya)
|
||||
|
||||
***
|
||||
|
||||
### getBodyB()
|
||||
|
||||
> **getBodyB**(): [`Body`](/api/classes/Body)
|
||||
|
||||
Get the second body attached to this joint.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Body`](/api/classes/Body)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getBodyB`](/api/classes/Joint#getbodyb)
|
||||
|
||||
***
|
||||
|
||||
### getCollideConnected()
|
||||
|
||||
> **getCollideConnected**(): `boolean`
|
||||
|
||||
Get collide connected. Note: modifying the collide connect flag won't work
|
||||
correctly because the flag is only checked when fixture AABBs begin to
|
||||
overlap.
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getCollideConnected`](/api/classes/Joint#getcollideconnected)
|
||||
|
||||
***
|
||||
|
||||
### getDampingRatio()
|
||||
|
||||
> **getDampingRatio**(): `number`
|
||||
|
||||
Get the damping ratio (dimensionless).
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### getFrequency()
|
||||
|
||||
> **getFrequency**(): `number`
|
||||
|
||||
Get the frequency in Hertz.
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### getMaxForce()
|
||||
|
||||
> **getMaxForce**(): `number`
|
||||
|
||||
Get the maximum force in Newtons.
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### getNext()
|
||||
|
||||
> **getNext**(): [`Joint`](/api/classes/Joint)
|
||||
|
||||
Get the next joint the world joint list.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Joint`](/api/classes/Joint)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getNext`](/api/classes/Joint#getnext)
|
||||
|
||||
***
|
||||
|
||||
### getReactionForce()
|
||||
|
||||
> **getReactionForce**(`inv_dt`): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
Get the reaction force on bodyB at the joint anchor in Newtons.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **inv\_dt**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getReactionForce`](/api/classes/Joint#getreactionforce)
|
||||
|
||||
***
|
||||
|
||||
### getReactionTorque()
|
||||
|
||||
> **getReactionTorque**(`inv_dt`): `number`
|
||||
|
||||
Get the reaction torque on bodyB in N*m.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **inv\_dt**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getReactionTorque`](/api/classes/Joint#getreactiontorque)
|
||||
|
||||
***
|
||||
|
||||
### getTarget()
|
||||
|
||||
> **getTarget**(): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
***
|
||||
|
||||
### getType()
|
||||
|
||||
> **getType**(): `string`
|
||||
|
||||
Get the type of the concrete joint.
|
||||
|
||||
#### Returns
|
||||
|
||||
`string`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getType`](/api/classes/Joint#gettype)
|
||||
|
||||
***
|
||||
|
||||
### getUserData()
|
||||
|
||||
> **getUserData**(): `unknown`
|
||||
|
||||
#### Returns
|
||||
|
||||
`unknown`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getUserData`](/api/classes/Joint#getuserdata)
|
||||
|
||||
***
|
||||
|
||||
### initVelocityConstraints()
|
||||
|
||||
> **initVelocityConstraints**(`step`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **step**: [`TimeStep`](/api/classes/TimeStep)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`initVelocityConstraints`](/api/classes/Joint#initvelocityconstraints)
|
||||
|
||||
***
|
||||
|
||||
### isActive()
|
||||
|
||||
> **isActive**(): `boolean`
|
||||
|
||||
Short-cut function to determine if either body is inactive.
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`isActive`](/api/classes/Joint#isactive)
|
||||
|
||||
***
|
||||
|
||||
### setDampingRatio()
|
||||
|
||||
> **setDampingRatio**(`ratio`): `void`
|
||||
|
||||
Set the damping ratio (dimensionless).
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **ratio**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### setFrequency()
|
||||
|
||||
> **setFrequency**(`hz`): `void`
|
||||
|
||||
Set the frequency in Hertz.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **hz**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### setMaxForce()
|
||||
|
||||
> **setMaxForce**(`force`): `void`
|
||||
|
||||
Set the maximum force in Newtons.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **force**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### setTarget()
|
||||
|
||||
> **setTarget**(`target`): `void`
|
||||
|
||||
Use this to update the target point.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **target**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### setUserData()
|
||||
|
||||
> **setUserData**(`data`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **data**: `unknown`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`setUserData`](/api/classes/Joint#setuserdata)
|
||||
|
||||
***
|
||||
|
||||
### shiftOrigin()
|
||||
|
||||
> **shiftOrigin**(`newOrigin`): `void`
|
||||
|
||||
Shift the origin for any points stored in world coordinates.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **newOrigin**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`shiftOrigin`](/api/classes/Joint#shiftorigin)
|
||||
|
||||
***
|
||||
|
||||
### solvePositionConstraints()
|
||||
|
||||
> **solvePositionConstraints**(`step`): `boolean`
|
||||
|
||||
This returns true if the position errors are within tolerance.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **step**: [`TimeStep`](/api/classes/TimeStep)
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`solvePositionConstraints`](/api/classes/Joint#solvepositionconstraints)
|
||||
|
||||
***
|
||||
|
||||
### solveVelocityConstraints()
|
||||
|
||||
> **solveVelocityConstraints**(`step`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **step**: [`TimeStep`](/api/classes/TimeStep)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`solveVelocityConstraints`](/api/classes/Joint#solvevelocityconstraints)
|
||||
@ -1,268 +0,0 @@
|
||||
# Class: PolygonShape
|
||||
|
||||
A convex polygon. It is assumed that the interior of the polygon is to the
|
||||
left of each edge. Polygons have a maximum number of vertices equal to
|
||||
Settings.maxPolygonVertices. In most cases you should not need many vertices
|
||||
for a convex polygon. extends Shape
|
||||
|
||||
## Extends
|
||||
|
||||
- [`Shape`](/api/classes/Shape)
|
||||
|
||||
## Extended by
|
||||
|
||||
- [`BoxShape`](/api/classes/BoxShape)
|
||||
|
||||
## Constructors
|
||||
|
||||
### new PolygonShape()
|
||||
|
||||
> **new PolygonShape**(`vertices`?): [`PolygonShape`](/api/classes/PolygonShape)
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **vertices?**: [`Vec2Value`](/api/interfaces/Vec2Value)[]
|
||||
|
||||
#### Returns
|
||||
|
||||
[`PolygonShape`](/api/classes/PolygonShape)
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Shape`](/api/classes/Shape).[`constructor`](/api/classes/Shape#constructors)
|
||||
|
||||
## Properties
|
||||
|
||||
### style
|
||||
|
||||
> **style**: [`Style`](/api/interfaces/Style) = `{}`
|
||||
|
||||
Styling for dev-tools.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Shape`](/api/classes/Shape).[`style`](/api/classes/Shape#style)
|
||||
|
||||
***
|
||||
|
||||
### TYPE
|
||||
|
||||
> `static` **TYPE**: `"polygon"`
|
||||
|
||||
## Methods
|
||||
|
||||
### computeAABB()
|
||||
|
||||
> **computeAABB**(`aabb`, `xf`, `childIndex`): `void`
|
||||
|
||||
Given a transform, compute the associated axis aligned bounding box for a
|
||||
child shape.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **aabb**: [`AABBValue`](/api/interfaces/AABBValue)
|
||||
|
||||
Returns the axis aligned box.
|
||||
|
||||
• **xf**: [`TransformValue`](/api/type-aliases/TransformValue)
|
||||
|
||||
The world transform of the shape.
|
||||
|
||||
• **childIndex**: `number`
|
||||
|
||||
The child shape
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Shape`](/api/classes/Shape).[`computeAABB`](/api/classes/Shape#computeaabb)
|
||||
|
||||
***
|
||||
|
||||
### computeDistanceProxy()
|
||||
|
||||
> **computeDistanceProxy**(`proxy`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **proxy**: [`DistanceProxy`](/api/classes/DistanceProxy)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Shape`](/api/classes/Shape).[`computeDistanceProxy`](/api/classes/Shape#computedistanceproxy)
|
||||
|
||||
***
|
||||
|
||||
### computeMass()
|
||||
|
||||
> **computeMass**(`massData`, `density`): `void`
|
||||
|
||||
Compute the mass properties of this shape using its dimensions and density.
|
||||
The inertia tensor is computed about the local origin.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **massData**: [`MassData`](/api/interfaces/MassData)
|
||||
|
||||
Returns the mass data for this shape.
|
||||
|
||||
• **density**: `number`
|
||||
|
||||
The density in kilograms per meter squared.
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Shape`](/api/classes/Shape).[`computeMass`](/api/classes/Shape#computemass)
|
||||
|
||||
***
|
||||
|
||||
### getChildCount()
|
||||
|
||||
> **getChildCount**(): `1`
|
||||
|
||||
Get the number of child primitives.
|
||||
|
||||
#### Returns
|
||||
|
||||
`1`
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Shape`](/api/classes/Shape).[`getChildCount`](/api/classes/Shape#getchildcount)
|
||||
|
||||
***
|
||||
|
||||
### getRadius()
|
||||
|
||||
> **getRadius**(): `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Shape`](/api/classes/Shape).[`getRadius`](/api/classes/Shape#getradius)
|
||||
|
||||
***
|
||||
|
||||
### getType()
|
||||
|
||||
> **getType**(): `"polygon"`
|
||||
|
||||
Get the type of this shape. You can use this to down cast to the concrete
|
||||
shape.
|
||||
|
||||
#### Returns
|
||||
|
||||
`"polygon"`
|
||||
|
||||
the shape type.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Shape`](/api/classes/Shape).[`getType`](/api/classes/Shape#gettype)
|
||||
|
||||
***
|
||||
|
||||
### rayCast()
|
||||
|
||||
> **rayCast**(`output`, `input`, `xf`, `childIndex`): `boolean`
|
||||
|
||||
Cast a ray against a child shape.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **output**: [`RayCastOutput`](/api/interfaces/RayCastOutput)
|
||||
|
||||
The ray-cast results.
|
||||
|
||||
• **input**: [`RayCastInput`](/api/interfaces/RayCastInput)
|
||||
|
||||
The ray-cast input parameters.
|
||||
|
||||
• **xf**: [`Transform`](/api/classes/Transform)
|
||||
|
||||
The transform to be applied to the shape.
|
||||
|
||||
• **childIndex**: `number`
|
||||
|
||||
The child shape index
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Shape`](/api/classes/Shape).[`rayCast`](/api/classes/Shape#raycast)
|
||||
|
||||
***
|
||||
|
||||
### testPoint()
|
||||
|
||||
> **testPoint**(`xf`, `p`): `boolean`
|
||||
|
||||
Test a point for containment in this shape. This only works for convex
|
||||
shapes.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **xf**: [`TransformValue`](/api/type-aliases/TransformValue)
|
||||
|
||||
The shape world transform.
|
||||
|
||||
• **p**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
A point in world coordinates.
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Shape`](/api/classes/Shape).[`testPoint`](/api/classes/Shape#testpoint)
|
||||
|
||||
***
|
||||
|
||||
### validate()
|
||||
|
||||
> **validate**(): `boolean`
|
||||
|
||||
Validate convexity. This is a very time consuming operation.
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
true if valid
|
||||
|
||||
***
|
||||
|
||||
### isValid()
|
||||
|
||||
> `static` **isValid**(`obj`): `boolean`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **obj**: `any`
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Shape`](/api/classes/Shape).[`isValid`](/api/classes/Shape#isvalid)
|
||||
@ -1,588 +0,0 @@
|
||||
# Class: PrismaticJoint
|
||||
|
||||
A prismatic joint. This joint provides one degree of freedom: translation
|
||||
along an axis fixed in bodyA. Relative rotation is prevented. You can use a
|
||||
joint limit to restrict the range of motion and a joint motor to drive the
|
||||
motion or to model joint friction.
|
||||
|
||||
## Extends
|
||||
|
||||
- [`Joint`](/api/classes/Joint)
|
||||
|
||||
## Constructors
|
||||
|
||||
### new PrismaticJoint()
|
||||
|
||||
> **new PrismaticJoint**(`def`): [`PrismaticJoint`](/api/classes/PrismaticJoint)
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **def**: [`PrismaticJointDef`](/api/interfaces/PrismaticJointDef)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`PrismaticJoint`](/api/classes/PrismaticJoint)
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`constructor`](/api/classes/Joint#constructors)
|
||||
|
||||
### new PrismaticJoint()
|
||||
|
||||
> **new PrismaticJoint**(`def`, `bodyA`, `bodyB`, `anchor`?, `axis`?): [`PrismaticJoint`](/api/classes/PrismaticJoint)
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **def**: [`PrismaticJointOpt`](/api/interfaces/PrismaticJointOpt)
|
||||
|
||||
• **bodyA**: [`Body`](/api/classes/Body)
|
||||
|
||||
• **bodyB**: [`Body`](/api/classes/Body)
|
||||
|
||||
• **anchor?**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
• **axis?**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`PrismaticJoint`](/api/classes/PrismaticJoint)
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`constructor`](/api/classes/Joint#constructors)
|
||||
|
||||
## Properties
|
||||
|
||||
### style
|
||||
|
||||
> **style**: [`Style`](/api/interfaces/Style) = `{}`
|
||||
|
||||
Styling for dev-tools.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`style`](/api/classes/Joint#style)
|
||||
|
||||
***
|
||||
|
||||
### TYPE
|
||||
|
||||
> `static` **TYPE**: `"prismatic-joint"`
|
||||
|
||||
## Methods
|
||||
|
||||
### enableLimit()
|
||||
|
||||
> **enableLimit**(`flag`): `void`
|
||||
|
||||
Enable/disable the joint limit.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **flag**: `boolean`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### enableMotor()
|
||||
|
||||
> **enableMotor**(`flag`): `void`
|
||||
|
||||
Enable/disable the joint motor.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **flag**: `boolean`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### getAnchorA()
|
||||
|
||||
> **getAnchorA**(): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
Get the anchor point on bodyA in world coordinates.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getAnchorA`](/api/classes/Joint#getanchora)
|
||||
|
||||
***
|
||||
|
||||
### getAnchorB()
|
||||
|
||||
> **getAnchorB**(): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
Get the anchor point on bodyB in world coordinates.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getAnchorB`](/api/classes/Joint#getanchorb)
|
||||
|
||||
***
|
||||
|
||||
### getBodyA()
|
||||
|
||||
> **getBodyA**(): [`Body`](/api/classes/Body)
|
||||
|
||||
Get the first body attached to this joint.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Body`](/api/classes/Body)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getBodyA`](/api/classes/Joint#getbodya)
|
||||
|
||||
***
|
||||
|
||||
### getBodyB()
|
||||
|
||||
> **getBodyB**(): [`Body`](/api/classes/Body)
|
||||
|
||||
Get the second body attached to this joint.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Body`](/api/classes/Body)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getBodyB`](/api/classes/Joint#getbodyb)
|
||||
|
||||
***
|
||||
|
||||
### getCollideConnected()
|
||||
|
||||
> **getCollideConnected**(): `boolean`
|
||||
|
||||
Get collide connected. Note: modifying the collide connect flag won't work
|
||||
correctly because the flag is only checked when fixture AABBs begin to
|
||||
overlap.
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getCollideConnected`](/api/classes/Joint#getcollideconnected)
|
||||
|
||||
***
|
||||
|
||||
### getJointSpeed()
|
||||
|
||||
> **getJointSpeed**(): `number`
|
||||
|
||||
Get the current joint translation speed, usually in meters per second.
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### getJointTranslation()
|
||||
|
||||
> **getJointTranslation**(): `number`
|
||||
|
||||
Get the current joint translation, usually in meters.
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### getLocalAnchorA()
|
||||
|
||||
> **getLocalAnchorA**(): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
The local anchor point relative to bodyA's origin.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
***
|
||||
|
||||
### getLocalAnchorB()
|
||||
|
||||
> **getLocalAnchorB**(): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
The local anchor point relative to bodyB's origin.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
***
|
||||
|
||||
### getLocalAxisA()
|
||||
|
||||
> **getLocalAxisA**(): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
The local joint axis relative to bodyA.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
***
|
||||
|
||||
### getLowerLimit()
|
||||
|
||||
> **getLowerLimit**(): `number`
|
||||
|
||||
Get the lower joint limit, usually in meters.
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### getMaxMotorForce()
|
||||
|
||||
> **getMaxMotorForce**(): `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### getMotorForce()
|
||||
|
||||
> **getMotorForce**(`inv_dt`): `number`
|
||||
|
||||
Get the current motor force given the inverse time step, usually in N.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **inv\_dt**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### getMotorSpeed()
|
||||
|
||||
> **getMotorSpeed**(): `number`
|
||||
|
||||
Get the motor speed, usually in meters per second.
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### getNext()
|
||||
|
||||
> **getNext**(): [`Joint`](/api/classes/Joint)
|
||||
|
||||
Get the next joint the world joint list.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Joint`](/api/classes/Joint)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getNext`](/api/classes/Joint#getnext)
|
||||
|
||||
***
|
||||
|
||||
### getReactionForce()
|
||||
|
||||
> **getReactionForce**(`inv_dt`): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
Get the reaction force on bodyB at the joint anchor in Newtons.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **inv\_dt**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getReactionForce`](/api/classes/Joint#getreactionforce)
|
||||
|
||||
***
|
||||
|
||||
### getReactionTorque()
|
||||
|
||||
> **getReactionTorque**(`inv_dt`): `number`
|
||||
|
||||
Get the reaction torque on bodyB in N*m.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **inv\_dt**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getReactionTorque`](/api/classes/Joint#getreactiontorque)
|
||||
|
||||
***
|
||||
|
||||
### getReferenceAngle()
|
||||
|
||||
> **getReferenceAngle**(): `number`
|
||||
|
||||
Get the reference angle.
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### getType()
|
||||
|
||||
> **getType**(): `string`
|
||||
|
||||
Get the type of the concrete joint.
|
||||
|
||||
#### Returns
|
||||
|
||||
`string`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getType`](/api/classes/Joint#gettype)
|
||||
|
||||
***
|
||||
|
||||
### getUpperLimit()
|
||||
|
||||
> **getUpperLimit**(): `number`
|
||||
|
||||
Get the upper joint limit, usually in meters.
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### getUserData()
|
||||
|
||||
> **getUserData**(): `unknown`
|
||||
|
||||
#### Returns
|
||||
|
||||
`unknown`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getUserData`](/api/classes/Joint#getuserdata)
|
||||
|
||||
***
|
||||
|
||||
### initVelocityConstraints()
|
||||
|
||||
> **initVelocityConstraints**(`step`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **step**: [`TimeStep`](/api/classes/TimeStep)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`initVelocityConstraints`](/api/classes/Joint#initvelocityconstraints)
|
||||
|
||||
***
|
||||
|
||||
### isActive()
|
||||
|
||||
> **isActive**(): `boolean`
|
||||
|
||||
Short-cut function to determine if either body is inactive.
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`isActive`](/api/classes/Joint#isactive)
|
||||
|
||||
***
|
||||
|
||||
### isLimitEnabled()
|
||||
|
||||
> **isLimitEnabled**(): `boolean`
|
||||
|
||||
Is the joint limit enabled?
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
***
|
||||
|
||||
### isMotorEnabled()
|
||||
|
||||
> **isMotorEnabled**(): `boolean`
|
||||
|
||||
Is the joint motor enabled?
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
***
|
||||
|
||||
### setLimits()
|
||||
|
||||
> **setLimits**(`lower`, `upper`): `void`
|
||||
|
||||
Set the joint limits, usually in meters.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **lower**: `number`
|
||||
|
||||
• **upper**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### setMaxMotorForce()
|
||||
|
||||
> **setMaxMotorForce**(`force`): `void`
|
||||
|
||||
Set the maximum motor force, usually in N.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **force**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### setMotorSpeed()
|
||||
|
||||
> **setMotorSpeed**(`speed`): `void`
|
||||
|
||||
Set the motor speed, usually in meters per second.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **speed**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### setUserData()
|
||||
|
||||
> **setUserData**(`data`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **data**: `unknown`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`setUserData`](/api/classes/Joint#setuserdata)
|
||||
|
||||
***
|
||||
|
||||
### shiftOrigin()
|
||||
|
||||
> **shiftOrigin**(`newOrigin`): `void`
|
||||
|
||||
Shift the origin for any points stored in world coordinates.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **newOrigin**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`shiftOrigin`](/api/classes/Joint#shiftorigin)
|
||||
|
||||
***
|
||||
|
||||
### solvePositionConstraints()
|
||||
|
||||
> **solvePositionConstraints**(`step`): `boolean`
|
||||
|
||||
This returns true if the position errors are within tolerance.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **step**: [`TimeStep`](/api/classes/TimeStep)
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`solvePositionConstraints`](/api/classes/Joint#solvepositionconstraints)
|
||||
|
||||
***
|
||||
|
||||
### solveVelocityConstraints()
|
||||
|
||||
> **solveVelocityConstraints**(`step`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **step**: [`TimeStep`](/api/classes/TimeStep)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`solveVelocityConstraints`](/api/classes/Joint#solvevelocityconstraints)
|
||||
@ -1,443 +0,0 @@
|
||||
# Class: PulleyJoint
|
||||
|
||||
The pulley joint is connected to two bodies and two fixed ground points. The
|
||||
pulley supports a ratio such that: length1 + ratio * length2 <= constant
|
||||
|
||||
Yes, the force transmitted is scaled by the ratio.
|
||||
|
||||
Warning: the pulley joint can get a bit squirrelly by itself. They often work
|
||||
better when combined with prismatic joints. You should also cover the the
|
||||
anchor points with static shapes to prevent one side from going to zero
|
||||
length.
|
||||
|
||||
## Extends
|
||||
|
||||
- [`Joint`](/api/classes/Joint)
|
||||
|
||||
## Constructors
|
||||
|
||||
### new PulleyJoint()
|
||||
|
||||
> **new PulleyJoint**(`def`): [`PulleyJoint`](/api/classes/PulleyJoint)
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **def**: [`PulleyJointDef`](/api/interfaces/PulleyJointDef)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`PulleyJoint`](/api/classes/PulleyJoint)
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`constructor`](/api/classes/Joint#constructors)
|
||||
|
||||
### new PulleyJoint()
|
||||
|
||||
> **new PulleyJoint**(`def`, `bodyA`, `bodyB`, `groundA`?, `groundB`?, `anchorA`?, `anchorB`?, `ratio`?): [`PulleyJoint`](/api/classes/PulleyJoint)
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **def**: [`PulleyJointOpt`](/api/interfaces/PulleyJointOpt)
|
||||
|
||||
• **bodyA**: [`Body`](/api/classes/Body)
|
||||
|
||||
• **bodyB**: [`Body`](/api/classes/Body)
|
||||
|
||||
• **groundA?**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
• **groundB?**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
• **anchorA?**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
• **anchorB?**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
• **ratio?**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
[`PulleyJoint`](/api/classes/PulleyJoint)
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`constructor`](/api/classes/Joint#constructors)
|
||||
|
||||
## Properties
|
||||
|
||||
### style
|
||||
|
||||
> **style**: [`Style`](/api/interfaces/Style) = `{}`
|
||||
|
||||
Styling for dev-tools.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`style`](/api/classes/Joint#style)
|
||||
|
||||
***
|
||||
|
||||
### TYPE
|
||||
|
||||
> `static` **TYPE**: `"pulley-joint"`
|
||||
|
||||
## Methods
|
||||
|
||||
### getAnchorA()
|
||||
|
||||
> **getAnchorA**(): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
Get the anchor point on bodyA in world coordinates.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getAnchorA`](/api/classes/Joint#getanchora)
|
||||
|
||||
***
|
||||
|
||||
### getAnchorB()
|
||||
|
||||
> **getAnchorB**(): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
Get the anchor point on bodyB in world coordinates.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getAnchorB`](/api/classes/Joint#getanchorb)
|
||||
|
||||
***
|
||||
|
||||
### getBodyA()
|
||||
|
||||
> **getBodyA**(): [`Body`](/api/classes/Body)
|
||||
|
||||
Get the first body attached to this joint.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Body`](/api/classes/Body)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getBodyA`](/api/classes/Joint#getbodya)
|
||||
|
||||
***
|
||||
|
||||
### getBodyB()
|
||||
|
||||
> **getBodyB**(): [`Body`](/api/classes/Body)
|
||||
|
||||
Get the second body attached to this joint.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Body`](/api/classes/Body)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getBodyB`](/api/classes/Joint#getbodyb)
|
||||
|
||||
***
|
||||
|
||||
### getCollideConnected()
|
||||
|
||||
> **getCollideConnected**(): `boolean`
|
||||
|
||||
Get collide connected. Note: modifying the collide connect flag won't work
|
||||
correctly because the flag is only checked when fixture AABBs begin to
|
||||
overlap.
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getCollideConnected`](/api/classes/Joint#getcollideconnected)
|
||||
|
||||
***
|
||||
|
||||
### getCurrentLengthA()
|
||||
|
||||
> **getCurrentLengthA**(): `number`
|
||||
|
||||
Get the current length of the segment attached to bodyA.
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### getCurrentLengthB()
|
||||
|
||||
> **getCurrentLengthB**(): `number`
|
||||
|
||||
Get the current length of the segment attached to bodyB.
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### getGroundAnchorA()
|
||||
|
||||
> **getGroundAnchorA**(): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
Get the first ground anchor.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
***
|
||||
|
||||
### getGroundAnchorB()
|
||||
|
||||
> **getGroundAnchorB**(): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
Get the second ground anchor.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
***
|
||||
|
||||
### getLengthA()
|
||||
|
||||
> **getLengthA**(): `number`
|
||||
|
||||
Get the current length of the segment attached to bodyA.
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### getLengthB()
|
||||
|
||||
> **getLengthB**(): `number`
|
||||
|
||||
Get the current length of the segment attached to bodyB.
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### getNext()
|
||||
|
||||
> **getNext**(): [`Joint`](/api/classes/Joint)
|
||||
|
||||
Get the next joint the world joint list.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Joint`](/api/classes/Joint)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getNext`](/api/classes/Joint#getnext)
|
||||
|
||||
***
|
||||
|
||||
### getRatio()
|
||||
|
||||
> **getRatio**(): `number`
|
||||
|
||||
Get the pulley ratio.
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### getReactionForce()
|
||||
|
||||
> **getReactionForce**(`inv_dt`): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
Get the reaction force on bodyB at the joint anchor in Newtons.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **inv\_dt**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getReactionForce`](/api/classes/Joint#getreactionforce)
|
||||
|
||||
***
|
||||
|
||||
### getReactionTorque()
|
||||
|
||||
> **getReactionTorque**(`inv_dt`): `number`
|
||||
|
||||
Get the reaction torque on bodyB in N*m.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **inv\_dt**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getReactionTorque`](/api/classes/Joint#getreactiontorque)
|
||||
|
||||
***
|
||||
|
||||
### getType()
|
||||
|
||||
> **getType**(): `string`
|
||||
|
||||
Get the type of the concrete joint.
|
||||
|
||||
#### Returns
|
||||
|
||||
`string`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getType`](/api/classes/Joint#gettype)
|
||||
|
||||
***
|
||||
|
||||
### getUserData()
|
||||
|
||||
> **getUserData**(): `unknown`
|
||||
|
||||
#### Returns
|
||||
|
||||
`unknown`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getUserData`](/api/classes/Joint#getuserdata)
|
||||
|
||||
***
|
||||
|
||||
### initVelocityConstraints()
|
||||
|
||||
> **initVelocityConstraints**(`step`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **step**: [`TimeStep`](/api/classes/TimeStep)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`initVelocityConstraints`](/api/classes/Joint#initvelocityconstraints)
|
||||
|
||||
***
|
||||
|
||||
### isActive()
|
||||
|
||||
> **isActive**(): `boolean`
|
||||
|
||||
Short-cut function to determine if either body is inactive.
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`isActive`](/api/classes/Joint#isactive)
|
||||
|
||||
***
|
||||
|
||||
### setUserData()
|
||||
|
||||
> **setUserData**(`data`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **data**: `unknown`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`setUserData`](/api/classes/Joint#setuserdata)
|
||||
|
||||
***
|
||||
|
||||
### shiftOrigin()
|
||||
|
||||
> **shiftOrigin**(`newOrigin`): `void`
|
||||
|
||||
Shift the origin for any points stored in world coordinates.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **newOrigin**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`shiftOrigin`](/api/classes/Joint#shiftorigin)
|
||||
|
||||
***
|
||||
|
||||
### solvePositionConstraints()
|
||||
|
||||
> **solvePositionConstraints**(`step`): `boolean`
|
||||
|
||||
This returns true if the position errors are within tolerance.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **step**: [`TimeStep`](/api/classes/TimeStep)
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`solvePositionConstraints`](/api/classes/Joint#solvepositionconstraints)
|
||||
|
||||
***
|
||||
|
||||
### solveVelocityConstraints()
|
||||
|
||||
> **solveVelocityConstraints**(`step`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **step**: [`TimeStep`](/api/classes/TimeStep)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`solveVelocityConstraints`](/api/classes/Joint#solvevelocityconstraints)
|
||||
@ -1,577 +0,0 @@
|
||||
# Class: RevoluteJoint
|
||||
|
||||
A revolute joint constrains two bodies to share a common point while they are
|
||||
free to rotate about the point. The relative rotation about the shared point
|
||||
is the joint angle. You can limit the relative rotation with a joint limit
|
||||
that specifies a lower and upper angle. You can use a motor to drive the
|
||||
relative rotation about the shared point. A maximum motor torque is provided
|
||||
so that infinite forces are not generated.
|
||||
|
||||
## Extends
|
||||
|
||||
- [`Joint`](/api/classes/Joint)
|
||||
|
||||
## Constructors
|
||||
|
||||
### new RevoluteJoint()
|
||||
|
||||
> **new RevoluteJoint**(`def`): [`RevoluteJoint`](/api/classes/RevoluteJoint)
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **def**: [`RevoluteJointDef`](/api/interfaces/RevoluteJointDef)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`RevoluteJoint`](/api/classes/RevoluteJoint)
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`constructor`](/api/classes/Joint#constructors)
|
||||
|
||||
### new RevoluteJoint()
|
||||
|
||||
> **new RevoluteJoint**(`def`, `bodyA`, `bodyB`, `anchor`?): [`RevoluteJoint`](/api/classes/RevoluteJoint)
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **def**: [`RevoluteJointOpt`](/api/interfaces/RevoluteJointOpt)
|
||||
|
||||
• **bodyA**: [`Body`](/api/classes/Body)
|
||||
|
||||
• **bodyB**: [`Body`](/api/classes/Body)
|
||||
|
||||
• **anchor?**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`RevoluteJoint`](/api/classes/RevoluteJoint)
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`constructor`](/api/classes/Joint#constructors)
|
||||
|
||||
## Properties
|
||||
|
||||
### style
|
||||
|
||||
> **style**: [`Style`](/api/interfaces/Style) = `{}`
|
||||
|
||||
Styling for dev-tools.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`style`](/api/classes/Joint#style)
|
||||
|
||||
***
|
||||
|
||||
### TYPE
|
||||
|
||||
> `static` **TYPE**: `"revolute-joint"`
|
||||
|
||||
## Methods
|
||||
|
||||
### enableLimit()
|
||||
|
||||
> **enableLimit**(`flag`): `void`
|
||||
|
||||
Enable/disable the joint limit.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **flag**: `boolean`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### enableMotor()
|
||||
|
||||
> **enableMotor**(`flag`): `void`
|
||||
|
||||
Enable/disable the joint motor.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **flag**: `boolean`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### getAnchorA()
|
||||
|
||||
> **getAnchorA**(): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
Get the anchor point on bodyA in world coordinates.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getAnchorA`](/api/classes/Joint#getanchora)
|
||||
|
||||
***
|
||||
|
||||
### getAnchorB()
|
||||
|
||||
> **getAnchorB**(): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
Get the anchor point on bodyB in world coordinates.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getAnchorB`](/api/classes/Joint#getanchorb)
|
||||
|
||||
***
|
||||
|
||||
### getBodyA()
|
||||
|
||||
> **getBodyA**(): [`Body`](/api/classes/Body)
|
||||
|
||||
Get the first body attached to this joint.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Body`](/api/classes/Body)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getBodyA`](/api/classes/Joint#getbodya)
|
||||
|
||||
***
|
||||
|
||||
### getBodyB()
|
||||
|
||||
> **getBodyB**(): [`Body`](/api/classes/Body)
|
||||
|
||||
Get the second body attached to this joint.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Body`](/api/classes/Body)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getBodyB`](/api/classes/Joint#getbodyb)
|
||||
|
||||
***
|
||||
|
||||
### getCollideConnected()
|
||||
|
||||
> **getCollideConnected**(): `boolean`
|
||||
|
||||
Get collide connected. Note: modifying the collide connect flag won't work
|
||||
correctly because the flag is only checked when fixture AABBs begin to
|
||||
overlap.
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getCollideConnected`](/api/classes/Joint#getcollideconnected)
|
||||
|
||||
***
|
||||
|
||||
### getJointAngle()
|
||||
|
||||
> **getJointAngle**(): `number`
|
||||
|
||||
Get the current joint angle in radians.
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### getJointSpeed()
|
||||
|
||||
> **getJointSpeed**(): `number`
|
||||
|
||||
Get the current joint angle speed in radians per second.
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### getLocalAnchorA()
|
||||
|
||||
> **getLocalAnchorA**(): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
The local anchor point relative to bodyA's origin.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
***
|
||||
|
||||
### getLocalAnchorB()
|
||||
|
||||
> **getLocalAnchorB**(): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
The local anchor point relative to bodyB's origin.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
***
|
||||
|
||||
### getLowerLimit()
|
||||
|
||||
> **getLowerLimit**(): `number`
|
||||
|
||||
Get the lower joint limit in radians.
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### getMaxMotorTorque()
|
||||
|
||||
> **getMaxMotorTorque**(): `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### getMotorSpeed()
|
||||
|
||||
> **getMotorSpeed**(): `number`
|
||||
|
||||
Get the motor speed in radians per second.
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### getMotorTorque()
|
||||
|
||||
> **getMotorTorque**(`inv_dt`): `number`
|
||||
|
||||
Get the current motor torque given the inverse time step. Unit is N*m.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **inv\_dt**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### getNext()
|
||||
|
||||
> **getNext**(): [`Joint`](/api/classes/Joint)
|
||||
|
||||
Get the next joint the world joint list.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Joint`](/api/classes/Joint)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getNext`](/api/classes/Joint#getnext)
|
||||
|
||||
***
|
||||
|
||||
### getReactionForce()
|
||||
|
||||
> **getReactionForce**(`inv_dt`): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
Get the reaction force given the inverse time step. Unit is N.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **inv\_dt**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getReactionForce`](/api/classes/Joint#getreactionforce)
|
||||
|
||||
***
|
||||
|
||||
### getReactionTorque()
|
||||
|
||||
> **getReactionTorque**(`inv_dt`): `number`
|
||||
|
||||
Get the reaction torque due to the joint limit given the inverse time step.
|
||||
Unit is N*m.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **inv\_dt**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getReactionTorque`](/api/classes/Joint#getreactiontorque)
|
||||
|
||||
***
|
||||
|
||||
### getReferenceAngle()
|
||||
|
||||
> **getReferenceAngle**(): `number`
|
||||
|
||||
Get the reference angle.
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### getType()
|
||||
|
||||
> **getType**(): `string`
|
||||
|
||||
Get the type of the concrete joint.
|
||||
|
||||
#### Returns
|
||||
|
||||
`string`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getType`](/api/classes/Joint#gettype)
|
||||
|
||||
***
|
||||
|
||||
### getUpperLimit()
|
||||
|
||||
> **getUpperLimit**(): `number`
|
||||
|
||||
Get the upper joint limit in radians.
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### getUserData()
|
||||
|
||||
> **getUserData**(): `unknown`
|
||||
|
||||
#### Returns
|
||||
|
||||
`unknown`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getUserData`](/api/classes/Joint#getuserdata)
|
||||
|
||||
***
|
||||
|
||||
### initVelocityConstraints()
|
||||
|
||||
> **initVelocityConstraints**(`step`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **step**: [`TimeStep`](/api/classes/TimeStep)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`initVelocityConstraints`](/api/classes/Joint#initvelocityconstraints)
|
||||
|
||||
***
|
||||
|
||||
### isActive()
|
||||
|
||||
> **isActive**(): `boolean`
|
||||
|
||||
Short-cut function to determine if either body is inactive.
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`isActive`](/api/classes/Joint#isactive)
|
||||
|
||||
***
|
||||
|
||||
### isLimitEnabled()
|
||||
|
||||
> **isLimitEnabled**(): `boolean`
|
||||
|
||||
Is the joint limit enabled?
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
***
|
||||
|
||||
### isMotorEnabled()
|
||||
|
||||
> **isMotorEnabled**(): `boolean`
|
||||
|
||||
Is the joint motor enabled?
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
***
|
||||
|
||||
### setLimits()
|
||||
|
||||
> **setLimits**(`lower`, `upper`): `void`
|
||||
|
||||
Set the joint limits in radians.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **lower**: `number`
|
||||
|
||||
• **upper**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### setMaxMotorTorque()
|
||||
|
||||
> **setMaxMotorTorque**(`torque`): `void`
|
||||
|
||||
Set the maximum motor torque, usually in N-m.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **torque**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### setMotorSpeed()
|
||||
|
||||
> **setMotorSpeed**(`speed`): `void`
|
||||
|
||||
Set the motor speed in radians per second.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **speed**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### setUserData()
|
||||
|
||||
> **setUserData**(`data`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **data**: `unknown`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`setUserData`](/api/classes/Joint#setuserdata)
|
||||
|
||||
***
|
||||
|
||||
### shiftOrigin()
|
||||
|
||||
> **shiftOrigin**(`newOrigin`): `void`
|
||||
|
||||
Shift the origin for any points stored in world coordinates.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **newOrigin**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`shiftOrigin`](/api/classes/Joint#shiftorigin)
|
||||
|
||||
***
|
||||
|
||||
### solvePositionConstraints()
|
||||
|
||||
> **solvePositionConstraints**(`step`): `boolean`
|
||||
|
||||
This returns true if the position errors are within tolerance.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **step**: [`TimeStep`](/api/classes/TimeStep)
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`solvePositionConstraints`](/api/classes/Joint#solvepositionconstraints)
|
||||
|
||||
***
|
||||
|
||||
### solveVelocityConstraints()
|
||||
|
||||
> **solveVelocityConstraints**(`step`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **step**: [`TimeStep`](/api/classes/TimeStep)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`solveVelocityConstraints`](/api/classes/Joint#solvevelocityconstraints)
|
||||
@ -1,413 +0,0 @@
|
||||
# Class: RopeJoint
|
||||
|
||||
A rope joint enforces a maximum distance between two points on two bodies. It
|
||||
has no other effect.
|
||||
|
||||
Warning: if you attempt to change the maximum length during the simulation
|
||||
you will get some non-physical behavior.
|
||||
|
||||
A model that would allow you to dynamically modify the length would have some
|
||||
sponginess, so I chose not to implement it that way. See [DistanceJoint](/api/classes/DistanceJoint) if you
|
||||
want to dynamically control length.
|
||||
|
||||
## Extends
|
||||
|
||||
- [`Joint`](/api/classes/Joint)
|
||||
|
||||
## Constructors
|
||||
|
||||
### new RopeJoint()
|
||||
|
||||
> **new RopeJoint**(`def`): [`RopeJoint`](/api/classes/RopeJoint)
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **def**: [`RopeJointDef`](/api/interfaces/RopeJointDef)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`RopeJoint`](/api/classes/RopeJoint)
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`constructor`](/api/classes/Joint#constructors)
|
||||
|
||||
### new RopeJoint()
|
||||
|
||||
> **new RopeJoint**(`def`, `bodyA`, `bodyB`, `anchor`?): [`RopeJoint`](/api/classes/RopeJoint)
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **def**: [`RopeJointOpt`](/api/interfaces/RopeJointOpt)
|
||||
|
||||
• **bodyA**: [`Body`](/api/classes/Body)
|
||||
|
||||
• **bodyB**: [`Body`](/api/classes/Body)
|
||||
|
||||
• **anchor?**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`RopeJoint`](/api/classes/RopeJoint)
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`constructor`](/api/classes/Joint#constructors)
|
||||
|
||||
## Properties
|
||||
|
||||
### style
|
||||
|
||||
> **style**: [`Style`](/api/interfaces/Style) = `{}`
|
||||
|
||||
Styling for dev-tools.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`style`](/api/classes/Joint#style)
|
||||
|
||||
***
|
||||
|
||||
### TYPE
|
||||
|
||||
> `static` **TYPE**: `"rope-joint"`
|
||||
|
||||
## Methods
|
||||
|
||||
### getAnchorA()
|
||||
|
||||
> **getAnchorA**(): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
Get the anchor point on bodyA in world coordinates.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getAnchorA`](/api/classes/Joint#getanchora)
|
||||
|
||||
***
|
||||
|
||||
### getAnchorB()
|
||||
|
||||
> **getAnchorB**(): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
Get the anchor point on bodyB in world coordinates.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getAnchorB`](/api/classes/Joint#getanchorb)
|
||||
|
||||
***
|
||||
|
||||
### getBodyA()
|
||||
|
||||
> **getBodyA**(): [`Body`](/api/classes/Body)
|
||||
|
||||
Get the first body attached to this joint.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Body`](/api/classes/Body)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getBodyA`](/api/classes/Joint#getbodya)
|
||||
|
||||
***
|
||||
|
||||
### getBodyB()
|
||||
|
||||
> **getBodyB**(): [`Body`](/api/classes/Body)
|
||||
|
||||
Get the second body attached to this joint.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Body`](/api/classes/Body)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getBodyB`](/api/classes/Joint#getbodyb)
|
||||
|
||||
***
|
||||
|
||||
### getCollideConnected()
|
||||
|
||||
> **getCollideConnected**(): `boolean`
|
||||
|
||||
Get collide connected. Note: modifying the collide connect flag won't work
|
||||
correctly because the flag is only checked when fixture AABBs begin to
|
||||
overlap.
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getCollideConnected`](/api/classes/Joint#getcollideconnected)
|
||||
|
||||
***
|
||||
|
||||
### getLimitState()
|
||||
|
||||
> **getLimitState**(): `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### getLocalAnchorA()
|
||||
|
||||
> **getLocalAnchorA**(): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
The local anchor point relative to bodyA's origin.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
***
|
||||
|
||||
### getLocalAnchorB()
|
||||
|
||||
> **getLocalAnchorB**(): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
The local anchor point relative to bodyB's origin.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
***
|
||||
|
||||
### getMaxLength()
|
||||
|
||||
> **getMaxLength**(): `number`
|
||||
|
||||
Get the maximum length of the rope.
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### getNext()
|
||||
|
||||
> **getNext**(): [`Joint`](/api/classes/Joint)
|
||||
|
||||
Get the next joint the world joint list.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Joint`](/api/classes/Joint)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getNext`](/api/classes/Joint#getnext)
|
||||
|
||||
***
|
||||
|
||||
### getReactionForce()
|
||||
|
||||
> **getReactionForce**(`inv_dt`): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
Get the reaction force on bodyB at the joint anchor in Newtons.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **inv\_dt**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getReactionForce`](/api/classes/Joint#getreactionforce)
|
||||
|
||||
***
|
||||
|
||||
### getReactionTorque()
|
||||
|
||||
> **getReactionTorque**(`inv_dt`): `number`
|
||||
|
||||
Get the reaction torque on bodyB in N*m.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **inv\_dt**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getReactionTorque`](/api/classes/Joint#getreactiontorque)
|
||||
|
||||
***
|
||||
|
||||
### getType()
|
||||
|
||||
> **getType**(): `string`
|
||||
|
||||
Get the type of the concrete joint.
|
||||
|
||||
#### Returns
|
||||
|
||||
`string`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getType`](/api/classes/Joint#gettype)
|
||||
|
||||
***
|
||||
|
||||
### getUserData()
|
||||
|
||||
> **getUserData**(): `unknown`
|
||||
|
||||
#### Returns
|
||||
|
||||
`unknown`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getUserData`](/api/classes/Joint#getuserdata)
|
||||
|
||||
***
|
||||
|
||||
### initVelocityConstraints()
|
||||
|
||||
> **initVelocityConstraints**(`step`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **step**: [`TimeStep`](/api/classes/TimeStep)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`initVelocityConstraints`](/api/classes/Joint#initvelocityconstraints)
|
||||
|
||||
***
|
||||
|
||||
### isActive()
|
||||
|
||||
> **isActive**(): `boolean`
|
||||
|
||||
Short-cut function to determine if either body is inactive.
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`isActive`](/api/classes/Joint#isactive)
|
||||
|
||||
***
|
||||
|
||||
### setMaxLength()
|
||||
|
||||
> **setMaxLength**(`length`): `void`
|
||||
|
||||
Set the maximum length of the rope.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **length**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### setUserData()
|
||||
|
||||
> **setUserData**(`data`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **data**: `unknown`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`setUserData`](/api/classes/Joint#setuserdata)
|
||||
|
||||
***
|
||||
|
||||
### shiftOrigin()
|
||||
|
||||
> **shiftOrigin**(`newOrigin`): `void`
|
||||
|
||||
Shift the origin for any points stored in world coordinates.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **newOrigin**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`shiftOrigin`](/api/classes/Joint#shiftorigin)
|
||||
|
||||
***
|
||||
|
||||
### solvePositionConstraints()
|
||||
|
||||
> **solvePositionConstraints**(`step`): `boolean`
|
||||
|
||||
This returns true if the position errors are within tolerance.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **step**: [`TimeStep`](/api/classes/TimeStep)
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`solvePositionConstraints`](/api/classes/Joint#solvepositionconstraints)
|
||||
|
||||
***
|
||||
|
||||
### solveVelocityConstraints()
|
||||
|
||||
> **solveVelocityConstraints**(`step`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **step**: [`TimeStep`](/api/classes/TimeStep)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`solveVelocityConstraints`](/api/classes/Joint#solvevelocityconstraints)
|
||||
@ -1,341 +0,0 @@
|
||||
# Class: Rot
|
||||
|
||||
Rotation
|
||||
|
||||
## Constructors
|
||||
|
||||
### new Rot()
|
||||
|
||||
> **new Rot**(`angle`?): [`Rot`](/api/classes/Rot)
|
||||
|
||||
Initialize from an angle in radians.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **angle?**: `number` \| [`RotValue`](/api/interfaces/RotValue)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Rot`](/api/classes/Rot)
|
||||
|
||||
## Properties
|
||||
|
||||
### c
|
||||
|
||||
> **c**: `number`
|
||||
|
||||
cos(angle)
|
||||
|
||||
***
|
||||
|
||||
### s
|
||||
|
||||
> **s**: `number`
|
||||
|
||||
sin(angle)
|
||||
|
||||
## Methods
|
||||
|
||||
### getAngle()
|
||||
|
||||
> **getAngle**(): `number`
|
||||
|
||||
Get the angle in radians.
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### getXAxis()
|
||||
|
||||
> **getXAxis**(): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
Get the x-axis.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
***
|
||||
|
||||
### getYAxis()
|
||||
|
||||
> **getYAxis**(): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
Get the y-axis.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
***
|
||||
|
||||
### set()
|
||||
|
||||
> **set**(`angle`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **angle**: `number` \| [`RotValue`](/api/interfaces/RotValue)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### setAngle()
|
||||
|
||||
> **setAngle**(`angle`): `void`
|
||||
|
||||
Set using an angle in radians.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **angle**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### setIdentity()
|
||||
|
||||
> **setIdentity**(): `void`
|
||||
|
||||
Set to the identity rotation.
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### setRot()
|
||||
|
||||
> **setRot**(`angle`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **angle**: [`RotValue`](/api/interfaces/RotValue)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### assert()
|
||||
|
||||
> `static` **assert**(`o`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **o**: `any`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### clone()
|
||||
|
||||
> `static` **clone**(`rot`): [`Rot`](/api/classes/Rot)
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **rot**: [`RotValue`](/api/interfaces/RotValue)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Rot`](/api/classes/Rot)
|
||||
|
||||
***
|
||||
|
||||
### identity()
|
||||
|
||||
> `static` **identity**(): [`Rot`](/api/classes/Rot)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Rot`](/api/classes/Rot)
|
||||
|
||||
***
|
||||
|
||||
### isValid()
|
||||
|
||||
> `static` **isValid**(`obj`): `boolean`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **obj**: `any`
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
***
|
||||
|
||||
### mul()
|
||||
|
||||
#### mul(rot, m)
|
||||
|
||||
> `static` **mul**(`rot`, `m`): [`Rot`](/api/classes/Rot)
|
||||
|
||||
Multiply two rotations: q * r
|
||||
|
||||
##### Parameters
|
||||
|
||||
• **rot**: [`RotValue`](/api/interfaces/RotValue)
|
||||
|
||||
• **m**: [`RotValue`](/api/interfaces/RotValue)
|
||||
|
||||
##### Returns
|
||||
|
||||
[`Rot`](/api/classes/Rot)
|
||||
|
||||
#### mul(rot, m)
|
||||
|
||||
> `static` **mul**(`rot`, `m`): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
Rotate a vector
|
||||
|
||||
##### Parameters
|
||||
|
||||
• **rot**: [`RotValue`](/api/interfaces/RotValue)
|
||||
|
||||
• **m**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
##### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
***
|
||||
|
||||
### mulRot()
|
||||
|
||||
> `static` **mulRot**(`rot`, `m`): [`Rot`](/api/classes/Rot)
|
||||
|
||||
Multiply two rotations: q * r
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **rot**: [`RotValue`](/api/interfaces/RotValue)
|
||||
|
||||
• **m**: [`RotValue`](/api/interfaces/RotValue)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Rot`](/api/classes/Rot)
|
||||
|
||||
***
|
||||
|
||||
### mulSub()
|
||||
|
||||
> `static` **mulSub**(`rot`, `v`, `w`): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **rot**: [`RotValue`](/api/interfaces/RotValue)
|
||||
|
||||
• **v**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
• **w**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
***
|
||||
|
||||
### mulT()
|
||||
|
||||
#### mulT(rot, m)
|
||||
|
||||
> `static` **mulT**(`rot`, `m`): [`Rot`](/api/classes/Rot)
|
||||
|
||||
Transpose multiply two rotations: qT * r
|
||||
|
||||
##### Parameters
|
||||
|
||||
• **rot**: [`RotValue`](/api/interfaces/RotValue)
|
||||
|
||||
• **m**: [`RotValue`](/api/interfaces/RotValue)
|
||||
|
||||
##### Returns
|
||||
|
||||
[`Rot`](/api/classes/Rot)
|
||||
|
||||
#### mulT(rot, m)
|
||||
|
||||
> `static` **mulT**(`rot`, `m`): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
Inverse rotate a vector
|
||||
|
||||
##### Parameters
|
||||
|
||||
• **rot**: [`RotValue`](/api/interfaces/RotValue)
|
||||
|
||||
• **m**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
##### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
***
|
||||
|
||||
### mulTRot()
|
||||
|
||||
> `static` **mulTRot**(`rot`, `m`): [`Rot`](/api/classes/Rot)
|
||||
|
||||
Transpose multiply two rotations: qT * r
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **rot**: [`RotValue`](/api/interfaces/RotValue)
|
||||
|
||||
• **m**: [`RotValue`](/api/interfaces/RotValue)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Rot`](/api/classes/Rot)
|
||||
|
||||
***
|
||||
|
||||
### mulTVec2()
|
||||
|
||||
> `static` **mulTVec2**(`rot`, `m`): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
Inverse rotate a vector
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **rot**: [`RotValue`](/api/interfaces/RotValue)
|
||||
|
||||
• **m**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
***
|
||||
|
||||
### mulVec2()
|
||||
|
||||
> `static` **mulVec2**(`rot`, `m`): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
Rotate a vector
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **rot**: [`RotValue`](/api/interfaces/RotValue)
|
||||
|
||||
• **m**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
@ -1,214 +0,0 @@
|
||||
# Class: Settings
|
||||
|
||||
Tuning constants based on meters-kilograms-seconds (MKS) units.
|
||||
|
||||
Some tolerances are absolute and some are relative. Absolute tolerances use MKS units.
|
||||
|
||||
## Constructors
|
||||
|
||||
### new Settings()
|
||||
|
||||
> **new Settings**(): [`Settings`](/api/classes/Settings)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Settings`](/api/classes/Settings)
|
||||
|
||||
## Properties
|
||||
|
||||
### aabbExtension
|
||||
|
||||
> `static` **aabbExtension**: `number` = `0.1`
|
||||
|
||||
This is used to fatten AABBs in the dynamic tree. This allows proxies to move
|
||||
by a small amount without triggering a tree adjustment. This is in meters.
|
||||
|
||||
***
|
||||
|
||||
### aabbMultiplier
|
||||
|
||||
> `static` **aabbMultiplier**: `number` = `2.0`
|
||||
|
||||
This is used to fatten AABBs in the dynamic tree. This is used to predict the
|
||||
future position based on the current displacement. This is a dimensionless
|
||||
multiplier.
|
||||
|
||||
***
|
||||
|
||||
### angularSleepTolerance
|
||||
|
||||
> `static` **angularSleepTolerance**: `number`
|
||||
|
||||
A body cannot sleep if its angular velocity is above this tolerance.
|
||||
|
||||
***
|
||||
|
||||
### angularSlop
|
||||
|
||||
> `static` **angularSlop**: `number`
|
||||
|
||||
A small angle used as a collision and constraint tolerance. Usually it is
|
||||
chosen to be numerically significant, but visually insignificant.
|
||||
|
||||
***
|
||||
|
||||
### baumgarte
|
||||
|
||||
> `static` **baumgarte**: `number` = `0.2`
|
||||
|
||||
This scale factor controls how fast overlap is resolved. Ideally this would
|
||||
be 1 so that overlap is removed in one time step. However using values close
|
||||
to 1 often lead to overshoot.
|
||||
|
||||
***
|
||||
|
||||
### lengthUnitsPerMeter
|
||||
|
||||
> `static` **lengthUnitsPerMeter**: `number` = `1.0`
|
||||
|
||||
You can use this to change the length scale used by your game.
|
||||
|
||||
For example for inches you could use 39.4.
|
||||
|
||||
***
|
||||
|
||||
### linearSleepTolerance
|
||||
|
||||
> `static` **linearSleepTolerance**: `number` = `0.01`
|
||||
|
||||
A body cannot sleep if its linear velocity is above this tolerance.
|
||||
|
||||
***
|
||||
|
||||
### linearSlop
|
||||
|
||||
> `static` **linearSlop**: `number` = `0.005`
|
||||
|
||||
A small length used as a collision and constraint tolerance. Usually it is
|
||||
chosen to be numerically significant, but visually insignificant.
|
||||
|
||||
***
|
||||
|
||||
### maxAngularCorrection
|
||||
|
||||
> `static` **maxAngularCorrection**: `number`
|
||||
|
||||
The maximum angular position correction used when solving constraints. This
|
||||
helps to prevent overshoot.
|
||||
|
||||
***
|
||||
|
||||
### maxDistanceIterations
|
||||
|
||||
> `static` **maxDistanceIterations**: `number` = `20`
|
||||
|
||||
Maximum iterations to find Distance.
|
||||
|
||||
***
|
||||
|
||||
### maxLinearCorrection
|
||||
|
||||
> `static` **maxLinearCorrection**: `number` = `0.2`
|
||||
|
||||
The maximum linear position correction used when solving constraints. This
|
||||
helps to prevent overshoot.
|
||||
|
||||
***
|
||||
|
||||
### maxManifoldPoints
|
||||
|
||||
> `static` **maxManifoldPoints**: `number` = `2`
|
||||
|
||||
The maximum number of contact points between two convex shapes. Do not change
|
||||
this value.
|
||||
|
||||
***
|
||||
|
||||
### maxPolygonVertices
|
||||
|
||||
> `static` **maxPolygonVertices**: `number` = `12`
|
||||
|
||||
The maximum number of vertices on a convex polygon. You cannot increase this
|
||||
too much because BlockAllocator has a maximum object size.
|
||||
|
||||
***
|
||||
|
||||
### maxRotation
|
||||
|
||||
> `static` **maxRotation**: `number`
|
||||
|
||||
The maximum angular velocity of a body. This limit is very large and is used
|
||||
to prevent numerical problems. You shouldn't need to adjust Settings.
|
||||
|
||||
***
|
||||
|
||||
### maxSubSteps
|
||||
|
||||
> `static` **maxSubSteps**: `number` = `8`
|
||||
|
||||
Maximum number of sub-steps per contact in continuous physics simulation.
|
||||
|
||||
***
|
||||
|
||||
### maxTOIContacts
|
||||
|
||||
> `static` **maxTOIContacts**: `number` = `32`
|
||||
|
||||
Maximum number of contacts to be handled to solve a TOI impact.
|
||||
|
||||
***
|
||||
|
||||
### maxTOIIterations
|
||||
|
||||
> `static` **maxTOIIterations**: `number` = `20`
|
||||
|
||||
Maximum iterations to solve a TOI.
|
||||
|
||||
***
|
||||
|
||||
### maxTranslation
|
||||
|
||||
> `static` **maxTranslation**: `number` = `2.0`
|
||||
|
||||
The maximum linear velocity of a body. This limit is very large and is used
|
||||
to prevent numerical problems. You shouldn't need to adjust Settings.
|
||||
|
||||
***
|
||||
|
||||
### timeToSleep
|
||||
|
||||
> `static` **timeToSleep**: `number` = `0.5`
|
||||
|
||||
The time that a body must be still before it will go to sleep.
|
||||
|
||||
***
|
||||
|
||||
### toiBaugarte
|
||||
|
||||
> `static` **toiBaugarte**: `number` = `0.75`
|
||||
|
||||
***
|
||||
|
||||
### velocityThreshold
|
||||
|
||||
> `static` **velocityThreshold**: `number` = `1.0`
|
||||
|
||||
A velocity threshold for elastic collisions. Any collision with a relative
|
||||
linear velocity below this threshold will be treated as inelastic.
|
||||
|
||||
## Accessors
|
||||
|
||||
### polygonRadius
|
||||
|
||||
#### Get Signature
|
||||
|
||||
> **get** `static` **polygonRadius**(): `number`
|
||||
|
||||
The radius of the polygon/edge shape skin. This should not be modified.
|
||||
Making this smaller means polygons will have an insufficient buffer for
|
||||
continuous collision. Making it larger may create artifacts for vertex
|
||||
collision.
|
||||
|
||||
##### Returns
|
||||
|
||||
`number`
|
||||
@ -1,200 +0,0 @@
|
||||
# Class: `abstract` Shape
|
||||
|
||||
A shape is used for collision detection. You can create a shape however you
|
||||
like. Shapes used for simulation in World are created automatically when a
|
||||
Fixture is created. Shapes may encapsulate one or more child shapes.
|
||||
|
||||
## Extended by
|
||||
|
||||
- [`CircleShape`](/api/classes/CircleShape)
|
||||
- [`EdgeShape`](/api/classes/EdgeShape)
|
||||
- [`PolygonShape`](/api/classes/PolygonShape)
|
||||
- [`ChainShape`](/api/classes/ChainShape)
|
||||
|
||||
## Constructors
|
||||
|
||||
### new Shape()
|
||||
|
||||
> **new Shape**(): [`Shape`](/api/classes/Shape)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Shape`](/api/classes/Shape)
|
||||
|
||||
## Properties
|
||||
|
||||
### style
|
||||
|
||||
> **style**: [`Style`](/api/interfaces/Style) = `{}`
|
||||
|
||||
Styling for dev-tools.
|
||||
|
||||
## Methods
|
||||
|
||||
### computeAABB()
|
||||
|
||||
> `abstract` **computeAABB**(`aabb`, `xf`, `childIndex`): `void`
|
||||
|
||||
Given a transform, compute the associated axis aligned bounding box for a
|
||||
child shape.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **aabb**: [`AABBValue`](/api/interfaces/AABBValue)
|
||||
|
||||
Returns the axis aligned box.
|
||||
|
||||
• **xf**: [`TransformValue`](/api/type-aliases/TransformValue)
|
||||
|
||||
The world transform of the shape.
|
||||
|
||||
• **childIndex**: `number`
|
||||
|
||||
The child shape
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### computeDistanceProxy()
|
||||
|
||||
> `abstract` **computeDistanceProxy**(`proxy`, `childIndex`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **proxy**: [`DistanceProxy`](/api/classes/DistanceProxy)
|
||||
|
||||
• **childIndex**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### computeMass()
|
||||
|
||||
> `abstract` **computeMass**(`massData`, `density`?): `void`
|
||||
|
||||
Compute the mass properties of this shape using its dimensions and density.
|
||||
The inertia tensor is computed about the local origin.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **massData**: [`MassData`](/api/interfaces/MassData)
|
||||
|
||||
Returns the mass data for this shape.
|
||||
|
||||
• **density?**: `number`
|
||||
|
||||
The density in kilograms per meter squared.
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### getChildCount()
|
||||
|
||||
> `abstract` **getChildCount**(): `number`
|
||||
|
||||
Get the number of child primitives.
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### getRadius()
|
||||
|
||||
> `abstract` **getRadius**(): `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### getType()
|
||||
|
||||
> `abstract` **getType**(): [`ShapeType`](/api/type-aliases/ShapeType)
|
||||
|
||||
Get the type of this shape. You can use this to down cast to the concrete
|
||||
shape.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`ShapeType`](/api/type-aliases/ShapeType)
|
||||
|
||||
the shape type.
|
||||
|
||||
***
|
||||
|
||||
### rayCast()
|
||||
|
||||
> `abstract` **rayCast**(`output`, `input`, `xf`, `childIndex`): `boolean`
|
||||
|
||||
Cast a ray against a child shape.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **output**: [`RayCastOutput`](/api/interfaces/RayCastOutput)
|
||||
|
||||
The ray-cast results.
|
||||
|
||||
• **input**: [`RayCastInput`](/api/interfaces/RayCastInput)
|
||||
|
||||
The ray-cast input parameters.
|
||||
|
||||
• **xf**: [`Transform`](/api/classes/Transform)
|
||||
|
||||
The transform to be applied to the shape.
|
||||
|
||||
• **childIndex**: `number`
|
||||
|
||||
The child shape index
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
***
|
||||
|
||||
### testPoint()
|
||||
|
||||
> `abstract` **testPoint**(`xf`, `p`): `boolean`
|
||||
|
||||
Test a point for containment in this shape. This only works for convex
|
||||
shapes.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **xf**: [`TransformValue`](/api/type-aliases/TransformValue)
|
||||
|
||||
The shape world transform.
|
||||
|
||||
• **p**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
A point in world coordinates.
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
***
|
||||
|
||||
### isValid()
|
||||
|
||||
> `static` **isValid**(`obj`): `boolean`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **obj**: `any`
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
@ -1,53 +0,0 @@
|
||||
# Class: ShapeCastInput
|
||||
|
||||
Input parameters for ShapeCast
|
||||
|
||||
## Constructors
|
||||
|
||||
### new ShapeCastInput()
|
||||
|
||||
> **new ShapeCastInput**(): [`ShapeCastInput`](/api/classes/ShapeCastInput)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`ShapeCastInput`](/api/classes/ShapeCastInput)
|
||||
|
||||
## Properties
|
||||
|
||||
### proxyA
|
||||
|
||||
> `readonly` **proxyA**: [`DistanceProxy`](/api/classes/DistanceProxy)
|
||||
|
||||
***
|
||||
|
||||
### proxyB
|
||||
|
||||
> `readonly` **proxyB**: [`DistanceProxy`](/api/classes/DistanceProxy)
|
||||
|
||||
***
|
||||
|
||||
### transformA
|
||||
|
||||
> `readonly` **transformA**: [`Transform`](/api/classes/Transform)
|
||||
|
||||
***
|
||||
|
||||
### transformB
|
||||
|
||||
> `readonly` **transformB**: [`Transform`](/api/classes/Transform)
|
||||
|
||||
***
|
||||
|
||||
### translationB
|
||||
|
||||
> `readonly` **translationB**: [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
## Methods
|
||||
|
||||
### recycle()
|
||||
|
||||
> **recycle**(): `void`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
@ -1,37 +0,0 @@
|
||||
# Class: ShapeCastOutput
|
||||
|
||||
Output results for b2ShapeCast
|
||||
|
||||
## Constructors
|
||||
|
||||
### new ShapeCastOutput()
|
||||
|
||||
> **new ShapeCastOutput**(): [`ShapeCastOutput`](/api/classes/ShapeCastOutput)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`ShapeCastOutput`](/api/classes/ShapeCastOutput)
|
||||
|
||||
## Properties
|
||||
|
||||
### iterations
|
||||
|
||||
> **iterations**: `number` = `0`
|
||||
|
||||
***
|
||||
|
||||
### lambda
|
||||
|
||||
> **lambda**: `number` = `1.0`
|
||||
|
||||
***
|
||||
|
||||
### normal
|
||||
|
||||
> **normal**: [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
***
|
||||
|
||||
### point
|
||||
|
||||
> **point**: [`Vec2`](/api/classes/Vec2)
|
||||
@ -1,53 +0,0 @@
|
||||
# Class: SimplexCache
|
||||
|
||||
Used to warm start Distance. Set count to zero on first call.
|
||||
|
||||
## Constructors
|
||||
|
||||
### new SimplexCache()
|
||||
|
||||
> **new SimplexCache**(): [`SimplexCache`](/api/classes/SimplexCache)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`SimplexCache`](/api/classes/SimplexCache)
|
||||
|
||||
## Properties
|
||||
|
||||
### count
|
||||
|
||||
> **count**: `number` = `0`
|
||||
|
||||
***
|
||||
|
||||
### indexA
|
||||
|
||||
> **indexA**: `number`[] = `[]`
|
||||
|
||||
vertices on shape A
|
||||
|
||||
***
|
||||
|
||||
### indexB
|
||||
|
||||
> **indexB**: `number`[] = `[]`
|
||||
|
||||
vertices on shape B
|
||||
|
||||
***
|
||||
|
||||
### metric
|
||||
|
||||
> **metric**: `number` = `0`
|
||||
|
||||
length or area
|
||||
|
||||
## Methods
|
||||
|
||||
### recycle()
|
||||
|
||||
> **recycle**(): `void`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
@ -1,161 +0,0 @@
|
||||
# Class: Solver
|
||||
|
||||
Finds and solves islands. An island is a connected subset of the world.
|
||||
|
||||
## Constructors
|
||||
|
||||
### new Solver()
|
||||
|
||||
> **new Solver**(`world`): [`Solver`](/api/classes/Solver)
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **world**: [`World`](/api/classes/World)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Solver`](/api/classes/Solver)
|
||||
|
||||
## Properties
|
||||
|
||||
### m\_bodies
|
||||
|
||||
> **m\_bodies**: [`Body`](/api/classes/Body)[]
|
||||
|
||||
***
|
||||
|
||||
### m\_contacts
|
||||
|
||||
> **m\_contacts**: [`Contact`](/api/classes/Contact)[]
|
||||
|
||||
***
|
||||
|
||||
### m\_joints
|
||||
|
||||
> **m\_joints**: [`Joint`](/api/classes/Joint)[]
|
||||
|
||||
***
|
||||
|
||||
### m\_stack
|
||||
|
||||
> **m\_stack**: [`Body`](/api/classes/Body)[]
|
||||
|
||||
***
|
||||
|
||||
### m\_world
|
||||
|
||||
> **m\_world**: [`World`](/api/classes/World)
|
||||
|
||||
## Methods
|
||||
|
||||
### addBody()
|
||||
|
||||
> **addBody**(`body`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **body**: [`Body`](/api/classes/Body)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### addContact()
|
||||
|
||||
> **addContact**(`contact`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **contact**: [`Contact`](/api/classes/Contact)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### addJoint()
|
||||
|
||||
> **addJoint**(`joint`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **joint**: [`Joint`](/api/classes/Joint)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### clear()
|
||||
|
||||
> **clear**(): `void`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### solveIsland()
|
||||
|
||||
> **solveIsland**(`step`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **step**: [`TimeStep`](/api/classes/TimeStep)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### solveIslandTOI()
|
||||
|
||||
> **solveIslandTOI**(`subStep`, `toiA`, `toiB`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **subStep**: [`TimeStep`](/api/classes/TimeStep)
|
||||
|
||||
• **toiA**: [`Body`](/api/classes/Body)
|
||||
|
||||
• **toiB**: [`Body`](/api/classes/Body)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### solveWorld()
|
||||
|
||||
> **solveWorld**(`step`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **step**: [`TimeStep`](/api/classes/TimeStep)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### solveWorldTOI()
|
||||
|
||||
> **solveWorldTOI**(`step`): `void`
|
||||
|
||||
Find TOI contacts and solve them.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **step**: [`TimeStep`](/api/classes/TimeStep)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
@ -1,164 +0,0 @@
|
||||
# Class: Sweep
|
||||
|
||||
This describes the motion of a body/shape for TOI computation. Shapes are
|
||||
defined with respect to the body origin, which may not coincide with the
|
||||
center of mass. However, to support dynamics we must interpolate the center
|
||||
of mass position.
|
||||
|
||||
## Constructors
|
||||
|
||||
### new Sweep()
|
||||
|
||||
> **new Sweep**(): [`Sweep`](/api/classes/Sweep)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Sweep`](/api/classes/Sweep)
|
||||
|
||||
## Properties
|
||||
|
||||
### a
|
||||
|
||||
> **a**: `number` = `0`
|
||||
|
||||
World angle
|
||||
|
||||
***
|
||||
|
||||
### a0
|
||||
|
||||
> **a0**: `number` = `0`
|
||||
|
||||
***
|
||||
|
||||
### alpha0
|
||||
|
||||
> **alpha0**: `number` = `0`
|
||||
|
||||
Fraction of the current time step in the range [0,1], c0 and a0 are c and a at alpha0.
|
||||
|
||||
***
|
||||
|
||||
### c
|
||||
|
||||
> **c**: [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
World center position
|
||||
|
||||
***
|
||||
|
||||
### c0
|
||||
|
||||
> **c0**: [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
***
|
||||
|
||||
### localCenter
|
||||
|
||||
> **localCenter**: [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
Local center of mass position
|
||||
|
||||
## Methods
|
||||
|
||||
### advance()
|
||||
|
||||
> **advance**(`alpha`): `void`
|
||||
|
||||
Advance the sweep forward, yielding a new initial state.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **alpha**: `number`
|
||||
|
||||
The new initial time
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### forward()
|
||||
|
||||
> **forward**(): `void`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### getTransform()
|
||||
|
||||
> **getTransform**(`xf`, `beta`): `void`
|
||||
|
||||
Get the interpolated transform at a specific time.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **xf**: [`TransformValue`](/api/type-aliases/TransformValue)
|
||||
|
||||
• **beta**: `number` = `0`
|
||||
|
||||
A factor in [0,1], where 0 indicates alpha0
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### normalize()
|
||||
|
||||
> **normalize**(): `void`
|
||||
|
||||
normalize the angles in radians to be between -pi and pi.
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### set()
|
||||
|
||||
> **set**(`that`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **that**: [`Sweep`](/api/classes/Sweep)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### setLocalCenter()
|
||||
|
||||
> **setLocalCenter**(`localCenter`, `xf`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **localCenter**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
• **xf**: [`TransformValue`](/api/type-aliases/TransformValue)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### setTransform()
|
||||
|
||||
> **setTransform**(`xf`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **xf**: [`TransformValue`](/api/type-aliases/TransformValue)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
@ -1,55 +0,0 @@
|
||||
# Class: TOIInput
|
||||
|
||||
Input parameters for TimeOfImpact.
|
||||
|
||||
## Constructors
|
||||
|
||||
### new TOIInput()
|
||||
|
||||
> **new TOIInput**(): [`TOIInput`](/api/classes/TOIInput)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`TOIInput`](/api/classes/TOIInput)
|
||||
|
||||
## Properties
|
||||
|
||||
### proxyA
|
||||
|
||||
> **proxyA**: [`DistanceProxy`](/api/classes/DistanceProxy)
|
||||
|
||||
***
|
||||
|
||||
### proxyB
|
||||
|
||||
> **proxyB**: [`DistanceProxy`](/api/classes/DistanceProxy)
|
||||
|
||||
***
|
||||
|
||||
### sweepA
|
||||
|
||||
> **sweepA**: [`Sweep`](/api/classes/Sweep)
|
||||
|
||||
***
|
||||
|
||||
### sweepB
|
||||
|
||||
> **sweepB**: [`Sweep`](/api/classes/Sweep)
|
||||
|
||||
***
|
||||
|
||||
### tMax
|
||||
|
||||
> **tMax**: `number`
|
||||
|
||||
defines sweep interval [0, tMax]
|
||||
|
||||
## Methods
|
||||
|
||||
### recycle()
|
||||
|
||||
> **recycle**(): `void`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
@ -1,35 +0,0 @@
|
||||
# Class: TOIOutput
|
||||
|
||||
Output parameters for TimeOfImpact.
|
||||
|
||||
## Constructors
|
||||
|
||||
### new TOIOutput()
|
||||
|
||||
> **new TOIOutput**(): [`TOIOutput`](/api/classes/TOIOutput)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`TOIOutput`](/api/classes/TOIOutput)
|
||||
|
||||
## Properties
|
||||
|
||||
### state
|
||||
|
||||
> **state**: [`TOIOutputState`](/api/enumerations/TOIOutputState) = `TOIOutputState.e_unset`
|
||||
|
||||
***
|
||||
|
||||
### t
|
||||
|
||||
> **t**: `number` = `-1`
|
||||
|
||||
## Methods
|
||||
|
||||
### recycle()
|
||||
|
||||
> **recycle**(): `void`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
@ -1,397 +0,0 @@
|
||||
# Class: `abstract` Testbed
|
||||
|
||||
## Constructors
|
||||
|
||||
### new Testbed()
|
||||
|
||||
> **new Testbed**(): [`Testbed`](/api/classes/Testbed)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Testbed`](/api/classes/Testbed)
|
||||
|
||||
## Properties
|
||||
|
||||
### activeKeys
|
||||
|
||||
> **activeKeys**: [`ActiveKeys`](/api/type-aliases/ActiveKeys) = `{}`
|
||||
|
||||
***
|
||||
|
||||
### background
|
||||
|
||||
> **background**: `string` = `"#222222"`
|
||||
|
||||
***
|
||||
|
||||
### height
|
||||
|
||||
> **height**: `number` = `60`
|
||||
|
||||
World viewbox height.
|
||||
|
||||
***
|
||||
|
||||
### hz
|
||||
|
||||
> **hz**: `number` = `60`
|
||||
|
||||
World simulation step frequency
|
||||
|
||||
***
|
||||
|
||||
### mouseForce?
|
||||
|
||||
> `optional` **mouseForce**: `number`
|
||||
|
||||
***
|
||||
|
||||
### speed
|
||||
|
||||
> **speed**: `number` = `1`
|
||||
|
||||
World simulation speed, default is 1
|
||||
|
||||
***
|
||||
|
||||
### width
|
||||
|
||||
> **width**: `number` = `80`
|
||||
|
||||
World viewbox width.
|
||||
|
||||
***
|
||||
|
||||
### x
|
||||
|
||||
> **x**: `number` = `0`
|
||||
|
||||
World viewbox center vertical offset.
|
||||
|
||||
***
|
||||
|
||||
### y
|
||||
|
||||
> **y**: `number` = `-10`
|
||||
|
||||
World viewbox center horizontal offset.
|
||||
|
||||
## Methods
|
||||
|
||||
### color()
|
||||
|
||||
> **color**(`r`, `g`, `b`): `string`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **r**: `number`
|
||||
|
||||
• **g**: `number`
|
||||
|
||||
• **b**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`string`
|
||||
|
||||
***
|
||||
|
||||
### drawAABB()
|
||||
|
||||
> `abstract` **drawAABB**(`aabb`, `color`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **aabb**: [`AABBValue`](/api/interfaces/AABBValue)
|
||||
|
||||
• **color**: `string`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### drawCircle()
|
||||
|
||||
> `abstract` **drawCircle**(`p`, `r`, `color`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **p**
|
||||
|
||||
• **p.x**: `number`
|
||||
|
||||
• **p.y**: `number`
|
||||
|
||||
• **r**: `number`
|
||||
|
||||
• **color**: `string`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### drawEdge()
|
||||
|
||||
> `abstract` **drawEdge**(`a`, `b`, `color`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **a**
|
||||
|
||||
• **a.x**: `number`
|
||||
|
||||
• **a.y**: `number`
|
||||
|
||||
• **b**
|
||||
|
||||
• **b.x**: `number`
|
||||
|
||||
• **b.y**: `number`
|
||||
|
||||
• **color**: `string`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### drawPoint()
|
||||
|
||||
> `abstract` **drawPoint**(`p`, `r`, `color`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **p**
|
||||
|
||||
• **p.x**: `number`
|
||||
|
||||
• **p.y**: `number`
|
||||
|
||||
• **r**: `any`
|
||||
|
||||
• **color**: `string`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### drawPolygon()
|
||||
|
||||
> `abstract` **drawPolygon**(`points`, `color`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **points**: `object`[]
|
||||
|
||||
• **color**: `string`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### drawSegment()
|
||||
|
||||
> `abstract` **drawSegment**(`a`, `b`, `color`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **a**
|
||||
|
||||
• **a.x**: `number`
|
||||
|
||||
• **a.y**: `number`
|
||||
|
||||
• **b**
|
||||
|
||||
• **b.x**: `number`
|
||||
|
||||
• **b.y**: `number`
|
||||
|
||||
• **color**: `string`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### findAll()
|
||||
|
||||
> `abstract` **findAll**(`query`): ([`Body`](/api/classes/Body) \| [`Fixture`](/api/classes/Fixture) \| [`Joint`](/api/classes/Joint))[]
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **query**: `string`
|
||||
|
||||
#### Returns
|
||||
|
||||
([`Body`](/api/classes/Body) \| [`Fixture`](/api/classes/Fixture) \| [`Joint`](/api/classes/Joint))[]
|
||||
|
||||
***
|
||||
|
||||
### findOne()
|
||||
|
||||
> `abstract` **findOne**(`query`): [`Body`](/api/classes/Body) \| [`Fixture`](/api/classes/Fixture) \| [`Joint`](/api/classes/Joint)
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **query**: `string`
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Body`](/api/classes/Body) \| [`Fixture`](/api/classes/Fixture) \| [`Joint`](/api/classes/Joint)
|
||||
|
||||
***
|
||||
|
||||
### info()
|
||||
|
||||
> `abstract` **info**(`text`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **text**: `string`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### keydown()
|
||||
|
||||
> **keydown**(`keyCode`, `label`): `void`
|
||||
|
||||
callback, to be implemented by user
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **keyCode**: `number`
|
||||
|
||||
• **label**: `string`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### keyup()
|
||||
|
||||
> **keyup**(`keyCode`, `label`): `void`
|
||||
|
||||
callback, to be implemented by user
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **keyCode**: `number`
|
||||
|
||||
• **label**: `string`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### start()
|
||||
|
||||
> `abstract` **start**(`world`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **world**: [`World`](/api/classes/World)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### status()
|
||||
|
||||
#### status(name, value)
|
||||
|
||||
> `abstract` **status**(`name`, `value`): `void`
|
||||
|
||||
##### Parameters
|
||||
|
||||
• **name**: `string`
|
||||
|
||||
• **value**: `any`
|
||||
|
||||
##### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### status(value)
|
||||
|
||||
> `abstract` **status**(`value`): `void`
|
||||
|
||||
##### Parameters
|
||||
|
||||
• **value**: `string` \| `object`
|
||||
|
||||
##### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### step()
|
||||
|
||||
> **step**(`dt`, `t`): `void`
|
||||
|
||||
callback, to be implemented by user
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **dt**: `number`
|
||||
|
||||
• **t**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### mount()
|
||||
|
||||
> `static` **mount**(`options`?): [`Testbed`](/api/classes/Testbed)
|
||||
|
||||
Mounts testbed. Call start with a world to start simulation and rendering.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **options?**: `TestbedMountOptions`
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Testbed`](/api/classes/Testbed)
|
||||
|
||||
***
|
||||
|
||||
### start()
|
||||
|
||||
> `static` **start**(`world`): [`Testbed`](/api/classes/Testbed)
|
||||
|
||||
Mounts testbed if needed, then starts simulation and rendering.
|
||||
|
||||
If you need to customize testbed before starting, first run `const testbed = Testbed.mount()` and then `testbed.start()`.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **world**: [`World`](/api/classes/World)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Testbed`](/api/classes/Testbed)
|
||||
@ -1,81 +0,0 @@
|
||||
# Class: TimeStep
|
||||
|
||||
## Constructors
|
||||
|
||||
### new TimeStep()
|
||||
|
||||
> **new TimeStep**(): [`TimeStep`](/api/classes/TimeStep)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`TimeStep`](/api/classes/TimeStep)
|
||||
|
||||
## Properties
|
||||
|
||||
### blockSolve
|
||||
|
||||
> **blockSolve**: `boolean` = `true`
|
||||
|
||||
***
|
||||
|
||||
### dt
|
||||
|
||||
> **dt**: `number` = `0`
|
||||
|
||||
time step
|
||||
|
||||
***
|
||||
|
||||
### dtRatio
|
||||
|
||||
> **dtRatio**: `number` = `1`
|
||||
|
||||
dt * inv_dt0
|
||||
|
||||
***
|
||||
|
||||
### inv\_dt
|
||||
|
||||
> **inv\_dt**: `number` = `0`
|
||||
|
||||
inverse time step (0 if dt == 0)
|
||||
|
||||
***
|
||||
|
||||
### inv\_dt0
|
||||
|
||||
> **inv\_dt0**: `number` = `0.0`
|
||||
|
||||
timestep ratio for variable timestep
|
||||
|
||||
***
|
||||
|
||||
### positionIterations
|
||||
|
||||
> **positionIterations**: `number` = `0`
|
||||
|
||||
***
|
||||
|
||||
### velocityIterations
|
||||
|
||||
> **velocityIterations**: `number` = `0`
|
||||
|
||||
***
|
||||
|
||||
### warmStarting
|
||||
|
||||
> **warmStarting**: `boolean` = `false`
|
||||
|
||||
## Methods
|
||||
|
||||
### reset()
|
||||
|
||||
> **reset**(`dt`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **dt**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
@ -1,327 +0,0 @@
|
||||
# Class: Transform
|
||||
|
||||
A transform contains translation and rotation. It is used to represent the
|
||||
position and orientation of rigid frames. Initialize using a position vector
|
||||
and a rotation.
|
||||
|
||||
## Constructors
|
||||
|
||||
### new Transform()
|
||||
|
||||
> **new Transform**(`position`?, `rotation`?): [`Transform`](/api/classes/Transform)
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **position?**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
• **rotation?**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Transform`](/api/classes/Transform)
|
||||
|
||||
## Properties
|
||||
|
||||
### p
|
||||
|
||||
> **p**: [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
position
|
||||
|
||||
***
|
||||
|
||||
### q
|
||||
|
||||
> **q**: [`Rot`](/api/classes/Rot)
|
||||
|
||||
rotation
|
||||
|
||||
## Methods
|
||||
|
||||
### set()
|
||||
|
||||
#### set(position, rotation)
|
||||
|
||||
> **set**(`position`, `rotation`): `void`
|
||||
|
||||
Set position and angle
|
||||
|
||||
##### Parameters
|
||||
|
||||
• **position**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
• **rotation**: `number`
|
||||
|
||||
##### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### set(xf)
|
||||
|
||||
> **set**(`xf`): `void`
|
||||
|
||||
Copy from another transform
|
||||
|
||||
##### Parameters
|
||||
|
||||
• **xf**: [`TransformValue`](/api/type-aliases/TransformValue)
|
||||
|
||||
##### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### setIdentity()
|
||||
|
||||
> **setIdentity**(): `void`
|
||||
|
||||
Set this to the identity transform
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### setNum()
|
||||
|
||||
> **setNum**(`position`, `rotation`): `void`
|
||||
|
||||
Set position and angle
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **position**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
• **rotation**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### setTransform()
|
||||
|
||||
> **setTransform**(`xf`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **xf**: [`TransformValue`](/api/type-aliases/TransformValue)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### assert()
|
||||
|
||||
> `static` **assert**(`o`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **o**: `any`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### clone()
|
||||
|
||||
> `static` **clone**(`xf`): [`Transform`](/api/classes/Transform)
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **xf**: [`Transform`](/api/classes/Transform)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Transform`](/api/classes/Transform)
|
||||
|
||||
***
|
||||
|
||||
### identity()
|
||||
|
||||
> `static` **identity**(): [`Transform`](/api/classes/Transform)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Transform`](/api/classes/Transform)
|
||||
|
||||
***
|
||||
|
||||
### isValid()
|
||||
|
||||
> `static` **isValid**(`obj`): `boolean`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **obj**: `any`
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
***
|
||||
|
||||
### mul()
|
||||
|
||||
#### mul(a, b)
|
||||
|
||||
> `static` **mul**(`a`, `b`): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
##### Parameters
|
||||
|
||||
• **a**: [`TransformValue`](/api/type-aliases/TransformValue)
|
||||
|
||||
• **b**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
##### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
#### mul(a, b)
|
||||
|
||||
> `static` **mul**(`a`, `b`): [`Transform`](/api/classes/Transform)
|
||||
|
||||
##### Parameters
|
||||
|
||||
• **a**: [`TransformValue`](/api/type-aliases/TransformValue)
|
||||
|
||||
• **b**: [`TransformValue`](/api/type-aliases/TransformValue)
|
||||
|
||||
##### Returns
|
||||
|
||||
[`Transform`](/api/classes/Transform)
|
||||
|
||||
***
|
||||
|
||||
### mulAll()
|
||||
|
||||
#### mulAll(a, b)
|
||||
|
||||
> `static` **mulAll**(`a`, `b`): [`Vec2`](/api/classes/Vec2)[]
|
||||
|
||||
##### Parameters
|
||||
|
||||
• **a**: [`Transform`](/api/classes/Transform)
|
||||
|
||||
• **b**: [`Vec2Value`](/api/interfaces/Vec2Value)[]
|
||||
|
||||
##### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)[]
|
||||
|
||||
#### mulAll(a, b)
|
||||
|
||||
> `static` **mulAll**(`a`, `b`): [`Transform`](/api/classes/Transform)[]
|
||||
|
||||
##### Parameters
|
||||
|
||||
• **a**: [`Transform`](/api/classes/Transform)
|
||||
|
||||
• **b**: [`Transform`](/api/classes/Transform)[]
|
||||
|
||||
##### Returns
|
||||
|
||||
[`Transform`](/api/classes/Transform)[]
|
||||
|
||||
***
|
||||
|
||||
### mulT()
|
||||
|
||||
#### mulT(a, b)
|
||||
|
||||
> `static` **mulT**(`a`, `b`): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
##### Parameters
|
||||
|
||||
• **a**: [`TransformValue`](/api/type-aliases/TransformValue)
|
||||
|
||||
• **b**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
##### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
#### mulT(a, b)
|
||||
|
||||
> `static` **mulT**(`a`, `b`): [`Transform`](/api/classes/Transform)
|
||||
|
||||
##### Parameters
|
||||
|
||||
• **a**: [`TransformValue`](/api/type-aliases/TransformValue)
|
||||
|
||||
• **b**: [`TransformValue`](/api/type-aliases/TransformValue)
|
||||
|
||||
##### Returns
|
||||
|
||||
[`Transform`](/api/classes/Transform)
|
||||
|
||||
***
|
||||
|
||||
### mulTVec2()
|
||||
|
||||
> `static` **mulTVec2**(`a`, `b`): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **a**: [`TransformValue`](/api/type-aliases/TransformValue)
|
||||
|
||||
• **b**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
***
|
||||
|
||||
### mulTXf()
|
||||
|
||||
> `static` **mulTXf**(`a`, `b`): [`Transform`](/api/classes/Transform)
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **a**: [`TransformValue`](/api/type-aliases/TransformValue)
|
||||
|
||||
• **b**: [`TransformValue`](/api/type-aliases/TransformValue)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Transform`](/api/classes/Transform)
|
||||
|
||||
***
|
||||
|
||||
### mulVec2()
|
||||
|
||||
> `static` **mulVec2**(`a`, `b`): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **a**: [`TransformValue`](/api/type-aliases/TransformValue)
|
||||
|
||||
• **b**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
***
|
||||
|
||||
### mulXf()
|
||||
|
||||
> `static` **mulXf**(`a`, `b`): [`Transform`](/api/classes/Transform)
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **a**: [`TransformValue`](/api/type-aliases/TransformValue)
|
||||
|
||||
• **b**: [`TransformValue`](/api/type-aliases/TransformValue)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Transform`](/api/classes/Transform)
|
||||
@ -1,77 +0,0 @@
|
||||
# Class: TreeNode\<T\>
|
||||
|
||||
A node in the dynamic tree. The client does not interact with this directly.
|
||||
|
||||
## Type Parameters
|
||||
|
||||
• **T**
|
||||
|
||||
## Constructors
|
||||
|
||||
### new TreeNode()
|
||||
|
||||
> **new TreeNode**\<`T`\>(`id`?): [`TreeNode`](/api/classes/TreeNode)\<`T`\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **id?**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
[`TreeNode`](/api/classes/TreeNode)\<`T`\>
|
||||
|
||||
## Properties
|
||||
|
||||
### aabb
|
||||
|
||||
> **aabb**: [`AABB`](/api/classes/AABB)
|
||||
|
||||
Enlarged AABB
|
||||
|
||||
***
|
||||
|
||||
### child1
|
||||
|
||||
> **child1**: [`TreeNode`](/api/classes/TreeNode)\<`T`\> = `null`
|
||||
|
||||
***
|
||||
|
||||
### child2
|
||||
|
||||
> **child2**: [`TreeNode`](/api/classes/TreeNode)\<`T`\> = `null`
|
||||
|
||||
***
|
||||
|
||||
### height
|
||||
|
||||
> **height**: `number` = `-1`
|
||||
|
||||
0: leaf, -1: free node
|
||||
|
||||
***
|
||||
|
||||
### id
|
||||
|
||||
> **id**: `number`
|
||||
|
||||
***
|
||||
|
||||
### parent
|
||||
|
||||
> **parent**: [`TreeNode`](/api/classes/TreeNode)\<`T`\> = `null`
|
||||
|
||||
***
|
||||
|
||||
### userData
|
||||
|
||||
> **userData**: `T` = `null`
|
||||
|
||||
## Methods
|
||||
|
||||
### isLeaf()
|
||||
|
||||
> **isLeaf**(): `boolean`
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
@ -1,987 +0,0 @@
|
||||
# Class: Vec2
|
||||
|
||||
2D vector
|
||||
|
||||
## Constructors
|
||||
|
||||
### new Vec2()
|
||||
|
||||
> **new Vec2**(`x`, `y`): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **x**: `number`
|
||||
|
||||
• **y**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
### new Vec2()
|
||||
|
||||
> **new Vec2**(`obj`): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **obj**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
### new Vec2()
|
||||
|
||||
> **new Vec2**(): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
## Properties
|
||||
|
||||
### x
|
||||
|
||||
> **x**: `number`
|
||||
|
||||
***
|
||||
|
||||
### y
|
||||
|
||||
> **y**: `number`
|
||||
|
||||
## Methods
|
||||
|
||||
### add()
|
||||
|
||||
> **add**(`w`): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
Add a vector to this vector.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **w**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
this
|
||||
|
||||
***
|
||||
|
||||
### addCombine()
|
||||
|
||||
> **addCombine**(`a`, `v`, `b`, `w`): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
Add linear combination of v and w: `a * v + b * w`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **a**: `number`
|
||||
|
||||
• **v**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
• **b**: `number`
|
||||
|
||||
• **w**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
***
|
||||
|
||||
### addMul()
|
||||
|
||||
> **addMul**(`a`, `v`): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **a**: `number`
|
||||
|
||||
• **v**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
***
|
||||
|
||||
### clamp()
|
||||
|
||||
> **clamp**(`max`): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **max**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
***
|
||||
|
||||
### clone()
|
||||
|
||||
> **clone**(): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
***
|
||||
|
||||
### length()
|
||||
|
||||
> **length**(): `number`
|
||||
|
||||
Get the length of this vector (the norm).
|
||||
|
||||
For performance, use this instead of lengthSquared (if possible).
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### lengthSquared()
|
||||
|
||||
> **lengthSquared**(): `number`
|
||||
|
||||
Get the length squared.
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### mul()
|
||||
|
||||
> **mul**(`m`): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
Multiply this vector by a scalar.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **m**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
this
|
||||
|
||||
***
|
||||
|
||||
### neg()
|
||||
|
||||
> **neg**(): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
***
|
||||
|
||||
### normalize()
|
||||
|
||||
> **normalize**(): `number`
|
||||
|
||||
Convert this vector into a unit vector.
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
old length
|
||||
|
||||
***
|
||||
|
||||
### set()
|
||||
|
||||
Set this vector to some specified coordinates.
|
||||
|
||||
#### set(x, y)
|
||||
|
||||
> **set**(`x`, `y`): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
Set this vector to some specified coordinates.
|
||||
|
||||
##### Parameters
|
||||
|
||||
• **x**: `number`
|
||||
|
||||
• **y**: `number`
|
||||
|
||||
##### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
#### set(value)
|
||||
|
||||
> **set**(`value`): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
Set this vector to some specified coordinates.
|
||||
|
||||
##### Parameters
|
||||
|
||||
• **value**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
##### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
***
|
||||
|
||||
### setCombine()
|
||||
|
||||
> **setCombine**(`a`, `v`, `b`, `w`): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
Set linear combination of v and w: `a * v + b * w`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **a**: `number`
|
||||
|
||||
• **v**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
• **b**: `number`
|
||||
|
||||
• **w**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
***
|
||||
|
||||
### setMul()
|
||||
|
||||
> **setMul**(`a`, `v`): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **a**: `number`
|
||||
|
||||
• **v**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
***
|
||||
|
||||
### setNum()
|
||||
|
||||
> **setNum**(`x`, `y`): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
Set this vector to some specified coordinates.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **x**: `number`
|
||||
|
||||
• **y**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
this
|
||||
|
||||
***
|
||||
|
||||
### setVec2()
|
||||
|
||||
> **setVec2**(`value`): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
Set this vector to some specified coordinates.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **value**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
this
|
||||
|
||||
***
|
||||
|
||||
### setZero()
|
||||
|
||||
> **setZero**(): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
Set this vector to all zeros.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
this
|
||||
|
||||
***
|
||||
|
||||
### sub()
|
||||
|
||||
> **sub**(`w`): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
Subtract a vector from this vector
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **w**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
this
|
||||
|
||||
***
|
||||
|
||||
### subCombine()
|
||||
|
||||
> **subCombine**(`a`, `v`, `b`, `w`): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
Subtract linear combination of v and w: `a * v + b * w`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **a**: `number`
|
||||
|
||||
• **v**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
• **b**: `number`
|
||||
|
||||
• **w**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
***
|
||||
|
||||
### subMul()
|
||||
|
||||
> **subMul**(`a`, `v`): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **a**: `number`
|
||||
|
||||
• **v**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
***
|
||||
|
||||
### ~~wSub()~~
|
||||
|
||||
> **wSub**(`a`, `v`, `b`?, `w`?): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **a**: `number`
|
||||
|
||||
• **v**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
• **b?**: `number`
|
||||
|
||||
• **w?**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
#### Deprecated
|
||||
|
||||
Use subCombine or subMul
|
||||
|
||||
***
|
||||
|
||||
### abs()
|
||||
|
||||
> `static` **abs**(`v`): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **v**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
***
|
||||
|
||||
### add()
|
||||
|
||||
> `static` **add**(`v`, `w`): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **v**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
• **w**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
***
|
||||
|
||||
### addCross()
|
||||
|
||||
#### addCross(a, v, w)
|
||||
|
||||
> `static` **addCross**(`a`, `v`, `w`): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
Returns `a + (v x w)`
|
||||
|
||||
##### Parameters
|
||||
|
||||
• **a**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
• **v**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
• **w**: `number`
|
||||
|
||||
##### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
#### addCross(a, v, w)
|
||||
|
||||
> `static` **addCross**(`a`, `v`, `w`): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
Returns `a + (v x w)`
|
||||
|
||||
##### Parameters
|
||||
|
||||
• **a**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
• **v**: `number`
|
||||
|
||||
• **w**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
##### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
***
|
||||
|
||||
### addCrossNumVec2()
|
||||
|
||||
> `static` **addCrossNumVec2**(`a`, `v`, `w`): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
Returns `a + (v x w)`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **a**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
• **v**: `number`
|
||||
|
||||
• **w**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
***
|
||||
|
||||
### addCrossVec2Num()
|
||||
|
||||
> `static` **addCrossVec2Num**(`a`, `v`, `w`): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
Returns `a + (v x w)`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **a**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
• **v**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
• **w**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
***
|
||||
|
||||
### areEqual()
|
||||
|
||||
> `static` **areEqual**(`v`, `w`): `boolean`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **v**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
• **w**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
***
|
||||
|
||||
### assert()
|
||||
|
||||
> `static` **assert**(`o`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **o**: `any`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### clamp()
|
||||
|
||||
> `static` **clamp**(`v`, `max`): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **v**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
• **max**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
***
|
||||
|
||||
### clone()
|
||||
|
||||
> `static` **clone**(`v`): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **v**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
***
|
||||
|
||||
### combine()
|
||||
|
||||
> `static` **combine**(`a`, `v`, `b`, `w`): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **a**: `number`
|
||||
|
||||
• **v**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
• **b**: `number`
|
||||
|
||||
• **w**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
***
|
||||
|
||||
### cross()
|
||||
|
||||
#### cross(v, w)
|
||||
|
||||
> `static` **cross**(`v`, `w`): `number`
|
||||
|
||||
Cross product between two vectors
|
||||
|
||||
##### Parameters
|
||||
|
||||
• **v**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
• **w**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
##### Returns
|
||||
|
||||
`number`
|
||||
|
||||
#### cross(v, w)
|
||||
|
||||
> `static` **cross**(`v`, `w`): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
Cross product between a vector and a scalar
|
||||
|
||||
##### Parameters
|
||||
|
||||
• **v**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
• **w**: `number`
|
||||
|
||||
##### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
#### cross(v, w)
|
||||
|
||||
> `static` **cross**(`v`, `w`): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
Cross product between a scalar and a vector
|
||||
|
||||
##### Parameters
|
||||
|
||||
• **v**: `number`
|
||||
|
||||
• **w**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
##### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
***
|
||||
|
||||
### crossNumVec2()
|
||||
|
||||
> `static` **crossNumVec2**(`v`, `w`): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
Cross product on a vector and a scalar
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **v**: `number`
|
||||
|
||||
• **w**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
***
|
||||
|
||||
### crossVec2Num()
|
||||
|
||||
> `static` **crossVec2Num**(`v`, `w`): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
Cross product on a vector and a scalar
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **v**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
• **w**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
***
|
||||
|
||||
### crossVec2Vec2()
|
||||
|
||||
> `static` **crossVec2Vec2**(`v`, `w`): `number`
|
||||
|
||||
Cross product on two vectors
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **v**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
• **w**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### distance()
|
||||
|
||||
> `static` **distance**(`v`, `w`): `number`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **v**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
• **w**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### distanceSquared()
|
||||
|
||||
> `static` **distanceSquared**(`v`, `w`): `number`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **v**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
• **w**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### dot()
|
||||
|
||||
> `static` **dot**(`v`, `w`): `number`
|
||||
|
||||
Dot product on two vectors
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **v**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
• **w**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### isValid()
|
||||
|
||||
> `static` **isValid**(`obj`): `boolean`
|
||||
|
||||
Does this vector contain finite coordinates?
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **obj**: `any`
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
***
|
||||
|
||||
### lengthOf()
|
||||
|
||||
> `static` **lengthOf**(`v`): `number`
|
||||
|
||||
Get the length of this vector (the norm).
|
||||
|
||||
For performance, use this instead of lengthSquared (if possible).
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **v**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### lengthSquared()
|
||||
|
||||
> `static` **lengthSquared**(`v`): `number`
|
||||
|
||||
Get the length squared.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **v**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### lower()
|
||||
|
||||
> `static` **lower**(`v`, `w`): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **v**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
• **w**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
***
|
||||
|
||||
### mid()
|
||||
|
||||
> `static` **mid**(`v`, `w`): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **v**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
• **w**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
***
|
||||
|
||||
### mul()
|
||||
|
||||
#### mul(a, b)
|
||||
|
||||
> `static` **mul**(`a`, `b`): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
##### Parameters
|
||||
|
||||
• **a**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
• **b**: `number`
|
||||
|
||||
##### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
#### mul(a, b)
|
||||
|
||||
> `static` **mul**(`a`, `b`): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
##### Parameters
|
||||
|
||||
• **a**: `number`
|
||||
|
||||
• **b**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
##### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
***
|
||||
|
||||
### mulNumVec2()
|
||||
|
||||
> `static` **mulNumVec2**(`a`, `b`): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **a**: `number`
|
||||
|
||||
• **b**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
***
|
||||
|
||||
### mulVec2Num()
|
||||
|
||||
> `static` **mulVec2Num**(`a`, `b`): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **a**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
• **b**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
***
|
||||
|
||||
### neg()
|
||||
|
||||
> `static` **neg**(`v`): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **v**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
***
|
||||
|
||||
### normalize()
|
||||
|
||||
> `static` **normalize**(`v`): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
Returns a new unit vector from the provided vector.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **v**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
new unit vector
|
||||
|
||||
***
|
||||
|
||||
### skew()
|
||||
|
||||
> `static` **skew**(`v`): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
Get the skew vector such that dot(skew_vec, other) == cross(vec, other)
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **v**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
***
|
||||
|
||||
### sub()
|
||||
|
||||
> `static` **sub**(`v`, `w`): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **v**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
• **w**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
***
|
||||
|
||||
### upper()
|
||||
|
||||
> `static` **upper**(`v`, `w`): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **v**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
• **w**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
***
|
||||
|
||||
### zero()
|
||||
|
||||
> `static` **zero**(): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
@ -1,307 +0,0 @@
|
||||
# Class: Vec3
|
||||
|
||||
3D vector
|
||||
|
||||
## Constructors
|
||||
|
||||
### new Vec3()
|
||||
|
||||
> **new Vec3**(`x`, `y`, `z`): [`Vec3`](/api/classes/Vec3)
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **x**: `number`
|
||||
|
||||
• **y**: `number`
|
||||
|
||||
• **z**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec3`](/api/classes/Vec3)
|
||||
|
||||
### new Vec3()
|
||||
|
||||
> **new Vec3**(`obj`): [`Vec3`](/api/classes/Vec3)
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **obj**: [`Vec3Value`](/api/interfaces/Vec3Value)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec3`](/api/classes/Vec3)
|
||||
|
||||
### new Vec3()
|
||||
|
||||
> **new Vec3**(): [`Vec3`](/api/classes/Vec3)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec3`](/api/classes/Vec3)
|
||||
|
||||
## Properties
|
||||
|
||||
### x
|
||||
|
||||
> **x**: `number`
|
||||
|
||||
***
|
||||
|
||||
### y
|
||||
|
||||
> **y**: `number`
|
||||
|
||||
***
|
||||
|
||||
### z
|
||||
|
||||
> **z**: `number`
|
||||
|
||||
## Methods
|
||||
|
||||
### add()
|
||||
|
||||
> **add**(`w`): [`Vec3`](/api/classes/Vec3)
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **w**: [`Vec3Value`](/api/interfaces/Vec3Value)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec3`](/api/classes/Vec3)
|
||||
|
||||
***
|
||||
|
||||
### mul()
|
||||
|
||||
> **mul**(`m`): [`Vec3`](/api/classes/Vec3)
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **m**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec3`](/api/classes/Vec3)
|
||||
|
||||
***
|
||||
|
||||
### neg()
|
||||
|
||||
> **neg**(): [`Vec3`](/api/classes/Vec3)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec3`](/api/classes/Vec3)
|
||||
|
||||
***
|
||||
|
||||
### set()
|
||||
|
||||
> **set**(`x`, `y`, `z`): [`Vec3`](/api/classes/Vec3)
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **x**: `number`
|
||||
|
||||
• **y**: `number`
|
||||
|
||||
• **z**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec3`](/api/classes/Vec3)
|
||||
|
||||
***
|
||||
|
||||
### setZero()
|
||||
|
||||
> **setZero**(): [`Vec3`](/api/classes/Vec3)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec3`](/api/classes/Vec3)
|
||||
|
||||
***
|
||||
|
||||
### sub()
|
||||
|
||||
> **sub**(`w`): [`Vec3`](/api/classes/Vec3)
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **w**: [`Vec3Value`](/api/interfaces/Vec3Value)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec3`](/api/classes/Vec3)
|
||||
|
||||
***
|
||||
|
||||
### add()
|
||||
|
||||
> `static` **add**(`v`, `w`): [`Vec3`](/api/classes/Vec3)
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **v**: [`Vec3Value`](/api/interfaces/Vec3Value)
|
||||
|
||||
• **w**: [`Vec3Value`](/api/interfaces/Vec3Value)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec3`](/api/classes/Vec3)
|
||||
|
||||
***
|
||||
|
||||
### areEqual()
|
||||
|
||||
> `static` **areEqual**(`v`, `w`): `boolean`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **v**: [`Vec3Value`](/api/interfaces/Vec3Value)
|
||||
|
||||
• **w**: [`Vec3Value`](/api/interfaces/Vec3Value)
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
***
|
||||
|
||||
### assert()
|
||||
|
||||
> `static` **assert**(`o`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **o**: `any`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### clone()
|
||||
|
||||
> `static` **clone**(`v`): [`Vec3`](/api/classes/Vec3)
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **v**: [`Vec3Value`](/api/interfaces/Vec3Value)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec3`](/api/classes/Vec3)
|
||||
|
||||
***
|
||||
|
||||
### cross()
|
||||
|
||||
> `static` **cross**(`v`, `w`): [`Vec3`](/api/classes/Vec3)
|
||||
|
||||
Cross product on two vectors
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **v**: [`Vec3Value`](/api/interfaces/Vec3Value)
|
||||
|
||||
• **w**: [`Vec3Value`](/api/interfaces/Vec3Value)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec3`](/api/classes/Vec3)
|
||||
|
||||
***
|
||||
|
||||
### dot()
|
||||
|
||||
> `static` **dot**(`v`, `w`): `number`
|
||||
|
||||
Dot product on two vectors
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **v**: [`Vec3Value`](/api/interfaces/Vec3Value)
|
||||
|
||||
• **w**: [`Vec3Value`](/api/interfaces/Vec3Value)
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### isValid()
|
||||
|
||||
> `static` **isValid**(`obj`): `boolean`
|
||||
|
||||
Does this vector contain finite coordinates?
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **obj**: `any`
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
***
|
||||
|
||||
### mul()
|
||||
|
||||
> `static` **mul**(`v`, `m`): [`Vec3`](/api/classes/Vec3)
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **v**: [`Vec3Value`](/api/interfaces/Vec3Value)
|
||||
|
||||
• **m**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec3`](/api/classes/Vec3)
|
||||
|
||||
***
|
||||
|
||||
### neg()
|
||||
|
||||
> `static` **neg**(`v`): [`Vec3`](/api/classes/Vec3)
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **v**: [`Vec3Value`](/api/interfaces/Vec3Value)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec3`](/api/classes/Vec3)
|
||||
|
||||
***
|
||||
|
||||
### sub()
|
||||
|
||||
> `static` **sub**(`v`, `w`): [`Vec3`](/api/classes/Vec3)
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **v**: [`Vec3Value`](/api/interfaces/Vec3Value)
|
||||
|
||||
• **w**: [`Vec3Value`](/api/interfaces/Vec3Value)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec3`](/api/classes/Vec3)
|
||||
|
||||
***
|
||||
|
||||
### zero()
|
||||
|
||||
> `static` **zero**(): [`Vec3`](/api/classes/Vec3)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec3`](/api/classes/Vec3)
|
||||
@ -1,63 +0,0 @@
|
||||
# Class: VelocityConstraintPoint
|
||||
|
||||
## Constructors
|
||||
|
||||
### new VelocityConstraintPoint()
|
||||
|
||||
> **new VelocityConstraintPoint**(): [`VelocityConstraintPoint`](/api/classes/VelocityConstraintPoint)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`VelocityConstraintPoint`](/api/classes/VelocityConstraintPoint)
|
||||
|
||||
## Properties
|
||||
|
||||
### normalImpulse
|
||||
|
||||
> **normalImpulse**: `number` = `0`
|
||||
|
||||
***
|
||||
|
||||
### normalMass
|
||||
|
||||
> **normalMass**: `number` = `0`
|
||||
|
||||
***
|
||||
|
||||
### rA
|
||||
|
||||
> **rA**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
***
|
||||
|
||||
### rB
|
||||
|
||||
> **rB**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
***
|
||||
|
||||
### tangentImpulse
|
||||
|
||||
> **tangentImpulse**: `number` = `0`
|
||||
|
||||
***
|
||||
|
||||
### tangentMass
|
||||
|
||||
> **tangentMass**: `number` = `0`
|
||||
|
||||
***
|
||||
|
||||
### velocityBias
|
||||
|
||||
> **velocityBias**: `number` = `0`
|
||||
|
||||
## Methods
|
||||
|
||||
### recycle()
|
||||
|
||||
> **recycle**(): `void`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
@ -1,436 +0,0 @@
|
||||
# Class: WeldJoint
|
||||
|
||||
A weld joint essentially glues two bodies together. A weld joint may distort
|
||||
somewhat because the island constraint solver is approximate.
|
||||
|
||||
## Extends
|
||||
|
||||
- [`Joint`](/api/classes/Joint)
|
||||
|
||||
## Constructors
|
||||
|
||||
### new WeldJoint()
|
||||
|
||||
> **new WeldJoint**(`def`): [`WeldJoint`](/api/classes/WeldJoint)
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **def**: [`WeldJointDef`](/api/interfaces/WeldJointDef)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`WeldJoint`](/api/classes/WeldJoint)
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`constructor`](/api/classes/Joint#constructors)
|
||||
|
||||
### new WeldJoint()
|
||||
|
||||
> **new WeldJoint**(`def`, `bodyA`, `bodyB`, `anchor`?): [`WeldJoint`](/api/classes/WeldJoint)
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **def**: [`WeldJointOpt`](/api/interfaces/WeldJointOpt)
|
||||
|
||||
• **bodyA**: [`Body`](/api/classes/Body)
|
||||
|
||||
• **bodyB**: [`Body`](/api/classes/Body)
|
||||
|
||||
• **anchor?**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`WeldJoint`](/api/classes/WeldJoint)
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`constructor`](/api/classes/Joint#constructors)
|
||||
|
||||
## Properties
|
||||
|
||||
### style
|
||||
|
||||
> **style**: [`Style`](/api/interfaces/Style) = `{}`
|
||||
|
||||
Styling for dev-tools.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`style`](/api/classes/Joint#style)
|
||||
|
||||
***
|
||||
|
||||
### TYPE
|
||||
|
||||
> `static` **TYPE**: `"weld-joint"`
|
||||
|
||||
## Methods
|
||||
|
||||
### getAnchorA()
|
||||
|
||||
> **getAnchorA**(): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
Get the anchor point on bodyA in world coordinates.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getAnchorA`](/api/classes/Joint#getanchora)
|
||||
|
||||
***
|
||||
|
||||
### getAnchorB()
|
||||
|
||||
> **getAnchorB**(): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
Get the anchor point on bodyB in world coordinates.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getAnchorB`](/api/classes/Joint#getanchorb)
|
||||
|
||||
***
|
||||
|
||||
### getBodyA()
|
||||
|
||||
> **getBodyA**(): [`Body`](/api/classes/Body)
|
||||
|
||||
Get the first body attached to this joint.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Body`](/api/classes/Body)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getBodyA`](/api/classes/Joint#getbodya)
|
||||
|
||||
***
|
||||
|
||||
### getBodyB()
|
||||
|
||||
> **getBodyB**(): [`Body`](/api/classes/Body)
|
||||
|
||||
Get the second body attached to this joint.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Body`](/api/classes/Body)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getBodyB`](/api/classes/Joint#getbodyb)
|
||||
|
||||
***
|
||||
|
||||
### getCollideConnected()
|
||||
|
||||
> **getCollideConnected**(): `boolean`
|
||||
|
||||
Get collide connected. Note: modifying the collide connect flag won't work
|
||||
correctly because the flag is only checked when fixture AABBs begin to
|
||||
overlap.
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getCollideConnected`](/api/classes/Joint#getcollideconnected)
|
||||
|
||||
***
|
||||
|
||||
### getDampingRatio()
|
||||
|
||||
> **getDampingRatio**(): `number`
|
||||
|
||||
Get damping ratio.
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### getFrequency()
|
||||
|
||||
> **getFrequency**(): `number`
|
||||
|
||||
Get frequency in Hz.
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### getLocalAnchorA()
|
||||
|
||||
> **getLocalAnchorA**(): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
The local anchor point relative to bodyA's origin.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
***
|
||||
|
||||
### getLocalAnchorB()
|
||||
|
||||
> **getLocalAnchorB**(): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
The local anchor point relative to bodyB's origin.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
***
|
||||
|
||||
### getNext()
|
||||
|
||||
> **getNext**(): [`Joint`](/api/classes/Joint)
|
||||
|
||||
Get the next joint the world joint list.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Joint`](/api/classes/Joint)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getNext`](/api/classes/Joint#getnext)
|
||||
|
||||
***
|
||||
|
||||
### getReactionForce()
|
||||
|
||||
> **getReactionForce**(`inv_dt`): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
Get the reaction force on bodyB at the joint anchor in Newtons.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **inv\_dt**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getReactionForce`](/api/classes/Joint#getreactionforce)
|
||||
|
||||
***
|
||||
|
||||
### getReactionTorque()
|
||||
|
||||
> **getReactionTorque**(`inv_dt`): `number`
|
||||
|
||||
Get the reaction torque on bodyB in N*m.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **inv\_dt**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getReactionTorque`](/api/classes/Joint#getreactiontorque)
|
||||
|
||||
***
|
||||
|
||||
### getReferenceAngle()
|
||||
|
||||
> **getReferenceAngle**(): `number`
|
||||
|
||||
Get the reference angle.
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### getType()
|
||||
|
||||
> **getType**(): `string`
|
||||
|
||||
Get the type of the concrete joint.
|
||||
|
||||
#### Returns
|
||||
|
||||
`string`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getType`](/api/classes/Joint#gettype)
|
||||
|
||||
***
|
||||
|
||||
### getUserData()
|
||||
|
||||
> **getUserData**(): `unknown`
|
||||
|
||||
#### Returns
|
||||
|
||||
`unknown`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getUserData`](/api/classes/Joint#getuserdata)
|
||||
|
||||
***
|
||||
|
||||
### initVelocityConstraints()
|
||||
|
||||
> **initVelocityConstraints**(`step`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **step**: [`TimeStep`](/api/classes/TimeStep)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`initVelocityConstraints`](/api/classes/Joint#initvelocityconstraints)
|
||||
|
||||
***
|
||||
|
||||
### isActive()
|
||||
|
||||
> **isActive**(): `boolean`
|
||||
|
||||
Short-cut function to determine if either body is inactive.
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`isActive`](/api/classes/Joint#isactive)
|
||||
|
||||
***
|
||||
|
||||
### setDampingRatio()
|
||||
|
||||
> **setDampingRatio**(`ratio`): `void`
|
||||
|
||||
Set damping ratio.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **ratio**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### setFrequency()
|
||||
|
||||
> **setFrequency**(`hz`): `void`
|
||||
|
||||
Set frequency in Hz.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **hz**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### setUserData()
|
||||
|
||||
> **setUserData**(`data`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **data**: `unknown`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`setUserData`](/api/classes/Joint#setuserdata)
|
||||
|
||||
***
|
||||
|
||||
### shiftOrigin()
|
||||
|
||||
> **shiftOrigin**(`newOrigin`): `void`
|
||||
|
||||
Shift the origin for any points stored in world coordinates.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **newOrigin**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`shiftOrigin`](/api/classes/Joint#shiftorigin)
|
||||
|
||||
***
|
||||
|
||||
### solvePositionConstraints()
|
||||
|
||||
> **solvePositionConstraints**(`step`): `boolean`
|
||||
|
||||
This returns true if the position errors are within tolerance.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **step**: [`TimeStep`](/api/classes/TimeStep)
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`solvePositionConstraints`](/api/classes/Joint#solvepositionconstraints)
|
||||
|
||||
***
|
||||
|
||||
### solveVelocityConstraints()
|
||||
|
||||
> **solveVelocityConstraints**(`step`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **step**: [`TimeStep`](/api/classes/TimeStep)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`solveVelocityConstraints`](/api/classes/Joint#solvevelocityconstraints)
|
||||
@ -1,559 +0,0 @@
|
||||
# Class: WheelJoint
|
||||
|
||||
A wheel joint. This joint provides two degrees of freedom: translation along
|
||||
an axis fixed in bodyA and rotation in the plane. In other words, it is a
|
||||
point to line constraint with a rotational motor and a linear spring/damper.
|
||||
This joint is designed for vehicle suspensions.
|
||||
|
||||
## Extends
|
||||
|
||||
- [`Joint`](/api/classes/Joint)
|
||||
|
||||
## Constructors
|
||||
|
||||
### new WheelJoint()
|
||||
|
||||
> **new WheelJoint**(`def`): [`WheelJoint`](/api/classes/WheelJoint)
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **def**: [`WheelJointDef`](/api/interfaces/WheelJointDef)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`WheelJoint`](/api/classes/WheelJoint)
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`constructor`](/api/classes/Joint#constructors)
|
||||
|
||||
### new WheelJoint()
|
||||
|
||||
> **new WheelJoint**(`def`, `bodyA`, `bodyB`, `anchor`?, `axis`?): [`WheelJoint`](/api/classes/WheelJoint)
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **def**: [`WheelJointOpt`](/api/interfaces/WheelJointOpt)
|
||||
|
||||
• **bodyA**: [`Body`](/api/classes/Body)
|
||||
|
||||
• **bodyB**: [`Body`](/api/classes/Body)
|
||||
|
||||
• **anchor?**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
• **axis?**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`WheelJoint`](/api/classes/WheelJoint)
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`constructor`](/api/classes/Joint#constructors)
|
||||
|
||||
## Properties
|
||||
|
||||
### style
|
||||
|
||||
> **style**: [`Style`](/api/interfaces/Style) = `{}`
|
||||
|
||||
Styling for dev-tools.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`style`](/api/classes/Joint#style)
|
||||
|
||||
***
|
||||
|
||||
### TYPE
|
||||
|
||||
> `static` **TYPE**: `"wheel-joint"`
|
||||
|
||||
## Methods
|
||||
|
||||
### enableMotor()
|
||||
|
||||
> **enableMotor**(`flag`): `void`
|
||||
|
||||
Enable/disable the joint motor.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **flag**: `boolean`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### getAnchorA()
|
||||
|
||||
> **getAnchorA**(): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
Get the anchor point on bodyA in world coordinates.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getAnchorA`](/api/classes/Joint#getanchora)
|
||||
|
||||
***
|
||||
|
||||
### getAnchorB()
|
||||
|
||||
> **getAnchorB**(): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
Get the anchor point on bodyB in world coordinates.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getAnchorB`](/api/classes/Joint#getanchorb)
|
||||
|
||||
***
|
||||
|
||||
### getBodyA()
|
||||
|
||||
> **getBodyA**(): [`Body`](/api/classes/Body)
|
||||
|
||||
Get the first body attached to this joint.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Body`](/api/classes/Body)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getBodyA`](/api/classes/Joint#getbodya)
|
||||
|
||||
***
|
||||
|
||||
### getBodyB()
|
||||
|
||||
> **getBodyB**(): [`Body`](/api/classes/Body)
|
||||
|
||||
Get the second body attached to this joint.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Body`](/api/classes/Body)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getBodyB`](/api/classes/Joint#getbodyb)
|
||||
|
||||
***
|
||||
|
||||
### getCollideConnected()
|
||||
|
||||
> **getCollideConnected**(): `boolean`
|
||||
|
||||
Get collide connected. Note: modifying the collide connect flag won't work
|
||||
correctly because the flag is only checked when fixture AABBs begin to
|
||||
overlap.
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getCollideConnected`](/api/classes/Joint#getcollideconnected)
|
||||
|
||||
***
|
||||
|
||||
### getJointSpeed()
|
||||
|
||||
> **getJointSpeed**(): `number`
|
||||
|
||||
Get the current joint translation speed, usually in meters per second.
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### getJointTranslation()
|
||||
|
||||
> **getJointTranslation**(): `number`
|
||||
|
||||
Get the current joint translation, usually in meters.
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### getLocalAnchorA()
|
||||
|
||||
> **getLocalAnchorA**(): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
The local anchor point relative to bodyA's origin.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
***
|
||||
|
||||
### getLocalAnchorB()
|
||||
|
||||
> **getLocalAnchorB**(): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
The local anchor point relative to bodyB's origin.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
***
|
||||
|
||||
### getLocalAxisA()
|
||||
|
||||
> **getLocalAxisA**(): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
The local joint axis relative to bodyA.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
***
|
||||
|
||||
### getMaxMotorTorque()
|
||||
|
||||
> **getMaxMotorTorque**(): `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### getMotorSpeed()
|
||||
|
||||
> **getMotorSpeed**(): `number`
|
||||
|
||||
Get the motor speed, usually in radians per second.
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### getMotorTorque()
|
||||
|
||||
> **getMotorTorque**(`inv_dt`): `number`
|
||||
|
||||
Get the current motor torque given the inverse time step, usually in N-m.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **inv\_dt**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### getNext()
|
||||
|
||||
> **getNext**(): [`Joint`](/api/classes/Joint)
|
||||
|
||||
Get the next joint the world joint list.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Joint`](/api/classes/Joint)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getNext`](/api/classes/Joint#getnext)
|
||||
|
||||
***
|
||||
|
||||
### getReactionForce()
|
||||
|
||||
> **getReactionForce**(`inv_dt`): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
Get the reaction force on bodyB at the joint anchor in Newtons.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **inv\_dt**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getReactionForce`](/api/classes/Joint#getreactionforce)
|
||||
|
||||
***
|
||||
|
||||
### getReactionTorque()
|
||||
|
||||
> **getReactionTorque**(`inv_dt`): `number`
|
||||
|
||||
Get the reaction torque on bodyB in N*m.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **inv\_dt**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getReactionTorque`](/api/classes/Joint#getreactiontorque)
|
||||
|
||||
***
|
||||
|
||||
### getSpringDampingRatio()
|
||||
|
||||
> **getSpringDampingRatio**(): `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### getSpringFrequencyHz()
|
||||
|
||||
> **getSpringFrequencyHz**(): `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### getType()
|
||||
|
||||
> **getType**(): `string`
|
||||
|
||||
Get the type of the concrete joint.
|
||||
|
||||
#### Returns
|
||||
|
||||
`string`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getType`](/api/classes/Joint#gettype)
|
||||
|
||||
***
|
||||
|
||||
### getUserData()
|
||||
|
||||
> **getUserData**(): `unknown`
|
||||
|
||||
#### Returns
|
||||
|
||||
`unknown`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getUserData`](/api/classes/Joint#getuserdata)
|
||||
|
||||
***
|
||||
|
||||
### initVelocityConstraints()
|
||||
|
||||
> **initVelocityConstraints**(`step`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **step**: [`TimeStep`](/api/classes/TimeStep)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`initVelocityConstraints`](/api/classes/Joint#initvelocityconstraints)
|
||||
|
||||
***
|
||||
|
||||
### isActive()
|
||||
|
||||
> **isActive**(): `boolean`
|
||||
|
||||
Short-cut function to determine if either body is inactive.
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`isActive`](/api/classes/Joint#isactive)
|
||||
|
||||
***
|
||||
|
||||
### isMotorEnabled()
|
||||
|
||||
> **isMotorEnabled**(): `boolean`
|
||||
|
||||
Is the joint motor enabled?
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
***
|
||||
|
||||
### setMaxMotorTorque()
|
||||
|
||||
> **setMaxMotorTorque**(`torque`): `void`
|
||||
|
||||
Set/Get the maximum motor force, usually in N-m.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **torque**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### setMotorSpeed()
|
||||
|
||||
> **setMotorSpeed**(`speed`): `void`
|
||||
|
||||
Set the motor speed, usually in radians per second.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **speed**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### setSpringDampingRatio()
|
||||
|
||||
> **setSpringDampingRatio**(`ratio`): `void`
|
||||
|
||||
Set/Get the spring damping ratio
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **ratio**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### setSpringFrequencyHz()
|
||||
|
||||
> **setSpringFrequencyHz**(`hz`): `void`
|
||||
|
||||
Set/Get the spring frequency in hertz. Setting the frequency to zero disables
|
||||
the spring.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **hz**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### setUserData()
|
||||
|
||||
> **setUserData**(`data`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **data**: `unknown`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`setUserData`](/api/classes/Joint#setuserdata)
|
||||
|
||||
***
|
||||
|
||||
### shiftOrigin()
|
||||
|
||||
> **shiftOrigin**(`newOrigin`): `void`
|
||||
|
||||
Shift the origin for any points stored in world coordinates.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **newOrigin**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`shiftOrigin`](/api/classes/Joint#shiftorigin)
|
||||
|
||||
***
|
||||
|
||||
### solvePositionConstraints()
|
||||
|
||||
> **solvePositionConstraints**(`step`): `boolean`
|
||||
|
||||
This returns true if the position errors are within tolerance.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **step**: [`TimeStep`](/api/classes/TimeStep)
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`solvePositionConstraints`](/api/classes/Joint#solvepositionconstraints)
|
||||
|
||||
***
|
||||
|
||||
### solveVelocityConstraints()
|
||||
|
||||
> **solveVelocityConstraints**(`step`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **step**: [`TimeStep`](/api/classes/TimeStep)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`solveVelocityConstraints`](/api/classes/Joint#solvevelocityconstraints)
|
||||
@ -1,885 +0,0 @@
|
||||
# Class: World
|
||||
|
||||
The `World` class contains the bodies and joints. It manages all aspects
|
||||
of the simulation and allows for asynchronous queries (like AABB queries
|
||||
and ray-casts). Much of your interactions with Planck.js will be with a
|
||||
World object.
|
||||
|
||||
## Constructors
|
||||
|
||||
### new World()
|
||||
|
||||
> **new World**(`def`?): [`World`](/api/classes/World)
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **def?**: [`Vec2Value`](/api/interfaces/Vec2Value) \| [`WorldDef`](/api/interfaces/WorldDef)
|
||||
|
||||
World definition or gravity vector.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`World`](/api/classes/World)
|
||||
|
||||
## Methods
|
||||
|
||||
### clearForces()
|
||||
|
||||
> **clearForces**(): `void`
|
||||
|
||||
Manually clear the force buffer on all bodies. By default, forces are cleared
|
||||
automatically after each call to step. The default behavior is modified by
|
||||
calling setAutoClearForces. The purpose of this function is to support
|
||||
sub-stepping. Sub-stepping is often used to maintain a fixed sized time step
|
||||
under a variable frame-rate. When you perform sub-stepping you will disable
|
||||
auto clearing of forces and instead call clearForces after all sub-steps are
|
||||
complete in one pass of your game loop.
|
||||
|
||||
See [World.setAutoClearForces](/api/classes/World#setautoclearforces)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### createBody()
|
||||
|
||||
#### createBody(def)
|
||||
|
||||
> **createBody**(`def`?): [`Body`](/api/classes/Body)
|
||||
|
||||
Create a rigid body given a definition. No reference to the definition is
|
||||
retained.
|
||||
|
||||
Warning: This function is locked during callbacks.
|
||||
|
||||
##### Parameters
|
||||
|
||||
• **def?**: [`BodyDef`](/api/interfaces/BodyDef)
|
||||
|
||||
##### Returns
|
||||
|
||||
[`Body`](/api/classes/Body)
|
||||
|
||||
#### createBody(position, angle)
|
||||
|
||||
> **createBody**(`position`, `angle`?): [`Body`](/api/classes/Body)
|
||||
|
||||
##### Parameters
|
||||
|
||||
• **position**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
• **angle?**: `number`
|
||||
|
||||
##### Returns
|
||||
|
||||
[`Body`](/api/classes/Body)
|
||||
|
||||
***
|
||||
|
||||
### createDynamicBody()
|
||||
|
||||
#### createDynamicBody(def)
|
||||
|
||||
> **createDynamicBody**(`def`?): [`Body`](/api/classes/Body)
|
||||
|
||||
##### Parameters
|
||||
|
||||
• **def?**: [`BodyDef`](/api/interfaces/BodyDef)
|
||||
|
||||
##### Returns
|
||||
|
||||
[`Body`](/api/classes/Body)
|
||||
|
||||
#### createDynamicBody(position, angle)
|
||||
|
||||
> **createDynamicBody**(`position`, `angle`?): [`Body`](/api/classes/Body)
|
||||
|
||||
##### Parameters
|
||||
|
||||
• **position**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
• **angle?**: `number`
|
||||
|
||||
##### Returns
|
||||
|
||||
[`Body`](/api/classes/Body)
|
||||
|
||||
***
|
||||
|
||||
### createJoint()
|
||||
|
||||
> **createJoint**\<`T`\>(`joint`): `T`
|
||||
|
||||
Create a joint to constrain bodies together. No reference to the definition
|
||||
is retained. This may cause the connected bodies to cease colliding.
|
||||
|
||||
Warning: This function is locked during callbacks.
|
||||
|
||||
#### Type Parameters
|
||||
|
||||
• **T** *extends* [`Joint`](/api/classes/Joint)
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **joint**: `T`
|
||||
|
||||
#### Returns
|
||||
|
||||
`T`
|
||||
|
||||
***
|
||||
|
||||
### createKinematicBody()
|
||||
|
||||
#### createKinematicBody(def)
|
||||
|
||||
> **createKinematicBody**(`def`?): [`Body`](/api/classes/Body)
|
||||
|
||||
##### Parameters
|
||||
|
||||
• **def?**: [`BodyDef`](/api/interfaces/BodyDef)
|
||||
|
||||
##### Returns
|
||||
|
||||
[`Body`](/api/classes/Body)
|
||||
|
||||
#### createKinematicBody(position, angle)
|
||||
|
||||
> **createKinematicBody**(`position`, `angle`?): [`Body`](/api/classes/Body)
|
||||
|
||||
##### Parameters
|
||||
|
||||
• **position**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
• **angle?**: `number`
|
||||
|
||||
##### Returns
|
||||
|
||||
[`Body`](/api/classes/Body)
|
||||
|
||||
***
|
||||
|
||||
### destroyBody()
|
||||
|
||||
> **destroyBody**(`b`): `boolean`
|
||||
|
||||
Destroy a rigid body given a definition. No reference to the definition is
|
||||
retained.
|
||||
|
||||
Warning: This automatically deletes all associated shapes and joints.
|
||||
|
||||
Warning: This function is locked during callbacks.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **b**: [`Body`](/api/classes/Body)
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
***
|
||||
|
||||
### destroyJoint()
|
||||
|
||||
> **destroyJoint**(`joint`): `void`
|
||||
|
||||
Destroy a joint. This may cause the connected bodies to begin colliding.
|
||||
Warning: This function is locked during callbacks.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **joint**: [`Joint`](/api/classes/Joint)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### getAllowSleeping()
|
||||
|
||||
> **getAllowSleeping**(): `boolean`
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
***
|
||||
|
||||
### getAutoClearForces()
|
||||
|
||||
> **getAutoClearForces**(): `boolean`
|
||||
|
||||
Get the flag that controls automatic clearing of forces after each time step.
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
***
|
||||
|
||||
### getBodyCount()
|
||||
|
||||
> **getBodyCount**(): `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### getBodyList()
|
||||
|
||||
> **getBodyList**(): [`Body`](/api/classes/Body)
|
||||
|
||||
Get the world body list. With the returned body, use Body.getNext to get the
|
||||
next body in the world list. A null body indicates the end of the list.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Body`](/api/classes/Body)
|
||||
|
||||
the head of the world body list.
|
||||
|
||||
***
|
||||
|
||||
### getContactCount()
|
||||
|
||||
> **getContactCount**(): `number`
|
||||
|
||||
Get the number of contacts (each may have 0 or more contact points).
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### getContactList()
|
||||
|
||||
> **getContactList**(): [`Contact`](/api/classes/Contact)
|
||||
|
||||
Get the world contact list. With the returned contact, use Contact.getNext to
|
||||
get the next contact in the world list. A null contact indicates the end of
|
||||
the list.
|
||||
|
||||
Warning: contacts are created and destroyed in the middle of a time step.
|
||||
Use ContactListener to avoid missing contacts.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Contact`](/api/classes/Contact)
|
||||
|
||||
the head of the world contact list.
|
||||
|
||||
***
|
||||
|
||||
### getContinuousPhysics()
|
||||
|
||||
> **getContinuousPhysics**(): `boolean`
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
***
|
||||
|
||||
### getGravity()
|
||||
|
||||
> **getGravity**(): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
Get the global gravity vector.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
***
|
||||
|
||||
### getJointCount()
|
||||
|
||||
> **getJointCount**(): `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### getJointList()
|
||||
|
||||
> **getJointList**(): [`Joint`](/api/classes/Joint)
|
||||
|
||||
Get the world joint list. With the returned joint, use Joint.getNext to get
|
||||
the next joint in the world list. A null joint indicates the end of the list.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Joint`](/api/classes/Joint)
|
||||
|
||||
the head of the world joint list.
|
||||
|
||||
***
|
||||
|
||||
### getProxyCount()
|
||||
|
||||
> **getProxyCount**(): `number`
|
||||
|
||||
Get the number of broad-phase proxies.
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### getSubStepping()
|
||||
|
||||
> **getSubStepping**(): `boolean`
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
***
|
||||
|
||||
### getTreeBalance()
|
||||
|
||||
> **getTreeBalance**(): `number`
|
||||
|
||||
Get the balance of broad-phase dynamic tree.
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### getTreeHeight()
|
||||
|
||||
> **getTreeHeight**(): `number`
|
||||
|
||||
Get the height of broad-phase dynamic tree.
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### getTreeQuality()
|
||||
|
||||
> **getTreeQuality**(): `number`
|
||||
|
||||
Get the quality metric of broad-phase dynamic tree. The smaller the better.
|
||||
The minimum is 1.
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### getWarmStarting()
|
||||
|
||||
> **getWarmStarting**(): `boolean`
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
***
|
||||
|
||||
### isLocked()
|
||||
|
||||
> **isLocked**(): `boolean`
|
||||
|
||||
Is the world locked (in the middle of a time step).
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
***
|
||||
|
||||
### off()
|
||||
|
||||
Remove an event listener.
|
||||
|
||||
#### off(name, listener)
|
||||
|
||||
> **off**(`name`, `listener`): [`World`](/api/classes/World)
|
||||
|
||||
Remove an event listener.
|
||||
|
||||
##### Parameters
|
||||
|
||||
• **name**: `"begin-contact"`
|
||||
|
||||
• **listener**
|
||||
|
||||
##### Returns
|
||||
|
||||
[`World`](/api/classes/World)
|
||||
|
||||
#### off(name, listener)
|
||||
|
||||
> **off**(`name`, `listener`): [`World`](/api/classes/World)
|
||||
|
||||
Remove an event listener.
|
||||
|
||||
##### Parameters
|
||||
|
||||
• **name**: `"end-contact"`
|
||||
|
||||
• **listener**
|
||||
|
||||
##### Returns
|
||||
|
||||
[`World`](/api/classes/World)
|
||||
|
||||
#### off(name, listener)
|
||||
|
||||
> **off**(`name`, `listener`): [`World`](/api/classes/World)
|
||||
|
||||
Remove an event listener.
|
||||
|
||||
##### Parameters
|
||||
|
||||
• **name**: `"pre-solve"`
|
||||
|
||||
• **listener**
|
||||
|
||||
##### Returns
|
||||
|
||||
[`World`](/api/classes/World)
|
||||
|
||||
#### off(name, listener)
|
||||
|
||||
> **off**(`name`, `listener`): [`World`](/api/classes/World)
|
||||
|
||||
Remove an event listener.
|
||||
|
||||
##### Parameters
|
||||
|
||||
• **name**: `"post-solve"`
|
||||
|
||||
• **listener**
|
||||
|
||||
##### Returns
|
||||
|
||||
[`World`](/api/classes/World)
|
||||
|
||||
#### off(name, listener)
|
||||
|
||||
> **off**(`name`, `listener`): [`World`](/api/classes/World)
|
||||
|
||||
Remove an event listener.
|
||||
|
||||
##### Parameters
|
||||
|
||||
• **name**: `"remove-body"`
|
||||
|
||||
• **listener**
|
||||
|
||||
##### Returns
|
||||
|
||||
[`World`](/api/classes/World)
|
||||
|
||||
#### off(name, listener)
|
||||
|
||||
> **off**(`name`, `listener`): [`World`](/api/classes/World)
|
||||
|
||||
Remove an event listener.
|
||||
|
||||
##### Parameters
|
||||
|
||||
• **name**: `"remove-joint"`
|
||||
|
||||
• **listener**
|
||||
|
||||
##### Returns
|
||||
|
||||
[`World`](/api/classes/World)
|
||||
|
||||
#### off(name, listener)
|
||||
|
||||
> **off**(`name`, `listener`): [`World`](/api/classes/World)
|
||||
|
||||
Remove an event listener.
|
||||
|
||||
##### Parameters
|
||||
|
||||
• **name**: `"remove-fixture"`
|
||||
|
||||
• **listener**
|
||||
|
||||
##### Returns
|
||||
|
||||
[`World`](/api/classes/World)
|
||||
|
||||
***
|
||||
|
||||
### on()
|
||||
|
||||
Register an event listener.
|
||||
|
||||
#### on(name, listener)
|
||||
|
||||
> **on**(`name`, `listener`): [`World`](/api/classes/World)
|
||||
|
||||
Called when two fixtures begin to touch.
|
||||
|
||||
Implement contact callbacks to get contact information. You can use these
|
||||
results for things like sounds and game logic. You can also get contact
|
||||
results by traversing the contact lists after the time step. However, you
|
||||
might miss some contacts because continuous physics leads to sub-stepping.
|
||||
Additionally you may receive multiple callbacks for the same contact in a
|
||||
single time step. You should strive to make your callbacks efficient because
|
||||
there may be many callbacks per time step.
|
||||
|
||||
Warning: You cannot create/destroy world entities inside these callbacks.
|
||||
|
||||
##### Parameters
|
||||
|
||||
• **name**: `"begin-contact"`
|
||||
|
||||
• **listener**
|
||||
|
||||
##### Returns
|
||||
|
||||
[`World`](/api/classes/World)
|
||||
|
||||
#### on(name, listener)
|
||||
|
||||
> **on**(`name`, `listener`): [`World`](/api/classes/World)
|
||||
|
||||
Called when two fixtures cease to touch.
|
||||
|
||||
Implement contact callbacks to get contact information. You can use these
|
||||
results for things like sounds and game logic. You can also get contact
|
||||
results by traversing the contact lists after the time step. However, you
|
||||
might miss some contacts because continuous physics leads to sub-stepping.
|
||||
Additionally you may receive multiple callbacks for the same contact in a
|
||||
single time step. You should strive to make your callbacks efficient because
|
||||
there may be many callbacks per time step.
|
||||
|
||||
Warning: You cannot create/destroy world entities inside these callbacks.
|
||||
|
||||
##### Parameters
|
||||
|
||||
• **name**: `"end-contact"`
|
||||
|
||||
• **listener**
|
||||
|
||||
##### Returns
|
||||
|
||||
[`World`](/api/classes/World)
|
||||
|
||||
#### on(name, listener)
|
||||
|
||||
> **on**(`name`, `listener`): [`World`](/api/classes/World)
|
||||
|
||||
This is called after a contact is updated. This allows you to inspect a
|
||||
contact before it goes to the solver. If you are careful, you can modify the
|
||||
contact manifold (e.g. disable contact). A copy of the old manifold is
|
||||
provided so that you can detect changes. Note: this is called only for awake
|
||||
bodies. Note: this is called even when the number of contact points is zero.
|
||||
Note: this is not called for sensors. Note: if you set the number of contact
|
||||
points to zero, you will not get an end-contact callback. However, you may get
|
||||
a begin-contact callback the next step.
|
||||
|
||||
Warning: You cannot create/destroy world entities inside these callbacks.
|
||||
|
||||
##### Parameters
|
||||
|
||||
• **name**: `"pre-solve"`
|
||||
|
||||
• **listener**
|
||||
|
||||
##### Returns
|
||||
|
||||
[`World`](/api/classes/World)
|
||||
|
||||
#### on(name, listener)
|
||||
|
||||
> **on**(`name`, `listener`): [`World`](/api/classes/World)
|
||||
|
||||
This lets you inspect a contact after the solver is finished. This is useful
|
||||
for inspecting impulses. Note: the contact manifold does not include time of
|
||||
impact impulses, which can be arbitrarily large if the sub-step is small.
|
||||
Hence the impulse is provided explicitly in a separate data structure. Note:
|
||||
this is only called for contacts that are touching, solid, and awake.
|
||||
|
||||
Warning: You cannot create/destroy world entities inside these callbacks.
|
||||
|
||||
##### Parameters
|
||||
|
||||
• **name**: `"post-solve"`
|
||||
|
||||
• **listener**
|
||||
|
||||
##### Returns
|
||||
|
||||
[`World`](/api/classes/World)
|
||||
|
||||
#### on(name, listener)
|
||||
|
||||
> **on**(`name`, `listener`): [`World`](/api/classes/World)
|
||||
|
||||
Listener is called whenever a body is removed.
|
||||
|
||||
##### Parameters
|
||||
|
||||
• **name**: `"remove-body"`
|
||||
|
||||
• **listener**
|
||||
|
||||
##### Returns
|
||||
|
||||
[`World`](/api/classes/World)
|
||||
|
||||
#### on(name, listener)
|
||||
|
||||
> **on**(`name`, `listener`): [`World`](/api/classes/World)
|
||||
|
||||
Listener is called whenever a joint is removed implicitly or explicitly.
|
||||
|
||||
##### Parameters
|
||||
|
||||
• **name**: `"remove-joint"`
|
||||
|
||||
• **listener**
|
||||
|
||||
##### Returns
|
||||
|
||||
[`World`](/api/classes/World)
|
||||
|
||||
#### on(name, listener)
|
||||
|
||||
> **on**(`name`, `listener`): [`World`](/api/classes/World)
|
||||
|
||||
Listener is called whenever a fixture is removed implicitly or explicitly.
|
||||
|
||||
##### Parameters
|
||||
|
||||
• **name**: `"remove-fixture"`
|
||||
|
||||
• **listener**
|
||||
|
||||
##### Returns
|
||||
|
||||
[`World`](/api/classes/World)
|
||||
|
||||
***
|
||||
|
||||
### publish()
|
||||
|
||||
> **publish**(`name`, `arg1`?, `arg2`?, `arg3`?): `number`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **name**: `string`
|
||||
|
||||
• **arg1?**: `any`
|
||||
|
||||
• **arg2?**: `any`
|
||||
|
||||
• **arg3?**: `any`
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### queryAABB()
|
||||
|
||||
> **queryAABB**(`aabb`, `callback`): `void`
|
||||
|
||||
Query the world for all fixtures that potentially overlap the provided AABB.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **aabb**: [`AABBValue`](/api/interfaces/AABBValue)
|
||||
|
||||
The query box.
|
||||
|
||||
• **callback**: [`WorldAABBQueryCallback`](/api/type-aliases/WorldAABBQueryCallback)
|
||||
|
||||
Called for each fixture found in the query AABB. It may return `false` to terminate the query.
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### rayCast()
|
||||
|
||||
> **rayCast**(`point1`, `point2`, `callback`): `void`
|
||||
|
||||
Ray-cast the world for all fixtures in the path of the ray. Your callback
|
||||
controls whether you get the closest point, any point, or n-points. The
|
||||
ray-cast ignores shapes that contain the starting point.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **point1**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
The ray starting point
|
||||
|
||||
• **point2**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
The ray ending point
|
||||
|
||||
• **callback**: [`WorldRayCastCallback`](/api/type-aliases/WorldRayCastCallback)
|
||||
|
||||
A function that is called for each fixture that is hit by the ray. You control how the ray cast proceeds by returning a numeric/float value.
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### setAllowSleeping()
|
||||
|
||||
> **setAllowSleeping**(`flag`): `void`
|
||||
|
||||
Enable/disable sleep.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **flag**: `boolean`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### setAutoClearForces()
|
||||
|
||||
> **setAutoClearForces**(`flag`): `void`
|
||||
|
||||
Set flag to control automatic clearing of forces after each time step.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **flag**: `boolean`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### setContinuousPhysics()
|
||||
|
||||
> **setContinuousPhysics**(`flag`): `void`
|
||||
|
||||
Enable/disable continuous physics. For testing.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **flag**: `boolean`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### setGravity()
|
||||
|
||||
> **setGravity**(`gravity`): `void`
|
||||
|
||||
Change the global gravity vector.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **gravity**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### setSubStepping()
|
||||
|
||||
> **setSubStepping**(`flag`): `void`
|
||||
|
||||
Enable/disable single stepped continuous physics. For testing.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **flag**: `boolean`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### setWarmStarting()
|
||||
|
||||
> **setWarmStarting**(`flag`): `void`
|
||||
|
||||
Enable/disable warm starting. For testing.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **flag**: `boolean`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### shiftOrigin()
|
||||
|
||||
> **shiftOrigin**(`newOrigin`): `void`
|
||||
|
||||
Shift the world origin. Useful for large worlds. The body shift formula is:
|
||||
position -= newOrigin
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **newOrigin**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
The new origin with respect to the old origin
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### step()
|
||||
|
||||
> **step**(`timeStep`, `velocityIterations`?, `positionIterations`?): `void`
|
||||
|
||||
Take a time step. This performs collision detection, integration, and
|
||||
constraint solution.
|
||||
|
||||
Broad-phase, narrow-phase, solve and solve time of impacts.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **timeStep**: `number`
|
||||
|
||||
Time step, this should not vary.
|
||||
|
||||
• **velocityIterations?**: `number`
|
||||
|
||||
• **positionIterations?**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
@ -1,55 +0,0 @@
|
||||
# Class: WorldManifold
|
||||
|
||||
This is used to compute the current state of a contact manifold.
|
||||
|
||||
## Constructors
|
||||
|
||||
### new WorldManifold()
|
||||
|
||||
> **new WorldManifold**(): [`WorldManifold`](/api/classes/WorldManifold)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`WorldManifold`](/api/classes/WorldManifold)
|
||||
|
||||
## Properties
|
||||
|
||||
### normal
|
||||
|
||||
> **normal**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
World vector pointing from A to B
|
||||
|
||||
***
|
||||
|
||||
### pointCount
|
||||
|
||||
> **pointCount**: `number` = `0`
|
||||
|
||||
The number of manifold points
|
||||
|
||||
***
|
||||
|
||||
### points
|
||||
|
||||
> **points**: [`Vec2Value`](/api/interfaces/Vec2Value)[]
|
||||
|
||||
World contact point (point of intersection)
|
||||
|
||||
***
|
||||
|
||||
### separations
|
||||
|
||||
> **separations**: `number`[]
|
||||
|
||||
A negative value indicates overlap, in meters
|
||||
|
||||
## Methods
|
||||
|
||||
### recycle()
|
||||
|
||||
> **recycle**(): `void`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
@ -1,297 +0,0 @@
|
||||
# Class: AABB
|
||||
|
||||
Axis-aligned bounding box
|
||||
|
||||
## Constructors
|
||||
|
||||
### new AABB()
|
||||
|
||||
> **new AABB**(`lower`?, `upper`?): [`AABB`](/api/classes/AABB)
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **lower?**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
• **upper?**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`AABB`](/api/classes/AABB)
|
||||
|
||||
## Properties
|
||||
|
||||
### lowerBound
|
||||
|
||||
> **lowerBound**: [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
***
|
||||
|
||||
### upperBound
|
||||
|
||||
> **upperBound**: [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
## Methods
|
||||
|
||||
### combine()
|
||||
|
||||
> **combine**(`a`, `b`?): `void`
|
||||
|
||||
Combine one or two AABB into this one.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **a**: [`AABBValue`](/api/interfaces/AABBValue)
|
||||
|
||||
• **b?**: [`AABBValue`](/api/interfaces/AABBValue)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### combinePoints()
|
||||
|
||||
> **combinePoints**(`a`, `b`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **a**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
• **b**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### contains()
|
||||
|
||||
> **contains**(`aabb`): `boolean`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **aabb**: [`AABBValue`](/api/interfaces/AABBValue)
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
***
|
||||
|
||||
### extend()
|
||||
|
||||
> **extend**(`value`): [`AABB`](/api/classes/AABB)
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **value**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
[`AABB`](/api/classes/AABB)
|
||||
|
||||
***
|
||||
|
||||
### getCenter()
|
||||
|
||||
> **getCenter**(): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
Get the center of the AABB.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
***
|
||||
|
||||
### getExtents()
|
||||
|
||||
> **getExtents**(): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
Get the extents of the AABB (half-widths).
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
***
|
||||
|
||||
### getPerimeter()
|
||||
|
||||
> **getPerimeter**(): `number`
|
||||
|
||||
Get the perimeter length.
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### isValid()
|
||||
|
||||
> **isValid**(): `boolean`
|
||||
|
||||
Verify that the bounds are sorted.
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
***
|
||||
|
||||
### rayCast()
|
||||
|
||||
> **rayCast**(`output`, `input`): `boolean`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **output**: [`RayCastOutput`](/api/interfaces/RayCastOutput)
|
||||
|
||||
• **input**: [`RayCastInput`](/api/interfaces/RayCastInput)
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
***
|
||||
|
||||
### set()
|
||||
|
||||
> **set**(`aabb`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **aabb**: [`AABBValue`](/api/interfaces/AABBValue)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### areEqual()
|
||||
|
||||
> `static` **areEqual**(`a`, `b`): `boolean`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **a**: [`AABBValue`](/api/interfaces/AABBValue)
|
||||
|
||||
• **b**: [`AABBValue`](/api/interfaces/AABBValue)
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
***
|
||||
|
||||
### assert()
|
||||
|
||||
> `static` **assert**(`o`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **o**: `any`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### combinedPerimeter()
|
||||
|
||||
> `static` **combinedPerimeter**(`a`, `b`): `number`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **a**: [`AABBValue`](/api/interfaces/AABBValue)
|
||||
|
||||
• **b**: [`AABBValue`](/api/interfaces/AABBValue)
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### combinePoints()
|
||||
|
||||
> `static` **combinePoints**(`out`, `a`, `b`): [`AABBValue`](/api/interfaces/AABBValue)
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **out**: [`AABBValue`](/api/interfaces/AABBValue)
|
||||
|
||||
• **a**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
• **b**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`AABBValue`](/api/interfaces/AABBValue)
|
||||
|
||||
***
|
||||
|
||||
### diff()
|
||||
|
||||
> `static` **diff**(`a`, `b`): `number`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **a**: [`AABBValue`](/api/interfaces/AABBValue)
|
||||
|
||||
• **b**: [`AABBValue`](/api/interfaces/AABBValue)
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### extend()
|
||||
|
||||
> `static` **extend**(`out`, `value`): [`AABBValue`](/api/interfaces/AABBValue)
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **out**: [`AABBValue`](/api/interfaces/AABBValue)
|
||||
|
||||
• **value**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
[`AABBValue`](/api/interfaces/AABBValue)
|
||||
|
||||
***
|
||||
|
||||
### isValid()
|
||||
|
||||
> `static` **isValid**(`obj`): `boolean`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **obj**: `any`
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
***
|
||||
|
||||
### testOverlap()
|
||||
|
||||
> `static` **testOverlap**(`a`, `b`): `boolean`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **a**: [`AABBValue`](/api/interfaces/AABBValue)
|
||||
|
||||
• **b**: [`AABBValue`](/api/interfaces/AABBValue)
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,279 +0,0 @@
|
||||
# Class: BoxShape
|
||||
|
||||
A rectangle polygon which extend PolygonShape.
|
||||
|
||||
## Extends
|
||||
|
||||
- [`PolygonShape`](/api/classes/PolygonShape)
|
||||
|
||||
## Constructors
|
||||
|
||||
### new BoxShape()
|
||||
|
||||
> **new BoxShape**(`halfWidth`, `halfHeight`, `center`?, `angle`?): [`BoxShape`](/api/classes/BoxShape)
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **halfWidth**: `number`
|
||||
|
||||
• **halfHeight**: `number`
|
||||
|
||||
• **center?**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
coordinate of the center of the box relative to the body
|
||||
|
||||
• **angle?**: `number`
|
||||
|
||||
angle of the box relative to the body
|
||||
|
||||
#### Returns
|
||||
|
||||
[`BoxShape`](/api/classes/BoxShape)
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`PolygonShape`](/api/classes/PolygonShape).[`constructor`](/api/classes/PolygonShape#constructors)
|
||||
|
||||
## Properties
|
||||
|
||||
### style
|
||||
|
||||
> **style**: [`Style`](/api/interfaces/Style) = `{}`
|
||||
|
||||
Styling for dev-tools.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`PolygonShape`](/api/classes/PolygonShape).[`style`](/api/classes/PolygonShape#style)
|
||||
|
||||
***
|
||||
|
||||
### TYPE
|
||||
|
||||
> `static` **TYPE**: `"polygon"`
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`PolygonShape`](/api/classes/PolygonShape).[`TYPE`](/api/classes/PolygonShape#type)
|
||||
|
||||
## Methods
|
||||
|
||||
### computeAABB()
|
||||
|
||||
> **computeAABB**(`aabb`, `xf`, `childIndex`): `void`
|
||||
|
||||
Given a transform, compute the associated axis aligned bounding box for a
|
||||
child shape.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **aabb**: [`AABBValue`](/api/interfaces/AABBValue)
|
||||
|
||||
Returns the axis aligned box.
|
||||
|
||||
• **xf**: [`TransformValue`](/api/type-aliases/TransformValue)
|
||||
|
||||
The world transform of the shape.
|
||||
|
||||
• **childIndex**: `number`
|
||||
|
||||
The child shape
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`PolygonShape`](/api/classes/PolygonShape).[`computeAABB`](/api/classes/PolygonShape#computeaabb)
|
||||
|
||||
***
|
||||
|
||||
### computeDistanceProxy()
|
||||
|
||||
> **computeDistanceProxy**(`proxy`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **proxy**: [`DistanceProxy`](/api/classes/DistanceProxy)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`PolygonShape`](/api/classes/PolygonShape).[`computeDistanceProxy`](/api/classes/PolygonShape#computedistanceproxy)
|
||||
|
||||
***
|
||||
|
||||
### computeMass()
|
||||
|
||||
> **computeMass**(`massData`, `density`): `void`
|
||||
|
||||
Compute the mass properties of this shape using its dimensions and density.
|
||||
The inertia tensor is computed about the local origin.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **massData**: [`MassData`](/api/interfaces/MassData)
|
||||
|
||||
Returns the mass data for this shape.
|
||||
|
||||
• **density**: `number`
|
||||
|
||||
The density in kilograms per meter squared.
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`PolygonShape`](/api/classes/PolygonShape).[`computeMass`](/api/classes/PolygonShape#computemass)
|
||||
|
||||
***
|
||||
|
||||
### getChildCount()
|
||||
|
||||
> **getChildCount**(): `1`
|
||||
|
||||
Get the number of child primitives.
|
||||
|
||||
#### Returns
|
||||
|
||||
`1`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`PolygonShape`](/api/classes/PolygonShape).[`getChildCount`](/api/classes/PolygonShape#getchildcount)
|
||||
|
||||
***
|
||||
|
||||
### getRadius()
|
||||
|
||||
> **getRadius**(): `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`PolygonShape`](/api/classes/PolygonShape).[`getRadius`](/api/classes/PolygonShape#getradius)
|
||||
|
||||
***
|
||||
|
||||
### getType()
|
||||
|
||||
> **getType**(): `"polygon"`
|
||||
|
||||
Get the type of this shape. You can use this to down cast to the concrete
|
||||
shape.
|
||||
|
||||
#### Returns
|
||||
|
||||
`"polygon"`
|
||||
|
||||
the shape type.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`PolygonShape`](/api/classes/PolygonShape).[`getType`](/api/classes/PolygonShape#gettype)
|
||||
|
||||
***
|
||||
|
||||
### rayCast()
|
||||
|
||||
> **rayCast**(`output`, `input`, `xf`, `childIndex`): `boolean`
|
||||
|
||||
Cast a ray against a child shape.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **output**: [`RayCastOutput`](/api/interfaces/RayCastOutput)
|
||||
|
||||
The ray-cast results.
|
||||
|
||||
• **input**: [`RayCastInput`](/api/interfaces/RayCastInput)
|
||||
|
||||
The ray-cast input parameters.
|
||||
|
||||
• **xf**: [`Transform`](/api/classes/Transform)
|
||||
|
||||
The transform to be applied to the shape.
|
||||
|
||||
• **childIndex**: `number`
|
||||
|
||||
The child shape index
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`PolygonShape`](/api/classes/PolygonShape).[`rayCast`](/api/classes/PolygonShape#raycast)
|
||||
|
||||
***
|
||||
|
||||
### testPoint()
|
||||
|
||||
> **testPoint**(`xf`, `p`): `boolean`
|
||||
|
||||
Test a point for containment in this shape. This only works for convex
|
||||
shapes.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **xf**: [`TransformValue`](/api/type-aliases/TransformValue)
|
||||
|
||||
The shape world transform.
|
||||
|
||||
• **p**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
A point in world coordinates.
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`PolygonShape`](/api/classes/PolygonShape).[`testPoint`](/api/classes/PolygonShape#testpoint)
|
||||
|
||||
***
|
||||
|
||||
### validate()
|
||||
|
||||
> **validate**(): `boolean`
|
||||
|
||||
Validate convexity. This is a very time consuming operation.
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
true if valid
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`PolygonShape`](/api/classes/PolygonShape).[`validate`](/api/classes/PolygonShape#validate)
|
||||
|
||||
***
|
||||
|
||||
### isValid()
|
||||
|
||||
> `static` **isValid**(`obj`): `boolean`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **obj**: `any`
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`PolygonShape`](/api/classes/PolygonShape).[`isValid`](/api/classes/PolygonShape#isvalid)
|
||||
@ -1,341 +0,0 @@
|
||||
# Class: BroadPhase
|
||||
|
||||
The broad-phase wraps and extends a dynamic-tree to keep track of moved
|
||||
objects and query them on update.
|
||||
|
||||
## Constructors
|
||||
|
||||
### new BroadPhase()
|
||||
|
||||
> **new BroadPhase**(): [`BroadPhase`](/api/classes/BroadPhase)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`BroadPhase`](/api/classes/BroadPhase)
|
||||
|
||||
## Properties
|
||||
|
||||
### m\_callback()
|
||||
|
||||
> **m\_callback**: (`userDataA`, `userDataB`) => `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **userDataA**: `any`
|
||||
|
||||
• **userDataB**: `any`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### m\_moveBuffer
|
||||
|
||||
> **m\_moveBuffer**: `number`[] = `[]`
|
||||
|
||||
***
|
||||
|
||||
### m\_queryProxyId
|
||||
|
||||
> **m\_queryProxyId**: `number`
|
||||
|
||||
***
|
||||
|
||||
### m\_tree
|
||||
|
||||
> **m\_tree**: [`DynamicTree`](/api/classes/DynamicTree)\<[`FixtureProxy`](/api/classes/FixtureProxy)\>
|
||||
|
||||
## Methods
|
||||
|
||||
### bufferMove()
|
||||
|
||||
> **bufferMove**(`proxyId`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **proxyId**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### createProxy()
|
||||
|
||||
> **createProxy**(`aabb`, `userData`): `number`
|
||||
|
||||
Create a proxy with an initial AABB. Pairs are not reported until UpdatePairs
|
||||
is called.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **aabb**: [`AABBValue`](/api/interfaces/AABBValue)
|
||||
|
||||
• **userData**: [`FixtureProxy`](/api/classes/FixtureProxy)
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### destroyProxy()
|
||||
|
||||
> **destroyProxy**(`proxyId`): `void`
|
||||
|
||||
Destroy a proxy. It is up to the client to remove any pairs.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **proxyId**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### getFatAABB()
|
||||
|
||||
> **getFatAABB**(`proxyId`): [`AABB`](/api/classes/AABB)
|
||||
|
||||
Get the fat AABB for a proxy.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **proxyId**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
[`AABB`](/api/classes/AABB)
|
||||
|
||||
***
|
||||
|
||||
### getProxyCount()
|
||||
|
||||
> **getProxyCount**(): `number`
|
||||
|
||||
Get the number of proxies.
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### getTreeBalance()
|
||||
|
||||
> **getTreeBalance**(): `number`
|
||||
|
||||
Get the balance (integer) of the embedded tree.
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### getTreeHeight()
|
||||
|
||||
> **getTreeHeight**(): `number`
|
||||
|
||||
Get the height of the embedded tree.
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### getTreeQuality()
|
||||
|
||||
> **getTreeQuality**(): `number`
|
||||
|
||||
Get the quality metric of the embedded tree.
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### getUserData()
|
||||
|
||||
> **getUserData**(`proxyId`): [`FixtureProxy`](/api/classes/FixtureProxy)
|
||||
|
||||
Get user data from a proxy. Returns null if the id is invalid.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **proxyId**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
[`FixtureProxy`](/api/classes/FixtureProxy)
|
||||
|
||||
***
|
||||
|
||||
### moveProxy()
|
||||
|
||||
> **moveProxy**(`proxyId`, `aabb`, `displacement`): `void`
|
||||
|
||||
Call moveProxy as many times as you like, then when you are done call
|
||||
UpdatePairs to finalized the proxy pairs (for your time step).
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **proxyId**: `number`
|
||||
|
||||
• **aabb**: [`AABB`](/api/classes/AABB)
|
||||
|
||||
• **displacement**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### query()
|
||||
|
||||
> **query**(`aabb`, `queryCallback`): `void`
|
||||
|
||||
Query an AABB for overlapping proxies. The callback class is called for each
|
||||
proxy that overlaps the supplied AABB.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **aabb**: [`AABBValue`](/api/interfaces/AABBValue)
|
||||
|
||||
• **queryCallback**: [`DynamicTreeQueryCallback`](/api/type-aliases/DynamicTreeQueryCallback)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### queryCallback()
|
||||
|
||||
> **queryCallback**(`proxyId`): `boolean`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **proxyId**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
***
|
||||
|
||||
### rayCast()
|
||||
|
||||
> **rayCast**(`input`, `rayCastCallback`): `void`
|
||||
|
||||
Ray-cast against the proxies in the tree. This relies on the callback to
|
||||
perform a exact ray-cast in the case were the proxy contains a shape. The
|
||||
callback also performs the any collision filtering. This has performance
|
||||
roughly equal to k * log(n), where k is the number of collisions and n is the
|
||||
number of proxies in the tree.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **input**: [`RayCastInput`](/api/interfaces/RayCastInput)
|
||||
|
||||
The ray-cast input data. The ray extends from `p1` to `p1 + maxFraction * (p2 - p1)`.
|
||||
|
||||
• **rayCastCallback**: [`RayCastCallback`](/api/type-aliases/RayCastCallback)
|
||||
|
||||
A function that is called for each proxy that is hit by the ray. If the return value is a positive number it will update the maxFraction of the ray cast input, and if it is zero it will terminate they ray cast.
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### shiftOrigin()
|
||||
|
||||
> **shiftOrigin**(`newOrigin`): `void`
|
||||
|
||||
Shift the world origin. Useful for large worlds. The shift formula is:
|
||||
position -= newOrigin
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **newOrigin**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
The new origin with respect to the old origin
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### testOverlap()
|
||||
|
||||
> **testOverlap**(`proxyIdA`, `proxyIdB`): `boolean`
|
||||
|
||||
Test overlap of fat AABBs.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **proxyIdA**: `number`
|
||||
|
||||
• **proxyIdB**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
***
|
||||
|
||||
### touchProxy()
|
||||
|
||||
> **touchProxy**(`proxyId`): `void`
|
||||
|
||||
Call to trigger a re-processing of it's pairs on the next call to
|
||||
UpdatePairs.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **proxyId**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### unbufferMove()
|
||||
|
||||
> **unbufferMove**(`proxyId`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **proxyId**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### updatePairs()
|
||||
|
||||
> **updatePairs**(`addPairCallback`): `void`
|
||||
|
||||
Update the pairs. This results in pair callbacks. This can only add pairs.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **addPairCallback**
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
@ -1,354 +0,0 @@
|
||||
# Class: ChainShape
|
||||
|
||||
A chain shape is a free form sequence of line segments. The chain has
|
||||
two-sided collision, so you can use inside and outside collision. Therefore,
|
||||
you may use any winding order. Connectivity information is used to create
|
||||
smooth collisions.
|
||||
|
||||
WARNING: The chain will not collide properly if there are self-intersections.
|
||||
|
||||
## Extends
|
||||
|
||||
- [`Shape`](/api/classes/Shape)
|
||||
|
||||
## Constructors
|
||||
|
||||
### new ChainShape()
|
||||
|
||||
> **new ChainShape**(`vertices`?, `loop`?): [`ChainShape`](/api/classes/ChainShape)
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **vertices?**: [`Vec2Value`](/api/interfaces/Vec2Value)[]
|
||||
|
||||
• **loop?**: `boolean`
|
||||
|
||||
#### Returns
|
||||
|
||||
[`ChainShape`](/api/classes/ChainShape)
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Shape`](/api/classes/Shape).[`constructor`](/api/classes/Shape#constructors)
|
||||
|
||||
## Properties
|
||||
|
||||
### style
|
||||
|
||||
> **style**: [`Style`](/api/interfaces/Style) = `{}`
|
||||
|
||||
Styling for dev-tools.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Shape`](/api/classes/Shape).[`style`](/api/classes/Shape#style)
|
||||
|
||||
***
|
||||
|
||||
### TYPE
|
||||
|
||||
> `static` **TYPE**: `"chain"`
|
||||
|
||||
## Methods
|
||||
|
||||
### computeAABB()
|
||||
|
||||
> **computeAABB**(`aabb`, `xf`, `childIndex`): `void`
|
||||
|
||||
Given a transform, compute the associated axis aligned bounding box for a
|
||||
child shape.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **aabb**: [`AABBValue`](/api/interfaces/AABBValue)
|
||||
|
||||
Returns the axis aligned box.
|
||||
|
||||
• **xf**: [`TransformValue`](/api/type-aliases/TransformValue)
|
||||
|
||||
The world transform of the shape.
|
||||
|
||||
• **childIndex**: `number`
|
||||
|
||||
The child shape
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Shape`](/api/classes/Shape).[`computeAABB`](/api/classes/Shape#computeaabb)
|
||||
|
||||
***
|
||||
|
||||
### computeDistanceProxy()
|
||||
|
||||
> **computeDistanceProxy**(`proxy`, `childIndex`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **proxy**: [`DistanceProxy`](/api/classes/DistanceProxy)
|
||||
|
||||
• **childIndex**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Shape`](/api/classes/Shape).[`computeDistanceProxy`](/api/classes/Shape#computedistanceproxy)
|
||||
|
||||
***
|
||||
|
||||
### computeMass()
|
||||
|
||||
> **computeMass**(`massData`, `density`?): `void`
|
||||
|
||||
Compute the mass properties of this shape using its dimensions and density.
|
||||
The inertia tensor is computed about the local origin.
|
||||
|
||||
Chains have zero mass.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **massData**: [`MassData`](/api/interfaces/MassData)
|
||||
|
||||
Returns the mass data for this shape.
|
||||
|
||||
• **density?**: `number`
|
||||
|
||||
The density in kilograms per meter squared.
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Shape`](/api/classes/Shape).[`computeMass`](/api/classes/Shape#computemass)
|
||||
|
||||
***
|
||||
|
||||
### getChildCount()
|
||||
|
||||
> **getChildCount**(): `number`
|
||||
|
||||
Get the number of child primitives.
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Shape`](/api/classes/Shape).[`getChildCount`](/api/classes/Shape#getchildcount)
|
||||
|
||||
***
|
||||
|
||||
### getChildEdge()
|
||||
|
||||
> **getChildEdge**(`edge`, `childIndex`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **edge**: [`EdgeShape`](/api/classes/EdgeShape)
|
||||
|
||||
• **childIndex**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### getNextVertex()
|
||||
|
||||
> **getNextVertex**(): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
***
|
||||
|
||||
### getPrevVertex()
|
||||
|
||||
> **getPrevVertex**(): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
***
|
||||
|
||||
### getRadius()
|
||||
|
||||
> **getRadius**(): `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Shape`](/api/classes/Shape).[`getRadius`](/api/classes/Shape#getradius)
|
||||
|
||||
***
|
||||
|
||||
### getType()
|
||||
|
||||
> **getType**(): `"chain"`
|
||||
|
||||
Get the type of this shape. You can use this to down cast to the concrete
|
||||
shape.
|
||||
|
||||
#### Returns
|
||||
|
||||
`"chain"`
|
||||
|
||||
the shape type.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Shape`](/api/classes/Shape).[`getType`](/api/classes/Shape#gettype)
|
||||
|
||||
***
|
||||
|
||||
### getVertex()
|
||||
|
||||
> **getVertex**(`index`): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **index**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
***
|
||||
|
||||
### isLoop()
|
||||
|
||||
> **isLoop**(): `boolean`
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
***
|
||||
|
||||
### rayCast()
|
||||
|
||||
> **rayCast**(`output`, `input`, `xf`, `childIndex`): `boolean`
|
||||
|
||||
Cast a ray against a child shape.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **output**: [`RayCastOutput`](/api/interfaces/RayCastOutput)
|
||||
|
||||
The ray-cast results.
|
||||
|
||||
• **input**: [`RayCastInput`](/api/interfaces/RayCastInput)
|
||||
|
||||
The ray-cast input parameters.
|
||||
|
||||
• **xf**: [`Transform`](/api/classes/Transform)
|
||||
|
||||
The transform to be applied to the shape.
|
||||
|
||||
• **childIndex**: `number`
|
||||
|
||||
The child shape index
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Shape`](/api/classes/Shape).[`rayCast`](/api/classes/Shape#raycast)
|
||||
|
||||
***
|
||||
|
||||
### setNextVertex()
|
||||
|
||||
> **setNextVertex**(`nextVertex`): `void`
|
||||
|
||||
Establish connectivity to a vertex that follows the last vertex. Don't call
|
||||
this for loops.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **nextVertex**: [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### setPrevVertex()
|
||||
|
||||
> **setPrevVertex**(`prevVertex`): `void`
|
||||
|
||||
Establish connectivity to a vertex that precedes the first vertex. Don't call
|
||||
this for loops.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **prevVertex**: [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### testPoint()
|
||||
|
||||
> **testPoint**(`xf`, `p`): `false`
|
||||
|
||||
Test a point for containment in this shape. This only works for convex
|
||||
shapes.
|
||||
|
||||
This always return false.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **xf**: [`TransformValue`](/api/type-aliases/TransformValue)
|
||||
|
||||
The shape world transform.
|
||||
|
||||
• **p**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
A point in world coordinates.
|
||||
|
||||
#### Returns
|
||||
|
||||
`false`
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Shape`](/api/classes/Shape).[`testPoint`](/api/classes/Shape#testpoint)
|
||||
|
||||
***
|
||||
|
||||
### isValid()
|
||||
|
||||
> `static` **isValid**(`obj`): `boolean`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **obj**: `any`
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Shape`](/api/classes/Shape).[`isValid`](/api/classes/Shape#isvalid)
|
||||
@ -1,275 +0,0 @@
|
||||
# Class: CircleShape
|
||||
|
||||
Circle shape.
|
||||
|
||||
## Extends
|
||||
|
||||
- [`Shape`](/api/classes/Shape)
|
||||
|
||||
## Constructors
|
||||
|
||||
### new CircleShape()
|
||||
|
||||
> **new CircleShape**(`position`, `radius`?): [`CircleShape`](/api/classes/CircleShape)
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **position**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
• **radius?**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
[`CircleShape`](/api/classes/CircleShape)
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Shape`](/api/classes/Shape).[`constructor`](/api/classes/Shape#constructors)
|
||||
|
||||
### new CircleShape()
|
||||
|
||||
> **new CircleShape**(`radius`?): [`CircleShape`](/api/classes/CircleShape)
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **radius?**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
[`CircleShape`](/api/classes/CircleShape)
|
||||
|
||||
#### Overrides
|
||||
|
||||
`Shape.constructor`
|
||||
|
||||
## Properties
|
||||
|
||||
### style
|
||||
|
||||
> **style**: [`Style`](/api/interfaces/Style) = `{}`
|
||||
|
||||
Styling for dev-tools.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Shape`](/api/classes/Shape).[`style`](/api/classes/Shape#style)
|
||||
|
||||
***
|
||||
|
||||
### TYPE
|
||||
|
||||
> `static` **TYPE**: `"circle"`
|
||||
|
||||
## Methods
|
||||
|
||||
### computeAABB()
|
||||
|
||||
> **computeAABB**(`aabb`, `xf`, `childIndex`): `void`
|
||||
|
||||
Given a transform, compute the associated axis aligned bounding box for a
|
||||
child shape.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **aabb**: [`AABBValue`](/api/interfaces/AABBValue)
|
||||
|
||||
Returns the axis aligned box.
|
||||
|
||||
• **xf**: [`TransformValue`](/api/type-aliases/TransformValue)
|
||||
|
||||
The world transform of the shape.
|
||||
|
||||
• **childIndex**: `number`
|
||||
|
||||
The child shape
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Shape`](/api/classes/Shape).[`computeAABB`](/api/classes/Shape#computeaabb)
|
||||
|
||||
***
|
||||
|
||||
### computeDistanceProxy()
|
||||
|
||||
> **computeDistanceProxy**(`proxy`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **proxy**: [`DistanceProxy`](/api/classes/DistanceProxy)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Shape`](/api/classes/Shape).[`computeDistanceProxy`](/api/classes/Shape#computedistanceproxy)
|
||||
|
||||
***
|
||||
|
||||
### computeMass()
|
||||
|
||||
> **computeMass**(`massData`, `density`): `void`
|
||||
|
||||
Compute the mass properties of this shape using its dimensions and density.
|
||||
The inertia tensor is computed about the local origin.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **massData**: [`MassData`](/api/interfaces/MassData)
|
||||
|
||||
Returns the mass data for this shape.
|
||||
|
||||
• **density**: `number`
|
||||
|
||||
The density in kilograms per meter squared.
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Shape`](/api/classes/Shape).[`computeMass`](/api/classes/Shape#computemass)
|
||||
|
||||
***
|
||||
|
||||
### getCenter()
|
||||
|
||||
> **getCenter**(): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
***
|
||||
|
||||
### getChildCount()
|
||||
|
||||
> **getChildCount**(): `1`
|
||||
|
||||
Get the number of child primitives.
|
||||
|
||||
#### Returns
|
||||
|
||||
`1`
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Shape`](/api/classes/Shape).[`getChildCount`](/api/classes/Shape#getchildcount)
|
||||
|
||||
***
|
||||
|
||||
### getRadius()
|
||||
|
||||
> **getRadius**(): `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Shape`](/api/classes/Shape).[`getRadius`](/api/classes/Shape#getradius)
|
||||
|
||||
***
|
||||
|
||||
### getType()
|
||||
|
||||
> **getType**(): `"circle"`
|
||||
|
||||
Get the type of this shape. You can use this to down cast to the concrete
|
||||
shape.
|
||||
|
||||
#### Returns
|
||||
|
||||
`"circle"`
|
||||
|
||||
the shape type.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Shape`](/api/classes/Shape).[`getType`](/api/classes/Shape#gettype)
|
||||
|
||||
***
|
||||
|
||||
### rayCast()
|
||||
|
||||
> **rayCast**(`output`, `input`, `xf`, `childIndex`): `boolean`
|
||||
|
||||
Cast a ray against a child shape.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **output**: [`RayCastOutput`](/api/interfaces/RayCastOutput)
|
||||
|
||||
The ray-cast results.
|
||||
|
||||
• **input**: [`RayCastInput`](/api/interfaces/RayCastInput)
|
||||
|
||||
The ray-cast input parameters.
|
||||
|
||||
• **xf**: [`Transform`](/api/classes/Transform)
|
||||
|
||||
The transform to be applied to the shape.
|
||||
|
||||
• **childIndex**: `number`
|
||||
|
||||
The child shape index
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Shape`](/api/classes/Shape).[`rayCast`](/api/classes/Shape#raycast)
|
||||
|
||||
***
|
||||
|
||||
### testPoint()
|
||||
|
||||
> **testPoint**(`xf`, `p`): `boolean`
|
||||
|
||||
Test a point for containment in this shape. This only works for convex
|
||||
shapes.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **xf**: [`TransformValue`](/api/type-aliases/TransformValue)
|
||||
|
||||
The shape world transform.
|
||||
|
||||
• **p**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
A point in world coordinates.
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Shape`](/api/classes/Shape).[`testPoint`](/api/classes/Shape#testpoint)
|
||||
|
||||
***
|
||||
|
||||
### isValid()
|
||||
|
||||
> `static` **isValid**(`obj`): `boolean`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **obj**: `any`
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Shape`](/api/classes/Shape).[`isValid`](/api/classes/Shape#isvalid)
|
||||
@ -1,49 +0,0 @@
|
||||
# Class: ClipVertex
|
||||
|
||||
Used for computing contact manifolds.
|
||||
|
||||
## Constructors
|
||||
|
||||
### new ClipVertex()
|
||||
|
||||
> **new ClipVertex**(): [`ClipVertex`](/api/classes/ClipVertex)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`ClipVertex`](/api/classes/ClipVertex)
|
||||
|
||||
## Properties
|
||||
|
||||
### id
|
||||
|
||||
> **id**: [`ContactID`](/api/classes/ContactID)
|
||||
|
||||
***
|
||||
|
||||
### v
|
||||
|
||||
> **v**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
## Methods
|
||||
|
||||
### recycle()
|
||||
|
||||
> **recycle**(): `void`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### set()
|
||||
|
||||
> **set**(`o`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **o**: [`ClipVertex`](/api/classes/ClipVertex)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
@ -1,415 +0,0 @@
|
||||
# Class: Contact
|
||||
|
||||
The class manages contact between two shapes. A contact exists for each
|
||||
overlapping AABB in the broad-phase (except if filtered). Therefore a contact
|
||||
object may exist that has no contact points.
|
||||
|
||||
## Constructors
|
||||
|
||||
### new Contact()
|
||||
|
||||
> **new Contact**(): [`Contact`](/api/classes/Contact)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Contact`](/api/classes/Contact)
|
||||
|
||||
## Methods
|
||||
|
||||
### evaluate()
|
||||
|
||||
> **evaluate**(`manifold`, `xfA`, `xfB`): `void`
|
||||
|
||||
Called by Update method, and implemented by subclasses.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **manifold**: [`Manifold`](/api/classes/Manifold)
|
||||
|
||||
• **xfA**: [`TransformValue`](/api/type-aliases/TransformValue)
|
||||
|
||||
• **xfB**: [`TransformValue`](/api/type-aliases/TransformValue)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### flagForFiltering()
|
||||
|
||||
> **flagForFiltering**(): `void`
|
||||
|
||||
Flag this contact for filtering. Filtering will occur the next time step.
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### getChildIndexA()
|
||||
|
||||
> **getChildIndexA**(): `number`
|
||||
|
||||
Get the child primitive index for fixture A.
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### getChildIndexB()
|
||||
|
||||
> **getChildIndexB**(): `number`
|
||||
|
||||
Get the child primitive index for fixture B.
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### getFixtureA()
|
||||
|
||||
> **getFixtureA**(): [`Fixture`](/api/classes/Fixture)
|
||||
|
||||
Get fixture A in this contact.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Fixture`](/api/classes/Fixture)
|
||||
|
||||
***
|
||||
|
||||
### getFixtureB()
|
||||
|
||||
> **getFixtureB**(): [`Fixture`](/api/classes/Fixture)
|
||||
|
||||
Get fixture B in this contact.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Fixture`](/api/classes/Fixture)
|
||||
|
||||
***
|
||||
|
||||
### getFriction()
|
||||
|
||||
> **getFriction**(): `number`
|
||||
|
||||
Get the friction.
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### getManifold()
|
||||
|
||||
> **getManifold**(): [`Manifold`](/api/classes/Manifold)
|
||||
|
||||
Get the contact manifold. Do not modify the manifold unless you understand
|
||||
the internals of the library.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Manifold`](/api/classes/Manifold)
|
||||
|
||||
***
|
||||
|
||||
### getNext()
|
||||
|
||||
> **getNext**(): [`Contact`](/api/classes/Contact)
|
||||
|
||||
Get the next contact in the world's contact list.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Contact`](/api/classes/Contact)
|
||||
|
||||
***
|
||||
|
||||
### getRestitution()
|
||||
|
||||
> **getRestitution**(): `number`
|
||||
|
||||
Get the restitution.
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### getTangentSpeed()
|
||||
|
||||
> **getTangentSpeed**(): `number`
|
||||
|
||||
Get the desired tangent speed. In meters per second.
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### getWorldManifold()
|
||||
|
||||
> **getWorldManifold**(`worldManifold`): [`WorldManifold`](/api/classes/WorldManifold)
|
||||
|
||||
Get the world manifold.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **worldManifold**: [`WorldManifold`](/api/classes/WorldManifold)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`WorldManifold`](/api/classes/WorldManifold)
|
||||
|
||||
***
|
||||
|
||||
### initConstraint()
|
||||
|
||||
> **initConstraint**(`step`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **step**: [`TimeStep`](/api/classes/TimeStep)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### initVelocityConstraint()
|
||||
|
||||
> **initVelocityConstraint**(`step`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **step**: [`TimeStep`](/api/classes/TimeStep)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### isEnabled()
|
||||
|
||||
> **isEnabled**(): `boolean`
|
||||
|
||||
Has this contact been disabled?
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
***
|
||||
|
||||
### isTouching()
|
||||
|
||||
> **isTouching**(): `boolean`
|
||||
|
||||
Is this contact touching?
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
***
|
||||
|
||||
### resetFriction()
|
||||
|
||||
> **resetFriction**(): `void`
|
||||
|
||||
Reset the friction mixture to the default value.
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### resetRestitution()
|
||||
|
||||
> **resetRestitution**(): `void`
|
||||
|
||||
Reset the restitution to the default value.
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### setEnabled()
|
||||
|
||||
> **setEnabled**(`flag`): `void`
|
||||
|
||||
Enable/disable this contact. This can be used inside the pre-solve contact
|
||||
listener. The contact is only disabled for the current time step (or sub-step
|
||||
in continuous collisions).
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **flag**: `boolean`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### setFriction()
|
||||
|
||||
> **setFriction**(`friction`): `void`
|
||||
|
||||
Override the default friction mixture. You can call this in
|
||||
"pre-solve" callback. This value persists until set or reset.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **friction**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### setRestitution()
|
||||
|
||||
> **setRestitution**(`restitution`): `void`
|
||||
|
||||
Override the default restitution mixture. You can call this in
|
||||
"pre-solve" callback. The value persists until you set or reset.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **restitution**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### setTangentSpeed()
|
||||
|
||||
> **setTangentSpeed**(`speed`): `void`
|
||||
|
||||
Set the desired tangent speed for a conveyor belt behavior. In meters per
|
||||
second.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **speed**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### solvePositionConstraint()
|
||||
|
||||
> **solvePositionConstraint**(`step`): `number`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **step**: [`TimeStep`](/api/classes/TimeStep)
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### solvePositionConstraintTOI()
|
||||
|
||||
> **solvePositionConstraintTOI**(`step`, `toiA`, `toiB`): `number`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **step**: [`TimeStep`](/api/classes/TimeStep)
|
||||
|
||||
• **toiA**: [`Body`](/api/classes/Body)
|
||||
|
||||
• **toiB**: [`Body`](/api/classes/Body)
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### solveVelocityConstraint()
|
||||
|
||||
> **solveVelocityConstraint**(`step`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **step**: [`TimeStep`](/api/classes/TimeStep)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### storeConstraintImpulses()
|
||||
|
||||
> **storeConstraintImpulses**(`step`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **step**: [`TimeStep`](/api/classes/TimeStep)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### update()
|
||||
|
||||
> **update**(`listener`?): `void`
|
||||
|
||||
Updates the contact manifold and touching status.
|
||||
|
||||
Note: do not assume the fixture AABBs are overlapping or are valid.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **listener?**
|
||||
|
||||
• **listener.beginContact?**
|
||||
|
||||
• **listener.endContact?**
|
||||
|
||||
• **listener.preSolve?**
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### warmStartConstraint()
|
||||
|
||||
> **warmStartConstraint**(`step`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **step**: [`TimeStep`](/api/classes/TimeStep)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
@ -1,44 +0,0 @@
|
||||
# Class: ContactEdge
|
||||
|
||||
A contact edge is used to connect bodies and contacts together in a contact
|
||||
graph where each body is a node and each contact is an edge. A contact edge
|
||||
belongs to a doubly linked list maintained in each attached body. Each
|
||||
contact has two contact nodes, one for each attached body.
|
||||
|
||||
## Constructors
|
||||
|
||||
### new ContactEdge()
|
||||
|
||||
> **new ContactEdge**(`contact`): [`ContactEdge`](/api/classes/ContactEdge)
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **contact**: [`Contact`](/api/classes/Contact)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`ContactEdge`](/api/classes/ContactEdge)
|
||||
|
||||
## Properties
|
||||
|
||||
### contact
|
||||
|
||||
> **contact**: [`Contact`](/api/classes/Contact)
|
||||
|
||||
***
|
||||
|
||||
### next
|
||||
|
||||
> **next**: [`ContactEdge`](/api/classes/ContactEdge) = `null`
|
||||
|
||||
***
|
||||
|
||||
### other
|
||||
|
||||
> **other**: [`Body`](/api/classes/Body) = `null`
|
||||
|
||||
***
|
||||
|
||||
### prev
|
||||
|
||||
> **prev**: [`ContactEdge`](/api/classes/ContactEdge) = `null`
|
||||
@ -1,109 +0,0 @@
|
||||
# Class: ContactID
|
||||
|
||||
Contact ids to facilitate warm starting.
|
||||
|
||||
ContactFeature: The features that intersect to form the contact point.
|
||||
|
||||
## Constructors
|
||||
|
||||
### new ContactID()
|
||||
|
||||
> **new ContactID**(): [`ContactID`](/api/classes/ContactID)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`ContactID`](/api/classes/ContactID)
|
||||
|
||||
## Properties
|
||||
|
||||
### indexA
|
||||
|
||||
> **indexA**: `number` = `-1`
|
||||
|
||||
ContactFeature index on shapeA
|
||||
|
||||
***
|
||||
|
||||
### indexB
|
||||
|
||||
> **indexB**: `number` = `-1`
|
||||
|
||||
ContactFeature index on shapeB
|
||||
|
||||
***
|
||||
|
||||
### key
|
||||
|
||||
> **key**: `number` = `-1`
|
||||
|
||||
Used to quickly compare contact ids.
|
||||
|
||||
***
|
||||
|
||||
### typeA
|
||||
|
||||
> **typeA**: [`ContactFeatureType`](/api/enumerations/ContactFeatureType) = `ContactFeatureType.e_unset`
|
||||
|
||||
ContactFeature type on shapeA
|
||||
|
||||
***
|
||||
|
||||
### typeB
|
||||
|
||||
> **typeB**: [`ContactFeatureType`](/api/enumerations/ContactFeatureType) = `ContactFeatureType.e_unset`
|
||||
|
||||
ContactFeature type on shapeB
|
||||
|
||||
## Methods
|
||||
|
||||
### recycle()
|
||||
|
||||
> **recycle**(): `void`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### set()
|
||||
|
||||
> **set**(`that`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **that**: [`ContactID`](/api/classes/ContactID)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### setFeatures()
|
||||
|
||||
> **setFeatures**(`indexA`, `typeA`, `indexB`, `typeB`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **indexA**: `number`
|
||||
|
||||
• **typeA**: [`ContactFeatureType`](/api/enumerations/ContactFeatureType)
|
||||
|
||||
• **indexB**: `number`
|
||||
|
||||
• **typeB**: [`ContactFeatureType`](/api/enumerations/ContactFeatureType)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### swapFeatures()
|
||||
|
||||
> **swapFeatures**(): `void`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
@ -1,53 +0,0 @@
|
||||
# Class: ContactImpulse
|
||||
|
||||
Contact impulses for reporting. Impulses are used instead of forces because
|
||||
sub-step forces may approach infinity for rigid body collisions. These match
|
||||
up one-to-one with the contact points in Manifold.
|
||||
|
||||
## Constructors
|
||||
|
||||
### new ContactImpulse()
|
||||
|
||||
> **new ContactImpulse**(`contact`): [`ContactImpulse`](/api/classes/ContactImpulse)
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **contact**: [`Contact`](/api/classes/Contact)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`ContactImpulse`](/api/classes/ContactImpulse)
|
||||
|
||||
## Accessors
|
||||
|
||||
### normalImpulses
|
||||
|
||||
#### Get Signature
|
||||
|
||||
> **get** **normalImpulses**(): `number`[]
|
||||
|
||||
##### Returns
|
||||
|
||||
`number`[]
|
||||
|
||||
***
|
||||
|
||||
### tangentImpulses
|
||||
|
||||
#### Get Signature
|
||||
|
||||
> **get** **tangentImpulses**(): `number`[]
|
||||
|
||||
##### Returns
|
||||
|
||||
`number`[]
|
||||
|
||||
## Methods
|
||||
|
||||
### recycle()
|
||||
|
||||
> **recycle**(): `void`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
@ -1,54 +0,0 @@
|
||||
# Class: DistanceInput
|
||||
|
||||
Input for Distance. You have to option to use the shape radii in the
|
||||
computation. Even
|
||||
|
||||
## Constructors
|
||||
|
||||
### new DistanceInput()
|
||||
|
||||
> **new DistanceInput**(): [`DistanceInput`](/api/classes/DistanceInput)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`DistanceInput`](/api/classes/DistanceInput)
|
||||
|
||||
## Properties
|
||||
|
||||
### proxyA
|
||||
|
||||
> `readonly` **proxyA**: [`DistanceProxy`](/api/classes/DistanceProxy)
|
||||
|
||||
***
|
||||
|
||||
### proxyB
|
||||
|
||||
> `readonly` **proxyB**: [`DistanceProxy`](/api/classes/DistanceProxy)
|
||||
|
||||
***
|
||||
|
||||
### transformA
|
||||
|
||||
> `readonly` **transformA**: [`Transform`](/api/classes/Transform)
|
||||
|
||||
***
|
||||
|
||||
### transformB
|
||||
|
||||
> `readonly` **transformB**: [`Transform`](/api/classes/Transform)
|
||||
|
||||
***
|
||||
|
||||
### useRadii
|
||||
|
||||
> **useRadii**: `boolean` = `false`
|
||||
|
||||
## Methods
|
||||
|
||||
### recycle()
|
||||
|
||||
> **recycle**(): `void`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
@ -1,453 +0,0 @@
|
||||
# Class: DistanceJoint
|
||||
|
||||
A distance joint constrains two points on two bodies to remain at a fixed
|
||||
distance from each other. You can view this as a massless, rigid rod.
|
||||
|
||||
## Extends
|
||||
|
||||
- [`Joint`](/api/classes/Joint)
|
||||
|
||||
## Constructors
|
||||
|
||||
### new DistanceJoint()
|
||||
|
||||
> **new DistanceJoint**(`def`): [`DistanceJoint`](/api/classes/DistanceJoint)
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **def**: [`DistanceJointDef`](/api/interfaces/DistanceJointDef)
|
||||
|
||||
DistanceJoint definition.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`DistanceJoint`](/api/classes/DistanceJoint)
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`constructor`](/api/classes/Joint#constructors)
|
||||
|
||||
### new DistanceJoint()
|
||||
|
||||
> **new DistanceJoint**(`def`, `bodyA`, `bodyB`, `anchorA`?, `anchorB`?): [`DistanceJoint`](/api/classes/DistanceJoint)
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **def**: [`DistanceJointOpt`](/api/interfaces/DistanceJointOpt)
|
||||
|
||||
• **bodyA**: [`Body`](/api/classes/Body)
|
||||
|
||||
• **bodyB**: [`Body`](/api/classes/Body)
|
||||
|
||||
• **anchorA?**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
Anchor A in global coordination.
|
||||
|
||||
• **anchorB?**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
Anchor B in global coordination.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`DistanceJoint`](/api/classes/DistanceJoint)
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`constructor`](/api/classes/Joint#constructors)
|
||||
|
||||
## Properties
|
||||
|
||||
### style
|
||||
|
||||
> **style**: [`Style`](/api/interfaces/Style) = `{}`
|
||||
|
||||
Styling for dev-tools.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`style`](/api/classes/Joint#style)
|
||||
|
||||
***
|
||||
|
||||
### TYPE
|
||||
|
||||
> `static` **TYPE**: `"distance-joint"`
|
||||
|
||||
## Methods
|
||||
|
||||
### getAnchorA()
|
||||
|
||||
> **getAnchorA**(): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
Get the anchor point on bodyA in world coordinates.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getAnchorA`](/api/classes/Joint#getanchora)
|
||||
|
||||
***
|
||||
|
||||
### getAnchorB()
|
||||
|
||||
> **getAnchorB**(): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
Get the anchor point on bodyB in world coordinates.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getAnchorB`](/api/classes/Joint#getanchorb)
|
||||
|
||||
***
|
||||
|
||||
### getBodyA()
|
||||
|
||||
> **getBodyA**(): [`Body`](/api/classes/Body)
|
||||
|
||||
Get the first body attached to this joint.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Body`](/api/classes/Body)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getBodyA`](/api/classes/Joint#getbodya)
|
||||
|
||||
***
|
||||
|
||||
### getBodyB()
|
||||
|
||||
> **getBodyB**(): [`Body`](/api/classes/Body)
|
||||
|
||||
Get the second body attached to this joint.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Body`](/api/classes/Body)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getBodyB`](/api/classes/Joint#getbodyb)
|
||||
|
||||
***
|
||||
|
||||
### getCollideConnected()
|
||||
|
||||
> **getCollideConnected**(): `boolean`
|
||||
|
||||
Get collide connected. Note: modifying the collide connect flag won't work
|
||||
correctly because the flag is only checked when fixture AABBs begin to
|
||||
overlap.
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getCollideConnected`](/api/classes/Joint#getcollideconnected)
|
||||
|
||||
***
|
||||
|
||||
### getDampingRatio()
|
||||
|
||||
> **getDampingRatio**(): `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### getFrequency()
|
||||
|
||||
> **getFrequency**(): `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### getLength()
|
||||
|
||||
> **getLength**(): `number`
|
||||
|
||||
Get the natural length.
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### getLocalAnchorA()
|
||||
|
||||
> **getLocalAnchorA**(): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
The local anchor point relative to bodyA's origin.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
***
|
||||
|
||||
### getLocalAnchorB()
|
||||
|
||||
> **getLocalAnchorB**(): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
The local anchor point relative to bodyB's origin.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
***
|
||||
|
||||
### getNext()
|
||||
|
||||
> **getNext**(): [`Joint`](/api/classes/Joint)
|
||||
|
||||
Get the next joint the world joint list.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Joint`](/api/classes/Joint)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getNext`](/api/classes/Joint#getnext)
|
||||
|
||||
***
|
||||
|
||||
### getReactionForce()
|
||||
|
||||
> **getReactionForce**(`inv_dt`): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
Get the reaction force on bodyB at the joint anchor in Newtons.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **inv\_dt**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getReactionForce`](/api/classes/Joint#getreactionforce)
|
||||
|
||||
***
|
||||
|
||||
### getReactionTorque()
|
||||
|
||||
> **getReactionTorque**(`inv_dt`): `number`
|
||||
|
||||
Get the reaction torque on bodyB in N*m.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **inv\_dt**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getReactionTorque`](/api/classes/Joint#getreactiontorque)
|
||||
|
||||
***
|
||||
|
||||
### getType()
|
||||
|
||||
> **getType**(): `string`
|
||||
|
||||
Get the type of the concrete joint.
|
||||
|
||||
#### Returns
|
||||
|
||||
`string`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getType`](/api/classes/Joint#gettype)
|
||||
|
||||
***
|
||||
|
||||
### getUserData()
|
||||
|
||||
> **getUserData**(): `unknown`
|
||||
|
||||
#### Returns
|
||||
|
||||
`unknown`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`getUserData`](/api/classes/Joint#getuserdata)
|
||||
|
||||
***
|
||||
|
||||
### initVelocityConstraints()
|
||||
|
||||
> **initVelocityConstraints**(`step`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **step**: [`TimeStep`](/api/classes/TimeStep)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`initVelocityConstraints`](/api/classes/Joint#initvelocityconstraints)
|
||||
|
||||
***
|
||||
|
||||
### isActive()
|
||||
|
||||
> **isActive**(): `boolean`
|
||||
|
||||
Short-cut function to determine if either body is inactive.
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`isActive`](/api/classes/Joint#isactive)
|
||||
|
||||
***
|
||||
|
||||
### setDampingRatio()
|
||||
|
||||
> **setDampingRatio**(`ratio`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **ratio**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### setFrequency()
|
||||
|
||||
> **setFrequency**(`hz`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **hz**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### setLength()
|
||||
|
||||
> **setLength**(`length`): `void`
|
||||
|
||||
Set the natural length. Manipulating the length can lead to non-physical
|
||||
behavior when the frequency is zero.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **length**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### setUserData()
|
||||
|
||||
> **setUserData**(`data`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **data**: `unknown`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`setUserData`](/api/classes/Joint#setuserdata)
|
||||
|
||||
***
|
||||
|
||||
### shiftOrigin()
|
||||
|
||||
> **shiftOrigin**(`newOrigin`): `void`
|
||||
|
||||
Shift the origin for any points stored in world coordinates.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **newOrigin**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`shiftOrigin`](/api/classes/Joint#shiftorigin)
|
||||
|
||||
***
|
||||
|
||||
### solvePositionConstraints()
|
||||
|
||||
> **solvePositionConstraints**(`step`): `boolean`
|
||||
|
||||
This returns true if the position errors are within tolerance.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **step**: [`TimeStep`](/api/classes/TimeStep)
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`solvePositionConstraints`](/api/classes/Joint#solvepositionconstraints)
|
||||
|
||||
***
|
||||
|
||||
### solveVelocityConstraints()
|
||||
|
||||
> **solveVelocityConstraints**(`step`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **step**: [`TimeStep`](/api/classes/TimeStep)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Joint`](/api/classes/Joint).[`solveVelocityConstraints`](/api/classes/Joint#solvevelocityconstraints)
|
||||
@ -1,53 +0,0 @@
|
||||
# Class: DistanceOutput
|
||||
|
||||
Output for Distance.
|
||||
|
||||
## Constructors
|
||||
|
||||
### new DistanceOutput()
|
||||
|
||||
> **new DistanceOutput**(): [`DistanceOutput`](/api/classes/DistanceOutput)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`DistanceOutput`](/api/classes/DistanceOutput)
|
||||
|
||||
## Properties
|
||||
|
||||
### distance
|
||||
|
||||
> **distance**: `number` = `0`
|
||||
|
||||
***
|
||||
|
||||
### iterations
|
||||
|
||||
> **iterations**: `number` = `0`
|
||||
|
||||
iterations number of GJK iterations used
|
||||
|
||||
***
|
||||
|
||||
### pointA
|
||||
|
||||
> **pointA**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
closest point on shapeA
|
||||
|
||||
***
|
||||
|
||||
### pointB
|
||||
|
||||
> **pointB**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
closest point on shapeB
|
||||
|
||||
## Methods
|
||||
|
||||
### recycle()
|
||||
|
||||
> **recycle**(): `void`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
@ -1,123 +0,0 @@
|
||||
# Class: DistanceProxy
|
||||
|
||||
A distance proxy is used by the GJK algorithm. It encapsulates any shape.
|
||||
|
||||
## Constructors
|
||||
|
||||
### new DistanceProxy()
|
||||
|
||||
> **new DistanceProxy**(): [`DistanceProxy`](/api/classes/DistanceProxy)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`DistanceProxy`](/api/classes/DistanceProxy)
|
||||
|
||||
## Methods
|
||||
|
||||
### getSupport()
|
||||
|
||||
> **getSupport**(`d`): `number`
|
||||
|
||||
Get the supporting vertex index in the given direction.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **d**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### getSupportVertex()
|
||||
|
||||
> **getSupportVertex**(`d`): [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
Get the supporting vertex in the given direction.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **d**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
***
|
||||
|
||||
### getVertex()
|
||||
|
||||
> **getVertex**(`index`): [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
Get a vertex by index. Used by Distance.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **index**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
***
|
||||
|
||||
### getVertexCount()
|
||||
|
||||
> **getVertexCount**(): `number`
|
||||
|
||||
Get the vertex count.
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### recycle()
|
||||
|
||||
> **recycle**(): `void`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### set()
|
||||
|
||||
> **set**(`shape`, `index`): `void`
|
||||
|
||||
Initialize the proxy using the given shape. The shape must remain in scope
|
||||
while the proxy is in use.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **shape**: [`Shape`](/api/classes/Shape)
|
||||
|
||||
• **index**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### setVertices()
|
||||
|
||||
> **setVertices**(`vertices`, `count`, `radius`): `void`
|
||||
|
||||
Initialize the proxy using a vertex cloud and radius. The vertices
|
||||
must remain in scope while the proxy is in use.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **vertices**: [`Vec2Value`](/api/interfaces/Vec2Value)[]
|
||||
|
||||
• **count**: `number`
|
||||
|
||||
• **radius**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
@ -1,385 +0,0 @@
|
||||
# Class: DynamicTree\<T\>
|
||||
|
||||
A dynamic AABB tree broad-phase, inspired by Nathanael Presson's btDbvt. A
|
||||
dynamic tree arranges data in a binary tree to accelerate queries such as
|
||||
volume queries and ray casts. Leafs are proxies with an AABB. In the tree we
|
||||
expand the proxy AABB by `aabbExtension` so that the proxy AABB is bigger
|
||||
than the client object. This allows the client object to move by small
|
||||
amounts without triggering a tree update.
|
||||
|
||||
Nodes are pooled and relocatable, so we use node indices rather than
|
||||
pointers.
|
||||
|
||||
## Type Parameters
|
||||
|
||||
• **T**
|
||||
|
||||
## Constructors
|
||||
|
||||
### new DynamicTree()
|
||||
|
||||
> **new DynamicTree**\<`T`\>(): [`DynamicTree`](/api/classes/DynamicTree)\<`T`\>
|
||||
|
||||
#### Returns
|
||||
|
||||
[`DynamicTree`](/api/classes/DynamicTree)\<`T`\>
|
||||
|
||||
## Properties
|
||||
|
||||
### m\_lastProxyId
|
||||
|
||||
> **m\_lastProxyId**: `number`
|
||||
|
||||
***
|
||||
|
||||
### m\_nodes
|
||||
|
||||
> **m\_nodes**: `object`
|
||||
|
||||
#### Index Signature
|
||||
|
||||
\[`id`: `number`\]: [`TreeNode`](/api/classes/TreeNode)\<`T`\>
|
||||
|
||||
***
|
||||
|
||||
### m\_root
|
||||
|
||||
> **m\_root**: [`TreeNode`](/api/classes/TreeNode)\<`T`\>
|
||||
|
||||
## Methods
|
||||
|
||||
### allocateNode()
|
||||
|
||||
> **allocateNode**(): [`TreeNode`](/api/classes/TreeNode)\<`T`\>
|
||||
|
||||
#### Returns
|
||||
|
||||
[`TreeNode`](/api/classes/TreeNode)\<`T`\>
|
||||
|
||||
***
|
||||
|
||||
### balance()
|
||||
|
||||
> **balance**(`iA`): [`TreeNode`](/api/classes/TreeNode)\<`T`\>
|
||||
|
||||
Perform a left or right rotation if node A is imbalanced. Returns the new
|
||||
root index.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **iA**: [`TreeNode`](/api/classes/TreeNode)\<`T`\>
|
||||
|
||||
#### Returns
|
||||
|
||||
[`TreeNode`](/api/classes/TreeNode)\<`T`\>
|
||||
|
||||
***
|
||||
|
||||
### computeHeight()
|
||||
|
||||
> **computeHeight**(`id`?): `number`
|
||||
|
||||
Compute the height of a sub-tree.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **id?**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### createProxy()
|
||||
|
||||
> **createProxy**(`aabb`, `userData`): `number`
|
||||
|
||||
Create a proxy in the tree as a leaf node. We return the index of the node
|
||||
instead of a pointer so that we can grow the node pool.
|
||||
|
||||
Create a proxy. Provide a tight fitting AABB and a userData pointer.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **aabb**: [`AABBValue`](/api/interfaces/AABBValue)
|
||||
|
||||
• **userData**: `T`
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### destroyProxy()
|
||||
|
||||
> **destroyProxy**(`id`): `void`
|
||||
|
||||
Destroy a proxy. This asserts if the id is invalid.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **id**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### freeNode()
|
||||
|
||||
> **freeNode**(`node`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **node**: [`TreeNode`](/api/classes/TreeNode)\<`T`\>
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### getAreaRatio()
|
||||
|
||||
> **getAreaRatio**(): `number`
|
||||
|
||||
Get the ratio of the sum of the node areas to the root area.
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### getFatAABB()
|
||||
|
||||
> **getFatAABB**(`id`): [`AABB`](/api/classes/AABB)
|
||||
|
||||
Get the fat AABB for a node id.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **id**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
[`AABB`](/api/classes/AABB)
|
||||
|
||||
the proxy user data or 0 if the id is invalid.
|
||||
|
||||
***
|
||||
|
||||
### getHeight()
|
||||
|
||||
> **getHeight**(): `number`
|
||||
|
||||
Compute the height of the binary tree in O(N) time. Should not be called
|
||||
often.
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### getMaxBalance()
|
||||
|
||||
> **getMaxBalance**(): `number`
|
||||
|
||||
Get the maximum balance of an node in the tree. The balance is the difference
|
||||
in height of the two children of a node.
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### getUserData()
|
||||
|
||||
> **getUserData**(`id`): `T`
|
||||
|
||||
Get proxy user data.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **id**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`T`
|
||||
|
||||
the proxy user data or 0 if the id is invalid.
|
||||
|
||||
***
|
||||
|
||||
### insertLeaf()
|
||||
|
||||
> **insertLeaf**(`leaf`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **leaf**: [`TreeNode`](/api/classes/TreeNode)\<`T`\>
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### moveProxy()
|
||||
|
||||
> **moveProxy**(`id`, `aabb`, `d`): `boolean`
|
||||
|
||||
Move a proxy with a swepted AABB. If the proxy has moved outside of its
|
||||
fattened AABB, then the proxy is removed from the tree and re-inserted.
|
||||
Otherwise the function returns immediately.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **id**: `number`
|
||||
|
||||
• **aabb**: [`AABBValue`](/api/interfaces/AABBValue)
|
||||
|
||||
• **d**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
Displacement
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
true if the proxy was re-inserted.
|
||||
|
||||
***
|
||||
|
||||
### query()
|
||||
|
||||
> **query**(`aabb`, `queryCallback`): `void`
|
||||
|
||||
Query an AABB for overlapping proxies. The callback class is called for each
|
||||
proxy that overlaps the supplied AABB.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **aabb**: [`AABBValue`](/api/interfaces/AABBValue)
|
||||
|
||||
• **queryCallback**: [`DynamicTreeQueryCallback`](/api/type-aliases/DynamicTreeQueryCallback)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### rayCast()
|
||||
|
||||
> **rayCast**(`input`, `rayCastCallback`): `void`
|
||||
|
||||
Ray-cast against the proxies in the tree. This relies on the callback to
|
||||
perform a exact ray-cast in the case were the proxy contains a shape. The
|
||||
callback also performs the any collision filtering. This has performance
|
||||
roughly equal to k * log(n), where k is the number of collisions and n is the
|
||||
number of proxies in the tree.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **input**: [`RayCastInput`](/api/interfaces/RayCastInput)
|
||||
|
||||
The ray-cast input data. The ray extends from `p1` to `p1 + maxFraction * (p2 - p1)`.
|
||||
|
||||
• **rayCastCallback**: [`RayCastCallback`](/api/type-aliases/RayCastCallback)
|
||||
|
||||
A function that is called for each proxy that is hit by the ray. If the return value is a positive number it will update the maxFraction of the ray cast input, and if it is zero it will terminate they ray cast.
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### rebuildBottomUp()
|
||||
|
||||
> **rebuildBottomUp**(): `void`
|
||||
|
||||
Build an optimal tree. Very expensive. For testing.
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### removeLeaf()
|
||||
|
||||
> **removeLeaf**(`leaf`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **leaf**: [`TreeNode`](/api/classes/TreeNode)\<`T`\>
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### shiftOrigin()
|
||||
|
||||
> **shiftOrigin**(`newOrigin`): `void`
|
||||
|
||||
Shift the world origin. Useful for large worlds. The shift formula is:
|
||||
position -= newOrigin
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **newOrigin**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
The new origin with respect to the old origin
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### validate()
|
||||
|
||||
> **validate**(): `void`
|
||||
|
||||
Validate this tree. For testing.
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### validateMetrics()
|
||||
|
||||
> **validateMetrics**(`node`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **node**: [`TreeNode`](/api/classes/TreeNode)\<`T`\>
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### validateStructure()
|
||||
|
||||
> **validateStructure**(`node`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **node**: [`TreeNode`](/api/classes/TreeNode)\<`T`\>
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
@ -1,325 +0,0 @@
|
||||
# Class: EdgeShape
|
||||
|
||||
A line segment (edge) shape. These can be connected in chains or loops to
|
||||
other edge shapes. The connectivity information is used to ensure correct
|
||||
contact normals.
|
||||
|
||||
## Extends
|
||||
|
||||
- [`Shape`](/api/classes/Shape)
|
||||
|
||||
## Constructors
|
||||
|
||||
### new EdgeShape()
|
||||
|
||||
> **new EdgeShape**(`v1`?, `v2`?): [`EdgeShape`](/api/classes/EdgeShape)
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **v1?**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
• **v2?**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`EdgeShape`](/api/classes/EdgeShape)
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Shape`](/api/classes/Shape).[`constructor`](/api/classes/Shape#constructors)
|
||||
|
||||
## Properties
|
||||
|
||||
### style
|
||||
|
||||
> **style**: [`Style`](/api/interfaces/Style) = `{}`
|
||||
|
||||
Styling for dev-tools.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Shape`](/api/classes/Shape).[`style`](/api/classes/Shape#style)
|
||||
|
||||
***
|
||||
|
||||
### TYPE
|
||||
|
||||
> `static` **TYPE**: `"edge"`
|
||||
|
||||
## Methods
|
||||
|
||||
### \_set()
|
||||
|
||||
> **\_set**(`v1`, `v2`): [`EdgeShape`](/api/classes/EdgeShape)
|
||||
|
||||
Set this as an isolated edge.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **v1**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
• **v2**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`EdgeShape`](/api/classes/EdgeShape)
|
||||
|
||||
***
|
||||
|
||||
### computeAABB()
|
||||
|
||||
> **computeAABB**(`aabb`, `xf`, `childIndex`): `void`
|
||||
|
||||
Given a transform, compute the associated axis aligned bounding box for a
|
||||
child shape.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **aabb**: [`AABBValue`](/api/interfaces/AABBValue)
|
||||
|
||||
Returns the axis aligned box.
|
||||
|
||||
• **xf**: [`TransformValue`](/api/type-aliases/TransformValue)
|
||||
|
||||
The world transform of the shape.
|
||||
|
||||
• **childIndex**: `number`
|
||||
|
||||
The child shape
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Shape`](/api/classes/Shape).[`computeAABB`](/api/classes/Shape#computeaabb)
|
||||
|
||||
***
|
||||
|
||||
### computeDistanceProxy()
|
||||
|
||||
> **computeDistanceProxy**(`proxy`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **proxy**: [`DistanceProxy`](/api/classes/DistanceProxy)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Shape`](/api/classes/Shape).[`computeDistanceProxy`](/api/classes/Shape#computedistanceproxy)
|
||||
|
||||
***
|
||||
|
||||
### computeMass()
|
||||
|
||||
> **computeMass**(`massData`, `density`?): `void`
|
||||
|
||||
Compute the mass properties of this shape using its dimensions and density.
|
||||
The inertia tensor is computed about the local origin.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **massData**: [`MassData`](/api/interfaces/MassData)
|
||||
|
||||
Returns the mass data for this shape.
|
||||
|
||||
• **density?**: `number`
|
||||
|
||||
The density in kilograms per meter squared.
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Shape`](/api/classes/Shape).[`computeMass`](/api/classes/Shape#computemass)
|
||||
|
||||
***
|
||||
|
||||
### getChildCount()
|
||||
|
||||
> **getChildCount**(): `1`
|
||||
|
||||
Get the number of child primitives.
|
||||
|
||||
#### Returns
|
||||
|
||||
`1`
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Shape`](/api/classes/Shape).[`getChildCount`](/api/classes/Shape#getchildcount)
|
||||
|
||||
***
|
||||
|
||||
### getNextVertex()
|
||||
|
||||
> **getNextVertex**(): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
Optional next vertex, used for smooth collision.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
***
|
||||
|
||||
### getPrevVertex()
|
||||
|
||||
> **getPrevVertex**(): [`Vec2`](/api/classes/Vec2)
|
||||
|
||||
Optional prev vertex, used for smooth collision.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Vec2`](/api/classes/Vec2)
|
||||
|
||||
***
|
||||
|
||||
### getRadius()
|
||||
|
||||
> **getRadius**(): `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Shape`](/api/classes/Shape).[`getRadius`](/api/classes/Shape#getradius)
|
||||
|
||||
***
|
||||
|
||||
### getType()
|
||||
|
||||
> **getType**(): `"edge"`
|
||||
|
||||
Get the type of this shape. You can use this to down cast to the concrete
|
||||
shape.
|
||||
|
||||
#### Returns
|
||||
|
||||
`"edge"`
|
||||
|
||||
the shape type.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Shape`](/api/classes/Shape).[`getType`](/api/classes/Shape#gettype)
|
||||
|
||||
***
|
||||
|
||||
### rayCast()
|
||||
|
||||
> **rayCast**(`output`, `input`, `xf`, `childIndex`): `boolean`
|
||||
|
||||
Cast a ray against a child shape.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **output**: [`RayCastOutput`](/api/interfaces/RayCastOutput)
|
||||
|
||||
The ray-cast results.
|
||||
|
||||
• **input**: [`RayCastInput`](/api/interfaces/RayCastInput)
|
||||
|
||||
The ray-cast input parameters.
|
||||
|
||||
• **xf**: [`Transform`](/api/classes/Transform)
|
||||
|
||||
The transform to be applied to the shape.
|
||||
|
||||
• **childIndex**: `number`
|
||||
|
||||
The child shape index
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Shape`](/api/classes/Shape).[`rayCast`](/api/classes/Shape#raycast)
|
||||
|
||||
***
|
||||
|
||||
### setNextVertex()
|
||||
|
||||
> **setNextVertex**(`v`?): [`EdgeShape`](/api/classes/EdgeShape)
|
||||
|
||||
Optional next vertex, used for smooth collision.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **v?**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`EdgeShape`](/api/classes/EdgeShape)
|
||||
|
||||
***
|
||||
|
||||
### setPrevVertex()
|
||||
|
||||
> **setPrevVertex**(`v`?): [`EdgeShape`](/api/classes/EdgeShape)
|
||||
|
||||
Optional prev vertex, used for smooth collision.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **v?**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`EdgeShape`](/api/classes/EdgeShape)
|
||||
|
||||
***
|
||||
|
||||
### testPoint()
|
||||
|
||||
> **testPoint**(`xf`, `p`): `false`
|
||||
|
||||
Test a point for containment in this shape. This only works for convex
|
||||
shapes.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **xf**: [`TransformValue`](/api/type-aliases/TransformValue)
|
||||
|
||||
The shape world transform.
|
||||
|
||||
• **p**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
A point in world coordinates.
|
||||
|
||||
#### Returns
|
||||
|
||||
`false`
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`Shape`](/api/classes/Shape).[`testPoint`](/api/classes/Shape#testpoint)
|
||||
|
||||
***
|
||||
|
||||
### isValid()
|
||||
|
||||
> `static` **isValid**(`obj`): `boolean`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **obj**: `any`
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`Shape`](/api/classes/Shape).[`isValid`](/api/classes/Shape#isvalid)
|
||||
@ -1,468 +0,0 @@
|
||||
# Class: Fixture
|
||||
|
||||
A fixture is used to attach a shape to a body for collision detection. A
|
||||
fixture inherits its transform from its parent. Fixtures hold additional
|
||||
non-geometric data such as friction, collision filters, etc.
|
||||
|
||||
To create a new Fixture use [Body.createFixture](/api/classes/Body#createfixture).
|
||||
|
||||
## Properties
|
||||
|
||||
### style
|
||||
|
||||
> **style**: [`Style`](/api/interfaces/Style) = `{}`
|
||||
|
||||
Styling for dev-tools.
|
||||
|
||||
## Methods
|
||||
|
||||
### createProxies()
|
||||
|
||||
> **createProxies**(`broadPhase`, `xf`): `void`
|
||||
|
||||
These support body activation/deactivation.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **broadPhase**: [`BroadPhase`](/api/classes/BroadPhase)
|
||||
|
||||
• **xf**: [`TransformValue`](/api/type-aliases/TransformValue)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### destroyProxies()
|
||||
|
||||
> **destroyProxies**(`broadPhase`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **broadPhase**: [`BroadPhase`](/api/classes/BroadPhase)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### getAABB()
|
||||
|
||||
> **getAABB**(`childIndex`): [`AABB`](/api/classes/AABB)
|
||||
|
||||
Get the fixture's AABB. This AABB may be enlarge and/or stale. If you need a
|
||||
more accurate AABB, compute it using the shape and the body transform.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **childIndex**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
[`AABB`](/api/classes/AABB)
|
||||
|
||||
***
|
||||
|
||||
### getBody()
|
||||
|
||||
> **getBody**(): [`Body`](/api/classes/Body)
|
||||
|
||||
Get the parent body of this fixture. This is null if the fixture is not
|
||||
attached.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Body`](/api/classes/Body)
|
||||
|
||||
***
|
||||
|
||||
### getDensity()
|
||||
|
||||
> **getDensity**(): `number`
|
||||
|
||||
Get the density of this fixture.
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### getFilterCategoryBits()
|
||||
|
||||
> **getFilterCategoryBits**(): `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### getFilterGroupIndex()
|
||||
|
||||
> **getFilterGroupIndex**(): `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### getFilterMaskBits()
|
||||
|
||||
> **getFilterMaskBits**(): `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### getFriction()
|
||||
|
||||
> **getFriction**(): `number`
|
||||
|
||||
Get the coefficient of friction, usually in the range [0,1].
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### getMassData()
|
||||
|
||||
> **getMassData**(`massData`): `void`
|
||||
|
||||
Get the mass data for this fixture. The mass data is based on the density and
|
||||
the shape. The rotational inertia is about the shape's origin. This operation
|
||||
may be expensive.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **massData**: [`MassData`](/api/interfaces/MassData)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### getNext()
|
||||
|
||||
> **getNext**(): [`Fixture`](/api/classes/Fixture)
|
||||
|
||||
Get the next fixture in the parent body's fixture list.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Fixture`](/api/classes/Fixture)
|
||||
|
||||
***
|
||||
|
||||
### getRestitution()
|
||||
|
||||
> **getRestitution**(): `number`
|
||||
|
||||
Get the coefficient of restitution.
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
***
|
||||
|
||||
### getShape()
|
||||
|
||||
> **getShape**(): [`Shape`](/api/classes/Shape)
|
||||
|
||||
Get the child shape. You can modify the child shape, however you should not
|
||||
change the number of vertices because this will crash some collision caching
|
||||
mechanisms. Manipulating the shape may lead to non-physical behavior.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Shape`](/api/classes/Shape)
|
||||
|
||||
***
|
||||
|
||||
### getType()
|
||||
|
||||
> **getType**(): [`ShapeType`](/api/type-aliases/ShapeType)
|
||||
|
||||
Get the type of the child shape. You can use this to down cast to the
|
||||
concrete shape.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`ShapeType`](/api/type-aliases/ShapeType)
|
||||
|
||||
***
|
||||
|
||||
### getUserData()
|
||||
|
||||
> **getUserData**(): `unknown`
|
||||
|
||||
Get the user data that was assigned in the fixture definition. Use this to
|
||||
store your application specific data.
|
||||
|
||||
#### Returns
|
||||
|
||||
`unknown`
|
||||
|
||||
***
|
||||
|
||||
### isSensor()
|
||||
|
||||
> **isSensor**(): `boolean`
|
||||
|
||||
A sensor shape collects contact information but never generates a collision
|
||||
response.
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
***
|
||||
|
||||
### rayCast()
|
||||
|
||||
> **rayCast**(`output`, `input`, `childIndex`): `boolean`
|
||||
|
||||
Cast a ray against this shape.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **output**: [`RayCastOutput`](/api/interfaces/RayCastOutput)
|
||||
|
||||
• **input**: [`RayCastInput`](/api/interfaces/RayCastInput)
|
||||
|
||||
• **childIndex**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
***
|
||||
|
||||
### refilter()
|
||||
|
||||
> **refilter**(): `void`
|
||||
|
||||
Call this if you want to establish collision that was previously disabled by
|
||||
ContactFilter.
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### setDensity()
|
||||
|
||||
> **setDensity**(`density`): `void`
|
||||
|
||||
Set the density of this fixture. This will _not_ automatically adjust the
|
||||
mass of the body. You must call Body.resetMassData to update the body's mass.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **density**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### setFilterCategoryBits()
|
||||
|
||||
> **setFilterCategoryBits**(`categoryBits`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **categoryBits**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### setFilterData()
|
||||
|
||||
> **setFilterData**(`filter`): `void`
|
||||
|
||||
Set the contact filtering data. This will not update contacts until the next
|
||||
time step when either parent body is active and awake. This automatically
|
||||
calls refilter.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **filter**
|
||||
|
||||
• **filter.categoryBits**: `number`
|
||||
|
||||
• **filter.groupIndex**: `number`
|
||||
|
||||
• **filter.maskBits**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### setFilterGroupIndex()
|
||||
|
||||
> **setFilterGroupIndex**(`groupIndex`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **groupIndex**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### setFilterMaskBits()
|
||||
|
||||
> **setFilterMaskBits**(`maskBits`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **maskBits**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### setFriction()
|
||||
|
||||
> **setFriction**(`friction`): `void`
|
||||
|
||||
Set the coefficient of friction. This will not change the friction of
|
||||
existing contacts.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **friction**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### setRestitution()
|
||||
|
||||
> **setRestitution**(`restitution`): `void`
|
||||
|
||||
Set the coefficient of restitution. This will not change the restitution of
|
||||
existing contacts.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **restitution**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### setSensor()
|
||||
|
||||
> **setSensor**(`sensor`): `void`
|
||||
|
||||
Set if this fixture is a sensor.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **sensor**: `boolean`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### setUserData()
|
||||
|
||||
> **setUserData**(`data`): `void`
|
||||
|
||||
Set the user data. Use this to store your application specific data.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **data**: `unknown`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### shouldCollide()
|
||||
|
||||
> **shouldCollide**(`that`): `boolean`
|
||||
|
||||
Implement this method to provide collision filtering, if you want finer
|
||||
control over contact creation.
|
||||
|
||||
Return true if contact calculations should be performed between these two
|
||||
fixtures.
|
||||
|
||||
Warning: for performance reasons this is only called when the AABBs begin to
|
||||
overlap.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **that**: [`Fixture`](/api/classes/Fixture)
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
***
|
||||
|
||||
### synchronize()
|
||||
|
||||
> **synchronize**(`broadPhase`, `xf1`, `xf2`): `void`
|
||||
|
||||
Updates this fixture proxy in broad-phase (with combined AABB of current and
|
||||
next transformation).
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **broadPhase**: [`BroadPhase`](/api/classes/BroadPhase)
|
||||
|
||||
• **xf1**: [`TransformValue`](/api/type-aliases/TransformValue)
|
||||
|
||||
• **xf2**: [`TransformValue`](/api/type-aliases/TransformValue)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### testPoint()
|
||||
|
||||
> **testPoint**(`p`): `boolean`
|
||||
|
||||
Test a point in world coordinates for containment in this fixture.
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **p**: [`Vec2Value`](/api/interfaces/Vec2Value)
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
@ -1,43 +0,0 @@
|
||||
# Class: FixtureProxy
|
||||
|
||||
This proxy is used internally to connect shape children to the broad-phase.
|
||||
|
||||
## Constructors
|
||||
|
||||
### new FixtureProxy()
|
||||
|
||||
> **new FixtureProxy**(`fixture`, `childIndex`): [`FixtureProxy`](/api/classes/FixtureProxy)
|
||||
|
||||
#### Parameters
|
||||
|
||||
• **fixture**: [`Fixture`](/api/classes/Fixture)
|
||||
|
||||
• **childIndex**: `number`
|
||||
|
||||
#### Returns
|
||||
|
||||
[`FixtureProxy`](/api/classes/FixtureProxy)
|
||||
|
||||
## Properties
|
||||
|
||||
### aabb
|
||||
|
||||
> **aabb**: [`AABB`](/api/classes/AABB)
|
||||
|
||||
***
|
||||
|
||||
### childIndex
|
||||
|
||||
> **childIndex**: `number`
|
||||
|
||||
***
|
||||
|
||||
### fixture
|
||||
|
||||
> **fixture**: [`Fixture`](/api/classes/Fixture)
|
||||
|
||||
***
|
||||
|
||||
### proxyId
|
||||
|
||||
> **proxyId**: `number`
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user