Compare commits

..

5 Commits
master ... v0.3

Author SHA1 Message Date
Ali Shakiba
2368ec4f80 clean up deps 2021-05-11 16:25:53 -07:00
Ali Shakiba
47de66f03d update readme 2021-05-07 17:04:11 -07:00
Ali Shakiba
bc777d24fd update readme 2021-05-07 15:38:16 -07:00
Ali Shakiba
fab9ed3c5f v0.3.29 2021-04-30 15:42:31 -07:00
James Peach
af62e2d681 index.d.ts: export top level Settings declaration
This was causing issues when using the 0.3.x branch in a typescript context

```
../planck.js/lib/index.d.ts:539:1 - error TS1046: Top-level declarations in \
.d.ts files must start with either a 'declare' or 'export' modifier.

539 let Settings: {
    ~~~
```
2021-04-30 15:41:21 -07:00
488 changed files with 143247 additions and 114125 deletions

View File

@ -1,8 +0,0 @@
# Changesets
Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)
We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)

View File

@ -1,11 +0,0 @@
{
"$schema": "https://unpkg.com/@changesets/config@3.0.5/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"fixed": [],
"linked": [],
"access": "public",
"baseBranch": "master",
"updateInternalDependencies": "patch",
"ignore": []
}

View File

@ -1,50 +0,0 @@
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

View File

@ -1,38 +0,0 @@
name: Build
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '18'
- name: npm-install
run: npm install
- name: npm-test
run: npm run test
- name: npm-lint
run: npm run lint
- name: npm-build
run: npm run build
- name: npm-test-types
run: npm run test:types
- name: npm-typedoc
run: npm run typedoc

52
.gitignore vendored
View File

@ -1,51 +1,7 @@
node_modules/
.idea
dist/docs/
# typedoc
docs/pages/api/
# vitepress
docs/.vitepress/cache/
docs/.vitepress/dist/
docs/.vitepress/.temp/
# misc
.DS_Store
*.pem
# dependencies
node_modules
.pnp
.pnp.js
# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# local env files
.env*.local
.env
# testing
**/ignore
**/ignore.*
/coverage
/.nyc_output
# production
build
/docs/dist
# next.js
.next/
# out/
# vercel
.vercel
# ide
.idea/
.vscode*/
# typescript
*.tsbuildinfo
next-env.d.ts

View File

@ -1,2 +0,0 @@
/dist/
/docs/api/

View File

@ -1,4 +0,0 @@
{
"printWidth": 120,
"quoteProps": "preserve"
}

View File

@ -1,77 +0,0 @@
# 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
- bb9bb87: Testbed rendering rewrite
- 56193e7: Add DataDriver (experimental for demo use-case)
### Patch Changes
- ce1c486: No pointer interaction when mouseForce===0
## 1.2.0
### Minor Changes
- f0127f4: Add world.queueUpdate() to queue and defer updates after current simulation step
### Patch Changes
- 97bb79e: Improve world.queueUpdate
## 1.1.6
### Patch Changes
- f31114b: Add static Vec2.normalize
- bee0e16: Change clampVec2 arg to Vec2Value
## 1.1.5
### Patch Changes
- fbd0021: Un-hidden style field type

View File

@ -1,10 +1,3 @@
## 1.1.0
* Vite build migration
## 1.0.0
* Typescript migration
* Performance improvements
## 0.2
* TypeScript definitions added
* wSet/wAdd/wSub(a, v, b, w) replaced with combine/setCombine/addCombine/subCombine(a, v, b, w)

106
HelloWorld.js Normal file
View File

@ -0,0 +1,106 @@
/*
* MIT License
* Copyright (c) 2019 Erin Catto
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
/*
* This is a simple example of building and running a simulation
* using Planck.js. Here we create a large ground box and a small dynamic
* box.
* There are no graphics for this example. Planck.js is meant to be used
* with your rendering engine in your game engine.
*
* To run this example simply run `node HelloWorld.js` from command line.
*/
var planck = require('./lib')
var Vec2 = planck.Vec2;
// Define the gravity vector.
var gravity = Vec2(0.0, -10.0);
// Construct a world object, which will hold and simulate the rigid bodies.
var world = planck.World(gravity);
// Define the ground body.
var groundBodyDef = {
position: Vec2(0.0, -10.0)
};
// Call the body factory which allocates memory for the ground body
// from a pool and creates the ground box shape (also from a pool).
// The body is also added to the world.
var groundBody = world.createBody(groundBodyDef);
// Define the ground box shape.
// The extents are the half-widths of the box.
var groundBox = planck.Box(50.0, 10.0);
// Add the ground fixture to the ground body.
groundBody.createFixture(groundBox, 0.0);
// Define the dynamic body. We set its position and call the body factory.
var bodyDef = {
type: 'dynamic',
position: Vec2(0.0, 4.0),
}
var body = world.createBody(bodyDef);
// Define another box shape for our dynamic body.
var dynamicBox = planck.Box(1.0, 1.0);
// Define the dynamic body fixture.
var fixtureDef = {
shape: dynamicBox,
// Set the box density to be non-zero, so it will be dynamic.
density: 1.0,
// Override the default friction.
friction: 0.3,
};
// Add the shape to the body.
body.createFixture(fixtureDef);
// Prepare for simulation. Typically we use a time step of 1/60 of a
// second (60Hz) and 10 iterations. This provides a high quality simulation
// in most game scenarios.
var timeStep = 1.0 / 60.0;
var velocityIterations = 6;
var positionIterations = 2;
// This is our little game loop.
for (var i = 0; i < 60; ++i) {
// Instruct the world to perform a single step of simulation.
// It is generally best to keep the time step and iterations fixed.
world.step(timeStep, velocityIterations, positionIterations);
// Now print the position and angle of the body.
var position = body.getPosition();
var angle = body.getAngle();
console.log(position.x.toFixed(2), position.y.toFixed(2), angle.toFixed(2));
}
console.log(Math.abs(position.x) < 0.01);
console.log(Math.abs(position.y - 1.01) < 0.01);
console.log(Math.abs(angle) < 0.01);

View File

@ -1,86 +0,0 @@
/*
* Copyright (c) Erin Catto
* Licensed under the MIT license
*/
/*
* This is a simple example of building and running a simulation
* using Planck.js. Here we create a large ground box and a small dynamic
* box.
* There are no graphics for this example. Planck.js is meant to be used
* with your rendering engine in your game engine.
*
* To run this example simply run `node HelloWorld.js` from command line.
*/
import { Box, World } from "./src";
// Define the gravity vector.
var gravity = { x: 0.0, y: -10.0 };
// Construct a world object, which will hold and simulate the rigid bodies.
var world = new World({
gravity: gravity,
});
// Define the ground body.
var groundBodyDef = {
position: { x: 0.0, y: -10.0 },
};
// Call the body factory which allocates memory for the ground body
// from a pool and creates the ground box shape (also from a pool).
// The body is also added to the world.
var groundBody = world.createBody(groundBodyDef);
// Define the ground box shape.
// The extents are the half-widths of the box.
var groundBox = new Box(50.0, 10.0);
// Add the ground fixture to the ground body.
groundBody.createFixture(groundBox, 0.0);
// Define the dynamic body. We set its position and call the body factory.
var body = world.createBody({
type: "dynamic",
position: { x: 0.0, y: 4.0 },
});
// Define another box shape for our dynamic body.
var dynamicBox = new Box(1.0, 1.0);
// Define the dynamic body fixture.
var fixtureDef = {
shape: dynamicBox,
// Set the box density to be non-zero, so it will be dynamic.
density: 1.0,
// Override the default friction.
friction: 0.3,
};
// Add the shape to the body.
body.createFixture(fixtureDef);
// Prepare for simulation. Typically we use a time step of 1/60 of a
// second (60Hz) and 10 iterations. This provides a high quality simulation
// in most game scenarios.
var timeStep = 1.0 / 60.0;
var velocityIterations = 6;
var positionIterations = 2;
// This is our little game loop.
for (var i = 0; i < 60; ++i) {
// Instruct the world to perform a single step of simulation.
// It is generally best to keep the time step and iterations fixed.
world.step(timeStep, velocityIterations, positionIterations);
// Now print the position and angle of the body.
var position = body.getPosition();
var angle = body.getAngle();
console.log(position.x.toFixed(2), position.y.toFixed(2), angle.toFixed(2));
}
console.log(Math.abs(position.x) < 0.01);
console.log(Math.abs(position.y - 1.01) < 0.01);
console.log(Math.abs(angle) < 0.01);

View File

@ -1,5 +1,6 @@
The MIT License
Copyright (c) Erin Catto, Ali Shakiba
Copyright (c) 2021 Erin Catto, Ali Shakiba
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

145
README.md
View File

@ -1,65 +1,104 @@
# 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.
Planck.js is JavaScript rewrite of Box2D physics engine for cross-platform HTML5 game development.
#### Motivations
- Taking advantage of Box2D's efforts and achievements
- Developing readable and editable code in JavaScript/TypeScript
- Providing idiomatic JavaScript/TypeScript API
- Developing readable and maintainable JavaScript code
- Optimizing the library for web and mobile platforms
- Providing a JavaScript-friendly API
#### [Documentation](https://piqnt.com/planck.js/docs/)
#### [Examples](https://piqnt.com/planck.js/)
## Documentation
#### [Discord](https://discord.com/invite/znjh6J7)
- [Documentation Wiki](https://github.com/shakiba/planck.js/wiki/) - This is the best place to start, and find other resources
- [Examples](https://piqnt.com/planck.js/) - Online examples with editable code
#### [Made with Planck.js](https://github.com/piqnt/planck.js/wiki/)
#### [Report Issues](https://github.com/piqnt/planck.js/issues)
To speed up resolving issues, please provide [testbed](https://piqnt.com/planck.js/docs/testbed) code to reproduce the issue.
## Community
- [Discord](https://discord.gg/znjh6J7) - Community discussions and Q/A
- [Twitter @Piqnt](https://twitter.com/piqnt) - Updates and news
- [GitHub](https://github.com/shakiba/planck.js/) - Source code and issues
## API and Architecture
Planck.js includes Box2D algorithms without modification and its architecture is very similar to Box2D.
However some internal changes and refactoring are made during rewrite to address differences between C++ and JavaScript.
Planck.js public API closely follows Box2D API, with the following differences:
- `b2` prefix is dropped from class names, for example `b2World` is now available as `planck.World`.
- Method names are converted from UpperCamelCase to lowerCamelCase.
- Definition classes/objects (BodyDef, FixtureDef, etc.) are replaced by inline JavaScript objects (`{}`).
- Shapes are considered immutable and are not cloned when used to create fixtures.
- Contact filtering can be customized by overriding shouldCollide method of Fixture.
- Listener classes are replaced with simple functions.
- `World#on(eventName, listenerFn)` and `World#off(eventName, listenerFn)` are added to add and remove event listeners. Currently supported events are:
`'begin-contact'`, `'end-contact'`, `'pre-solve'`, `'post-solve'`, `'remove-joint'`, `'remove-fixture'`, `'remove-body'`
## Install
### v0.3 (stable release)
Package name for v0.3 is `planck-js`.
##### CDN
The library is available on [jsDelivr](https://www.jsdelivr.com/package/npm/planck-js).
##### NPM
Install NPM package.
```sh
npm install planck-js --save
```
Use core library.
```js
const planck = require('planck-js');
```
##### Testbed
Use CDN in a web page.
```html
<html><body>
<script src="//cdn.jsdelivr.net/npm/planck-js@latest/dist/planck-with-testbed.min.js"></script>
<script>
planck.testbed(function(testbed) {
// Your testbed code
});
</script>
</body></html>
```
Use NPM package in Node.
```js
const planck = require('planck-js/dist/planck-with-testbed');
planck.testbed(function() {
// ...
});
```
### v1.0 (alpha)
Staring from v1.0 package name is changed to `planck`.
To install v1.0 see [master branch](https://github.com/shakiba/planck.js/#install).
## Credits
[Box2D](https://github.com/erincatto/box2d) is a popular C++ 2D rigid-body physics engine created by [Erin Catto](https://twitter.com/erin_catto). Box2D is used in several popular games, such as Angry Birds, Limbo and Crayon Physics, as well as game development tools and libraries such as Apple's SpriteKit.
[Planck.js](https://github.com/shakiba/planck.js) is developed and maintained by [Ali Shakiba](https://github.com/shakiba/).
TypeScript definitions for planck.js are developed by [Oliver Zell](https://github.com/zOadT).
## License
Planck.js is [available under the MIT license](./LICENSE.txt).

View File

@ -1,225 +0,0 @@
export interface TestInterface {
name: string;
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 {
x: number;
y: number;
}
export type TestFactory = (gravity: XY, edgeV1: XY, edgeV2: XY, edgeDensity: number) => TestInterface;
const PYRAMID_SIZE = 40;
const GRAVITY = { x: 0, y: -10 };
const DELTA_X = { x: 0.5625, y: 1 };
const DELTA_Y = { x: 1.125, y: 0 };
const BOX_DENSITY = 5;
const GROUND_DENSITY = 0;
const TIME_STEP = 1 / 60;
const VELOCITY_ITERATIONS = 3;
const POSITION_ITERATIONS = 3;
const EDGE_V1 = { x: -40, y: 0 };
const EDGE_V2 = { x: 40, y: 0 };
const START_X = { x: -7, y: 0.75 };
const BOX_SIZE = { x: 0.5, y: 0.5 };
const WARMUP_ITERATIONS = 64;
const BENCH_ITERATIONS = 256;
function setupWorld(test: TestInterface) {
// Setup world
const shape = test.createBoxShape(BOX_SIZE.x, BOX_SIZE.y);
const x = { ...START_X };
for (let i = 0; i < PYRAMID_SIZE; ++i) {
const y = { ...x };
for (let j = i; j < PYRAMID_SIZE; ++j) {
test.createBoxBody(shape, y.x, y.y, BOX_DENSITY);
y.x += DELTA_Y.x;
y.y += DELTA_Y.y;
}
x.x += DELTA_X.x;
x.y += DELTA_X.y;
}
}
export type ProgressFunc = (value: number, max: number) => void;
async function warmupAsync(test: TestInterface, progress: ProgressFunc): Promise<void> {
return new Promise<void>((resolve: (value: void) => void) => {
let step = 0;
progress(0, WARMUP_ITERATIONS + BENCH_ITERATIONS);
const runNext = () => {
if (step < WARMUP_ITERATIONS) {
test.step(TIME_STEP, VELOCITY_ITERATIONS, POSITION_ITERATIONS);
progress(step, WARMUP_ITERATIONS + BENCH_ITERATIONS);
step++;
window.requestAnimationFrame(runNext);
} else {
resolve();
}
};
window.requestAnimationFrame(runNext);
});
}
async function benchAsync(test: TestInterface, progress: ProgressFunc): Promise<number[]> {
return new Promise((resolve: (value: number[]) => void) => {
let step = 0;
progress(0, WARMUP_ITERATIONS + BENCH_ITERATIONS);
const times: number[] = [];
const runNext = () => {
if (step < BENCH_ITERATIONS) {
const begin = performance.now();
test.step(TIME_STEP, VELOCITY_ITERATIONS, POSITION_ITERATIONS);
times.push(performance.now() - begin);
progress(WARMUP_ITERATIONS + step, WARMUP_ITERATIONS + BENCH_ITERATIONS);
step++;
window.requestAnimationFrame(runNext);
} else {
resolve(times);
}
};
window.requestAnimationFrame(runNext);
});
}
function warmup(test: TestInterface) {
for (let i = 0; i < WARMUP_ITERATIONS; i++) {
test.step(TIME_STEP, VELOCITY_ITERATIONS, POSITION_ITERATIONS);
}
}
function bench(test: TestInterface) {
const times: number[] = [];
for (let i = 0; i < BENCH_ITERATIONS; i++) {
const begin = performance.now();
test.step(TIME_STEP, VELOCITY_ITERATIONS, POSITION_ITERATIONS);
times.push(performance.now() - begin);
}
return times.sort();
}
function mean(values: number[]) {
let total = 0;
for (const value of values) total += value;
return total / BENCH_ITERATIONS;
}
// Simple nearest-rank %ile (on sorted array). We should have enough samples to make this reasonable.
function percentile(values: number[], pc: number) {
const rank = Math.floor((pc * values.length) / 100);
return values[rank];
}
export function prepareTests(factories: TestFactory[]) {
return factories.map((factory: TestFactory) => factory(GRAVITY, EDGE_V1, EDGE_V2, GROUND_DENSITY));
}
export function runTest(test: TestInterface) {
setupWorld(test);
warmup(test);
const times = bench(test);
return {
name: test.name,
avg: mean(times),
p5: percentile(times, 5),
p95: percentile(times, 95),
};
}
export async function runTestAsync(test: TestInterface, progress: ProgressFunc) {
setupWorld(test);
await warmupAsync(test, progress);
const times = await benchAsync(test, progress);
return {
name: test.name,
avg: mean(times),
p5: percentile(times, 5),
p95: percentile(times, 95),
};
}
export type TestResult = ReturnType<typeof runTest>;
export function runAllTests(factories: TestFactory[]) {
const tests = prepareTests(factories);
const results: TestResult[] = [];
console.log("Running Benchmarks:");
for (const test of tests) {
const result = runTest(test);
results.push(result);
console.log(` ✓ ${result.name}`);
}
return results.sort((a: TestResult, b: TestResult) => a.avg - b.avg);
}
const noop = () => undefined;
export async function runAllTestsAsync(factories: TestFactory[]) {
const tests = prepareTests(factories);
console.log("Running Benchmarks:");
const results: TestResult[] = [];
for (const test of tests) {
// eslint-disable-next-line no-await-in-loop
const result = await runTestAsync(test, noop);
console.log(` ✓ ${result.name}`);
results.push(result);
}
return results.sort((a: TestResult, b: TestResult) => a.avg - b.avg);
}
export function resultsToMarkdown(results: TestResult[]) {
const header = ["Name", "avg ms/frame", "5th %ile", "95th %ile", "Ratio"];
const rows = results.map((r: TestResult) => [
r.name,
r.avg.toFixed(2),
r.p5.toString(),
r.p95.toString(),
(r.avg / results[0].avg).toFixed(2),
]);
const lengths = header.map((label: string, index: number) =>
Math.max(label.length, ...rows.map((columns: string[]) => columns[index].length)),
);
function getDashes(length: number) {
return "-".repeat(length);
}
const dashes = `| ${lengths.map(getDashes).join(" | ")} |`;
const lines: string[] = [];
lines.push(`| ${header.map(pad).join(" | ")} |`);
lines.push(dashes);
function pad(value: string, index: number) {
const length = lengths[index];
if (value.length < length) {
if (index > 0) return " ".repeat(length - value.length) + value;
return value + " ".repeat(length - value.length);
}
return value;
}
for (const row of rows) {
lines.push(`| ${row.map(pad).join(" | ")} |`);
}
return lines.join("\n");
}
export function logResults(results: TestResult[]) {
console.log("\nResults:");
console.log(resultsToMarkdown(results));
}

View File

@ -1,106 +0,0 @@
import { prepareTests, resultsToMarkdown, runTestAsync, TestResult, TestInterface, TestFactory } from "./benchmark";
import { box2dJsFactory } from "./tests/box2d-js";
import { planckFactory } from "./tests/planck";
export const tests: TestFactory[] = [
box2dJsFactory,
planckFactory,
];
export function getBrowserInfo() {
const ua = navigator.userAgent;
let M = ua.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) ?? [];
if (/trident/i.test(M[1])) {
const tem = /\brv[ :]+(\d+)/g.exec(ua) ?? [];
const version = tem[1] || "";
return `IE ${version}`;
}
if (M[1] === "Chrome") {
const tem = ua.match(/\bOPR|Edge\/(\d+)/);
if (tem !== null) return `Opera ${tem[1]}`;
}
M = M[2] ? [M[1], M[2]] : [navigator.appName, navigator.appVersion, "-?"];
const tem = ua.match(/version\/(\d+)/i);
if (tem !== null) M.splice(1, 1, tem[1]);
return `${M[0]} ${M[1]}`;
}
const startButton = document.getElementById("start") as HTMLButtonElement;
const tbody = document.querySelector("tbody") as HTMLElement;
const ratioHead = document.getElementById("ratio") as HTMLElement;
const branchName = document.getElementById("branch-name") as HTMLElement;
branchName.innerHTML = [
import.meta.env.VITE_GIT_BRANCH_NAME,
import.meta.env.VITE_GIT_COMMIT_HASH.slice(0, 7),
import.meta.env.VITE_GIT_COMMIT_DATE.slice(0, 19).replace("T", " "),
'\"' + import.meta.env.VITE_GIT_LAST_COMMIT_MESSAGE + '\"',
].join("<br />");
const testRows = prepareTests(tests).map((test: TestInterface) => {
const row = document.createElement("tr");
tbody.appendChild(row);
const name = document.createElement("td");
const avg = document.createElement("td");
const p5 = document.createElement("td");
const p95 = document.createElement("td");
const ratio = document.createElement("td");
name.textContent = test.name;
row.appendChild(name);
row.appendChild(avg);
row.appendChild(p5);
row.appendChild(p95);
row.appendChild(ratio);
const progress = document.createElement("progress");
return {
row,
test,
begin() {
test.setup();
ratio.appendChild(progress);
progress.value = 0;
},
progress(value: number, max: number) {
progress.value = value;
progress.max = max;
},
end(result: TestResult) {
test.teardown();
avg.textContent = result.avg.toFixed(2);
p5.textContent = result.p5.toString();
p95.textContent = result.p95.toString();
ratio.textContent = "✓";
},
final(ratioValue: number) {
ratio.textContent = ratioValue.toFixed(2);
tbody.appendChild(row);
},
};
});
type TestResultAndRow = TestResult & { testRow: typeof testRows[0] };
export async function runAllTestsAsync() {
ratioHead.textContent = "";
const results: TestResultAndRow[] = [];
for (const testRow of testRows) {
testRow.begin();
// eslint-disable-next-line no-await-in-loop
const result = await runTestAsync(testRow.test, testRow.progress);
testRow.end(result);
results.push({ ...result, testRow });
}
results.sort((a: TestResultAndRow, b: TestResultAndRow) => a.avg - b.avg).forEach((result: TestResultAndRow) => result.testRow.final(result.avg / results[0].avg));
startButton.removeAttribute("disabled");
ratioHead.textContent = "Ratio";
console.log(`Browser: ${getBrowserInfo()}\n${resultsToMarkdown(results)}`);
}
startButton.addEventListener("click", () => {
startButton.disabled = true;
runAllTestsAsync();
});

View File

@ -1,49 +0,0 @@
<html>
<head>
<meta charset="utf-8" />
<title>Planck.js/Box2D Benchmark</title>
<style>
th, td {
padding: 2px 5px;
}
table {
border-collapse: collapse;
margin-top: 5px;
}
td {
border: 1px solid gray;
}
th:first-child {
text-align: left;
}
progress {
width: 200px;
}
textarea {
width: 500px;
height: 300px;
}
</style>
</head>
<body>
<h3>Planck.js/Box2D Benchmark</h3>
<button id="start">Start</button>
<table>
<thead>
<tr>
<th>Name</th>
<th>avg ms/frame</th>
<th>5th %ile</th>
<th>95th %ile</th>
<th id="ratio">Ratio</th>
</tr>
</thead>
<tbody></tbody>
</table>
<script src="https://kripken.github.io/box2d.js/build/Box2D_v2.3.1_min.js"></script>
<script type="module" src="./browser.ts"></script>
<br />
<br />
<span id="branch-name"></span>
</body>
</html>

View File

@ -1,13 +0,0 @@
import { performance } from "perf_hooks";
global.performance = performance as any;
import { logResults, runAllTests } from "./benchmark";
import type { TestFactory } from "./benchmark";
import { planckFactory } from "./tests/planck";
export const tests: TestFactory[] = [
planckFactory,
];
const results = runAllTests(tests);
logResults(results);

View File

@ -1,42 +0,0 @@
import "./fixprocess";
const { b2Body, b2World, b2Vec2, b2EdgeShape, b2PolygonShape, b2_dynamicBody, b2BodyDef } = Box2D;
import type { TestFactory } from "../benchmark";
export const box2dJsFactory: TestFactory = (gravity, edgeV1, edgeV2, edgeDensity) => {
let world: typeof b2World;
let ground: typeof b2Body;
let edgeShape: typeof b2EdgeShape;
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);
},
};
};

View File

@ -1,19 +0,0 @@
// box2d.js tries to access process.stdout/err, need to emulate it
if ("requestAnimationFrame" in globalThis) {
// // @ts-ignore
// window.process.stdout = {
// write(x: string) {
// console.log(x);
// return true;
// },
// };
// // @ts-ignore
// globalThis.process.stderr = {
// write(x: string) {
// console.error(x);
// return true;
// },
// };
}

View File

@ -1,39 +0,0 @@
import { World, Vec2, EdgeShape, BoxShape, Body } from "../../src/index";
import { TestFactory } from "../benchmark";
export const planckFactory: TestFactory = (gravity, edgeV1, edgeV2, edgeDensity) => {
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),
});
ground = world.createBody({});
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;
},
};
};

23
bower.json Normal file
View File

@ -0,0 +1,23 @@
{
"name": "planck-js",
"description": "2D JavaScript physics engine for cross-platform HTML5 game development",
"keywords": [
"html5",
"javascript",
"game",
"physics",
"engine",
"2d",
"mobile"
],
"license": "zlib",
"repository": {
"type": "git",
"url": "git://github.com/shakiba/planck.js.git"
},
"ignore": [
"example/",
"ignore/",
"test/"
]
}

23331
dist/planck-with-testbed.commonjs.js vendored Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

18794
dist/planck.commonjs.js vendored Normal file

File diff suppressed because it is too large Load Diff

1
dist/planck.commonjs.js.map vendored Normal file

File diff suppressed because one or more lines are too long

4346
dist/planck.d.ts vendored

File diff suppressed because it is too large Load Diff

30704
dist/planck.js vendored

File diff suppressed because it is too large Load Diff

2
dist/planck.js.map vendored

File diff suppressed because one or more lines are too long

19
dist/planck.min.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

12144
dist/planck.mjs vendored

File diff suppressed because it is too large Load Diff

1
dist/planck.mjs.map vendored

File diff suppressed because one or more lines are too long

View File

@ -1,96 +0,0 @@
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" },
],
},
});

71
docs/API.md Normal file
View File

@ -0,0 +1,71 @@
### API Index
* [World](/docs/api/classes/world.md)
* [Body](/docs/api/classes/body.md)
* [Fixture](/docs/api/classes/fixture.md)
* [Settings](/docs/api/classes/settings.md)
#### Math
* [Math](/docs/api/classes/math.md)
* [Vec2](/docs/api/classes/vec2.md)
* [Vec3](/docs/api/classes/vec3.md)
* [Transform](/docs/api/classes/transform.md)
* [Rot](/docs/api/classes/rot.md)
* [Mat22](/docs/api/classes/mat22.md)
* [Mat33](/docs/api/classes/mat33.md)
#### Shapes
* [BoxShape](/docs/api/classes/boxshape.md)
* [ChainShape](/docs/api/classes/chainshape.md)
* [CircleShape](/docs/api/classes/circleshape.md)
* [EdgeShape](/docs/api/classes/edgeshape.md)
* [PolygonShape](/docs/api/classes/polygonshape.md)
#### Joints
* [FrictionJoint](/docs/api/classes/frictionjoint.md)
* [DistanceJoint](/docs/api/classes/distancejoint.md)
* [GearJoint](/docs/api/classes/gearjoint.md)
* [MotorJoint](/docs/api/classes/motorjoint.md)
* [MouseJoint](/docs/api/classes/mousejoint.md)
* [PrismaticJoint](/docs/api/classes/prismaticjoint.md)
* [PulleyJoint](/docs/api/classes/pulleyjoint.md)
* [RevoluteJoint](/docs/api/classes/revolutejoint.md)
* [RopeJoint](/docs/api/classes/ropejoint.md)
* [WeldJoint](/docs/api/classes/weldjoint.md)
* [WheelJoint](/docs/api/classes/wheeljoint.md)
#### Collision Internal
* [BroadPhase](/docs/api/classes/broadphase.md)
* [AABB](/docs/api/classes/aabb.md)
* [DynamicTree](/docs/api/classes/dynamictree.md)
* [TreeNode](/docs/api/classes/treenode.md)
* [DistanceProxy](/docs/api/classes/distanceproxy.md)
* [ContactFeatureType](/docs/api/enums/contactfeaturetype.md)
* [ManifoldType](/docs/api/enums/manifoldtype.md)
* [TOIOutputState](/docs/api/enums/toioutputstate.md)
* [FixtureProxy](/docs/api/interfaces/fixtureproxy.md)
* [Manifold](/docs/api/interfaces/manifold.md)
* [ManifoldPoint](/docs/api/interfaces/manifoldpoint.md)
* [WorldManifold](/docs/api/interfaces/worldmanifold.md)
#### Dynamics Internal
* [Solver](/docs/api/classes/solver.md)
* [Contact](/docs/api/classes/contact.md)
* [ContactImpulse](/docs/api/classes/contactimpulse.md)
* [ContactEdge](/docs/api/classes/contactedge.md)
* [ContactFeature](/docs/api/interfaces/contactfeature.md)
* [ContactID](/docs/api/interfaces/contactid.md)
* [Position](/docs/api/classes/position.md)
* [Velocity](/docs/api/classes/velocity.md)
* [Sweep](/docs/api/classes/sweep.md)
* [VelocityConstraintPoint](/docs/api/classes/velocityconstraintpoint.md)

75
docs/api/README.md Normal file
View File

@ -0,0 +1,75 @@
[Planck.js API Doc](README.md) › [Globals](globals.md)
# Planck.js API Doc
### API Index
* [World](/docs/api/classes/world.md)
* [Body](/docs/api/classes/body.md)
* [Fixture](/docs/api/classes/fixture.md)
* [Settings](/docs/api/classes/settings.md)
#### Math
* [Math](/docs/api/classes/math.md)
* [Vec2](/docs/api/classes/vec2.md)
* [Vec3](/docs/api/classes/vec3.md)
* [Transform](/docs/api/classes/transform.md)
* [Rot](/docs/api/classes/rot.md)
* [Mat22](/docs/api/classes/mat22.md)
* [Mat33](/docs/api/classes/mat33.md)
#### Shapes
* [BoxShape](/docs/api/classes/boxshape.md)
* [ChainShape](/docs/api/classes/chainshape.md)
* [CircleShape](/docs/api/classes/circleshape.md)
* [EdgeShape](/docs/api/classes/edgeshape.md)
* [PolygonShape](/docs/api/classes/polygonshape.md)
#### Joints
* [FrictionJoint](/docs/api/classes/frictionjoint.md)
* [DistanceJoint](/docs/api/classes/distancejoint.md)
* [GearJoint](/docs/api/classes/gearjoint.md)
* [MotorJoint](/docs/api/classes/motorjoint.md)
* [MouseJoint](/docs/api/classes/mousejoint.md)
* [PrismaticJoint](/docs/api/classes/prismaticjoint.md)
* [PulleyJoint](/docs/api/classes/pulleyjoint.md)
* [RevoluteJoint](/docs/api/classes/revolutejoint.md)
* [RopeJoint](/docs/api/classes/ropejoint.md)
* [WeldJoint](/docs/api/classes/weldjoint.md)
* [WheelJoint](/docs/api/classes/wheeljoint.md)
#### Collision Internal
* [BroadPhase](/docs/api/classes/broadphase.md)
* [AABB](/docs/api/classes/aabb.md)
* [DynamicTree](/docs/api/classes/dynamictree.md)
* [TreeNode](/docs/api/classes/treenode.md)
* [DistanceProxy](/docs/api/classes/distanceproxy.md)
* [ContactFeatureType](/docs/api/enums/contactfeaturetype.md)
* [ManifoldType](/docs/api/enums/manifoldtype.md)
* [TOIOutputState](/docs/api/enums/toioutputstate.md)
* [FixtureProxy](/docs/api/interfaces/fixtureproxy.md)
* [Manifold](/docs/api/interfaces/manifold.md)
* [ManifoldPoint](/docs/api/interfaces/manifoldpoint.md)
* [WorldManifold](/docs/api/interfaces/worldmanifold.md)
#### Dynamics Internal
* [Solver](/docs/api/classes/solver.md)
* [Contact](/docs/api/classes/contact.md)
* [ContactImpulse](/docs/api/classes/contactimpulse.md)
* [ContactEdge](/docs/api/classes/contactedge.md)
* [ContactFeature](/docs/api/interfaces/contactfeature.md)
* [ContactID](/docs/api/interfaces/contactid.md)
* [Position](/docs/api/classes/position.md)
* [Velocity](/docs/api/classes/velocity.md)
* [Sweep](/docs/api/classes/sweep.md)
* [VelocityConstraintPoint](/docs/api/classes/velocityconstraintpoint.md)

322
docs/api/classes/aabb.md Normal file
View File

@ -0,0 +1,322 @@
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [AABB](aabb.md)
# Class: AABB
## Hierarchy
* **AABB**
## Callable
▸ **AABB**(`lower?`: [Vec2](vec2.md), `upper?`: [Vec2](vec2.md)): *[AABB](aabb.md)*
*Defined in [collision/index.d.ts:34](https://github.com/shakiba/planck.js/blob/038d425/lib/collision/index.d.ts#L34)*
**Parameters:**
Name | Type |
------ | ------ |
`lower?` | [Vec2](vec2.md) |
`upper?` | [Vec2](vec2.md) |
**Returns:** *[AABB](aabb.md)*
## Index
### Properties
* [lowerBound](aabb.md#lowerbound)
* [upperBound](aabb.md#upperbound)
### Methods
* [areEqual](aabb.md#areequal)
* [assert](aabb.md#assert)
* [combine](aabb.md#combine)
* [combinePoints](aabb.md#combinepoints)
* [constroctor](aabb.md#constroctor)
* [contains](aabb.md#contains)
* [diff](aabb.md#diff)
* [extend](aabb.md#extend)
* [getCenter](aabb.md#getcenter)
* [getExtents](aabb.md#getextents)
* [getPerimeter](aabb.md#getperimeter)
* [isValid](aabb.md#isvalid)
* [rayCast](aabb.md#raycast)
* [set](aabb.md#set)
* [testOverlap](aabb.md#testoverlap)
* [toString](aabb.md#tostring)
## Properties
### lowerBound
• **lowerBound**: *[Vec2](vec2.md)*
*Defined in [collision/index.d.ts:45](https://github.com/shakiba/planck.js/blob/038d425/lib/collision/index.d.ts#L45)*
___
### upperBound
• **upperBound**: *[Vec2](vec2.md)*
*Defined in [collision/index.d.ts:46](https://github.com/shakiba/planck.js/blob/038d425/lib/collision/index.d.ts#L46)*
## Methods
### areEqual
▸ **areEqual**(`a`: [AABB](aabb.md), `b`: [AABB](aabb.md)): *boolean*
*Defined in [collision/index.d.ts:42](https://github.com/shakiba/planck.js/blob/038d425/lib/collision/index.d.ts#L42)*
**Parameters:**
Name | Type |
------ | ------ |
`a` | [AABB](aabb.md) |
`b` | [AABB](aabb.md) |
**Returns:** *boolean*
___
### assert
▸ **assert**(`o`: any): *void*
*Defined in [collision/index.d.ts:39](https://github.com/shakiba/planck.js/blob/038d425/lib/collision/index.d.ts#L39)*
**Parameters:**
Name | Type |
------ | ------ |
`o` | any |
**Returns:** *void*
___
### combine
▸ **combine**(`a`: [AABB](aabb.md), `b`: [AABB](aabb.md)): *void*
*Defined in [collision/index.d.ts:52](https://github.com/shakiba/planck.js/blob/038d425/lib/collision/index.d.ts#L52)*
**Parameters:**
Name | Type |
------ | ------ |
`a` | [AABB](aabb.md) |
`b` | [AABB](aabb.md) |
**Returns:** *void*
___
### combinePoints
▸ **combinePoints**(`a`: [Vec2](vec2.md), `b`: [Vec2](vec2.md)): *void*
*Defined in [collision/index.d.ts:53](https://github.com/shakiba/planck.js/blob/038d425/lib/collision/index.d.ts#L53)*
**Parameters:**
Name | Type |
------ | ------ |
`a` | [Vec2](vec2.md) |
`b` | [Vec2](vec2.md) |
**Returns:** *void*
___
### constroctor
▸ **constroctor**(`lower?`: [Vec2](vec2.md), `upper?`: [Vec2](vec2.md)): *any*
*Defined in [collision/index.d.ts:36](https://github.com/shakiba/planck.js/blob/038d425/lib/collision/index.d.ts#L36)*
**Parameters:**
Name | Type |
------ | ------ |
`lower?` | [Vec2](vec2.md) |
`upper?` | [Vec2](vec2.md) |
**Returns:** *any*
___
### contains
▸ **contains**(`aabb`: [AABB](aabb.md)): *boolean*
*Defined in [collision/index.d.ts:55](https://github.com/shakiba/planck.js/blob/038d425/lib/collision/index.d.ts#L55)*
**Parameters:**
Name | Type |
------ | ------ |
`aabb` | [AABB](aabb.md) |
**Returns:** *boolean*
___
### diff
▸ **diff**(`a`: [AABB](aabb.md), `b`: [AABB](aabb.md)): *number*
*Defined in [collision/index.d.ts:43](https://github.com/shakiba/planck.js/blob/038d425/lib/collision/index.d.ts#L43)*
**Parameters:**
Name | Type |
------ | ------ |
`a` | [AABB](aabb.md) |
`b` | [AABB](aabb.md) |
**Returns:** *number*
___
### extend
▸ **extend**(`aabb`: [AABB](aabb.md), `value`: number): *void*
*Defined in [collision/index.d.ts:40](https://github.com/shakiba/planck.js/blob/038d425/lib/collision/index.d.ts#L40)*
**Parameters:**
Name | Type |
------ | ------ |
`aabb` | [AABB](aabb.md) |
`value` | number |
**Returns:** *void*
▸ **extend**(`value`: number): *[AABB](aabb.md)*
*Defined in [collision/index.d.ts:56](https://github.com/shakiba/planck.js/blob/038d425/lib/collision/index.d.ts#L56)*
**Parameters:**
Name | Type |
------ | ------ |
`value` | number |
**Returns:** *[AABB](aabb.md)*
___
### getCenter
▸ **getCenter**(): *[Vec2](vec2.md)*
*Defined in [collision/index.d.ts:49](https://github.com/shakiba/planck.js/blob/038d425/lib/collision/index.d.ts#L49)*
**Returns:** *[Vec2](vec2.md)*
___
### getExtents
▸ **getExtents**(): *[Vec2](vec2.md)*
*Defined in [collision/index.d.ts:50](https://github.com/shakiba/planck.js/blob/038d425/lib/collision/index.d.ts#L50)*
**Returns:** *[Vec2](vec2.md)*
___
### getPerimeter
▸ **getPerimeter**(): *number*
*Defined in [collision/index.d.ts:51](https://github.com/shakiba/planck.js/blob/038d425/lib/collision/index.d.ts#L51)*
**Returns:** *number*
___
### isValid
▸ **isValid**(`o`: any): *boolean*
*Defined in [collision/index.d.ts:38](https://github.com/shakiba/planck.js/blob/038d425/lib/collision/index.d.ts#L38)*
**Parameters:**
Name | Type |
------ | ------ |
`o` | any |
**Returns:** *boolean*
▸ **isValid**(): *boolean*
*Defined in [collision/index.d.ts:48](https://github.com/shakiba/planck.js/blob/038d425/lib/collision/index.d.ts#L48)*
**Returns:** *boolean*
___
### rayCast
▸ **rayCast**(`output`: [RayCastOutput](../interfaces/raycastoutput.md), `input`: [RayCastInput](../interfaces/raycastinput.md)): *boolean*
*Defined in [collision/index.d.ts:57](https://github.com/shakiba/planck.js/blob/038d425/lib/collision/index.d.ts#L57)*
**Parameters:**
Name | Type |
------ | ------ |
`output` | [RayCastOutput](../interfaces/raycastoutput.md) |
`input` | [RayCastInput](../interfaces/raycastinput.md) |
**Returns:** *boolean*
___
### set
▸ **set**(`aabb`: [AABB](aabb.md)): *void*
*Defined in [collision/index.d.ts:54](https://github.com/shakiba/planck.js/blob/038d425/lib/collision/index.d.ts#L54)*
**Parameters:**
Name | Type |
------ | ------ |
`aabb` | [AABB](aabb.md) |
**Returns:** *void*
___
### testOverlap
▸ **testOverlap**(`a`: [AABB](aabb.md), `b`: [AABB](aabb.md)): *boolean*
*Defined in [collision/index.d.ts:41](https://github.com/shakiba/planck.js/blob/038d425/lib/collision/index.d.ts#L41)*
**Parameters:**
Name | Type |
------ | ------ |
`a` | [AABB](aabb.md) |
`b` | [AABB](aabb.md) |
**Returns:** *boolean*
___
### toString
▸ **toString**(): *string*
*Defined in [collision/index.d.ts:58](https://github.com/shakiba/planck.js/blob/038d425/lib/collision/index.d.ts#L58)*
**Returns:** *string*

1007
docs/api/classes/body.md Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,51 @@
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [BoxShape](boxshape.md)
# Class: BoxShape
## Hierarchy
* any
↳ **BoxShape**
## Callable
▸ **BoxShape**(`hx`: number, `hy`: number, `center?`: [Vec2](vec2.md), `angle?`: number): *[BoxShape](boxshape.md)*
*Defined in [shape/index.d.ts:78](https://github.com/shakiba/planck.js/blob/038d425/lib/shape/index.d.ts#L78)*
**Parameters:**
Name | Type |
------ | ------ |
`hx` | number |
`hy` | number |
`center?` | [Vec2](vec2.md) |
`angle?` | number |
**Returns:** *[BoxShape](boxshape.md)*
## Index
### Constructors
* [constructor](boxshape.md#constructor)
## Constructors
### constructor
\+ **new BoxShape**(`hx`: number, `hy`: number, `center?`: [Vec2](vec2.md), `angle?`: number): *[BoxShape](boxshape.md)*
*Defined in [shape/index.d.ts:79](https://github.com/shakiba/planck.js/blob/038d425/lib/shape/index.d.ts#L79)*
**Parameters:**
Name | Type |
------ | ------ |
`hx` | number |
`hy` | number |
`center?` | [Vec2](vec2.md) |
`angle?` | number |
**Returns:** *[BoxShape](boxshape.md)*

View File

@ -0,0 +1,7 @@
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [BroadPhase](broadphase.md)
# Class: BroadPhase
## Hierarchy
* **BroadPhase**

View File

@ -0,0 +1,97 @@
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [ChainShape](chainshape.md)
# Class: ChainShape
## Hierarchy
* any
↳ **ChainShape**
## Callable
▸ **ChainShape**(`vertices`: [Vec2](vec2.md)[], `loop?`: boolean): *[ChainShape](chainshape.md)*
*Defined in [shape/index.d.ts:83](https://github.com/shakiba/planck.js/blob/038d425/lib/shape/index.d.ts#L83)*
**Parameters:**
Name | Type |
------ | ------ |
`vertices` | [Vec2](vec2.md)[] |
`loop?` | boolean |
**Returns:** *[ChainShape](chainshape.md)*
## Index
### Constructors
* [constructor](chainshape.md#constructor)
### Properties
* [TYPE](chainshape.md#static-type)
### Methods
* [getChildEdge](chainshape.md#getchildedge)
* [getVertex](chainshape.md#getvertex)
## Constructors
### constructor
\+ **new ChainShape**(`vertices`: [Vec2](vec2.md)[], `loop?`: boolean): *[ChainShape](chainshape.md)*
*Defined in [shape/index.d.ts:85](https://github.com/shakiba/planck.js/blob/038d425/lib/shape/index.d.ts#L85)*
**Parameters:**
Name | Type |
------ | ------ |
`vertices` | [Vec2](vec2.md)[] |
`loop?` | boolean |
**Returns:** *[ChainShape](chainshape.md)*
## Properties
### `Static` TYPE
▪ **TYPE**: *"chain"*
*Defined in [shape/index.d.ts:85](https://github.com/shakiba/planck.js/blob/038d425/lib/shape/index.d.ts#L85)*
## Methods
### getChildEdge
▸ **getChildEdge**(`edge`: [EdgeShape](edgeshape.md), `childIndex`: number): *void*
*Defined in [shape/index.d.ts:97](https://github.com/shakiba/planck.js/blob/038d425/lib/shape/index.d.ts#L97)*
**Parameters:**
Name | Type |
------ | ------ |
`edge` | [EdgeShape](edgeshape.md) |
`childIndex` | number |
**Returns:** *void*
___
### getVertex
▸ **getVertex**(`index`: number): *[Vec2](vec2.md)*
*Defined in [shape/index.d.ts:98](https://github.com/shakiba/planck.js/blob/038d425/lib/shape/index.d.ts#L98)*
**Parameters:**
Name | Type |
------ | ------ |
`index` | number |
**Returns:** *[Vec2](vec2.md)*

View File

@ -0,0 +1,131 @@
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [CircleShape](circleshape.md)
# Class: CircleShape
## Hierarchy
* any
↳ **CircleShape**
## Callable
▸ **CircleShape**(`position`: [Vec2](vec2.md), `radius?`: number): *[CircleShape](circleshape.md)*
*Defined in [shape/index.d.ts:23](https://github.com/shakiba/planck.js/blob/038d425/lib/shape/index.d.ts#L23)*
**Parameters:**
Name | Type |
------ | ------ |
`position` | [Vec2](vec2.md) |
`radius?` | number |
**Returns:** *[CircleShape](circleshape.md)*
▸ **CircleShape**(`radius?`: number): *[CircleShape](circleshape.md)*
*Defined in [shape/index.d.ts:24](https://github.com/shakiba/planck.js/blob/038d425/lib/shape/index.d.ts#L24)*
**Parameters:**
Name | Type |
------ | ------ |
`radius?` | number |
**Returns:** *[CircleShape](circleshape.md)*
## Index
### Constructors
* [constructor](circleshape.md#constructor)
### Properties
* [TYPE](circleshape.md#static-type)
### Methods
* [getCenter](circleshape.md#getcenter)
* [getVertex](circleshape.md#getvertex)
* [getVertexCount](circleshape.md#getvertexcount)
## Constructors
### constructor
\+ **new CircleShape**(`position`: [Vec2](vec2.md), `radius?`: number): *[CircleShape](circleshape.md)*
*Defined in [shape/index.d.ts:26](https://github.com/shakiba/planck.js/blob/038d425/lib/shape/index.d.ts#L26)*
**Parameters:**
Name | Type |
------ | ------ |
`position` | [Vec2](vec2.md) |
`radius?` | number |
**Returns:** *[CircleShape](circleshape.md)*
\+ **new CircleShape**(`radius?`: number): *[CircleShape](circleshape.md)*
*Defined in [shape/index.d.ts:28](https://github.com/shakiba/planck.js/blob/038d425/lib/shape/index.d.ts#L28)*
**Parameters:**
Name | Type |
------ | ------ |
`radius?` | number |
**Returns:** *[CircleShape](circleshape.md)*
## Properties
### `Static` TYPE
▪ **TYPE**: *"circle"*
*Defined in [shape/index.d.ts:26](https://github.com/shakiba/planck.js/blob/038d425/lib/shape/index.d.ts#L26)*
## Methods
### getCenter
▸ **getCenter**(): *[Vec2](vec2.md)*
*Defined in [shape/index.d.ts:34](https://github.com/shakiba/planck.js/blob/038d425/lib/shape/index.d.ts#L34)*
**Returns:** *[Vec2](vec2.md)*
___
### getVertex
▸ **getVertex**(`index?`: number): *[Vec2](vec2.md)*
*Defined in [shape/index.d.ts:35](https://github.com/shakiba/planck.js/blob/038d425/lib/shape/index.d.ts#L35)*
**Parameters:**
Name | Type |
------ | ------ |
`index?` | number |
**Returns:** *[Vec2](vec2.md)*
___
### getVertexCount
▸ **getVertexCount**(`index?`: number): *1*
*Defined in [shape/index.d.ts:36](https://github.com/shakiba/planck.js/blob/038d425/lib/shape/index.d.ts#L36)*
**Parameters:**
Name | Type |
------ | ------ |
`index?` | number |
**Returns:** *1*

463
docs/api/classes/contact.md Normal file
View File

@ -0,0 +1,463 @@
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [Contact](contact.md)
# Class: Contact
## Hierarchy
* **Contact**
## Index
### Constructors
* [constructor](contact.md#constructor)
### Methods
* [_solvePositionConstraint](contact.md#_solvepositionconstraint)
* [evaluate](contact.md#evaluate)
* [flagForFiltering](contact.md#flagforfiltering)
* [getChildIndexA](contact.md#getchildindexa)
* [getChildIndexB](contact.md#getchildindexb)
* [getFixtureA](contact.md#getfixturea)
* [getFixtureB](contact.md#getfixtureb)
* [getFriction](contact.md#getfriction)
* [getManifold](contact.md#getmanifold)
* [getNext](contact.md#getnext)
* [getRestitution](contact.md#getrestitution)
* [getTangentSpeed](contact.md#gettangentspeed)
* [getWorldManifold](contact.md#getworldmanifold)
* [initConstraint](contact.md#initconstraint)
* [initVelocityConstraint](contact.md#initvelocityconstraint)
* [isEnabled](contact.md#isenabled)
* [isTouching](contact.md#istouching)
* [resetFriction](contact.md#resetfriction)
* [resetRestitution](contact.md#resetrestitution)
* [setEnabled](contact.md#setenabled)
* [setFriction](contact.md#setfriction)
* [setRestitution](contact.md#setrestitution)
* [setTangentSpeed](contact.md#settangentspeed)
* [solvePositionConstraint](contact.md#solvepositionconstraint)
* [solvePositionConstraintTOI](contact.md#solvepositionconstrainttoi)
* [solveVelocityConstraint](contact.md#solvevelocityconstraint)
* [storeConstraintImpulses](contact.md#storeconstraintimpulses)
* [update](contact.md#update)
* [warmStartConstraint](contact.md#warmstartconstraint)
## Constructors
### constructor
\+ **new Contact**(`fA`: [Fixture](fixture.md), `indexA`: number, `fB`: [Fixture](fixture.md), `indexB`: number, `evaluateFcn`: [EvaluateFunction](../globals.md#evaluatefunction)): *[Contact](contact.md)*
*Defined in [index.d.ts:331](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L331)*
**Parameters:**
Name | Type |
------ | ------ |
`fA` | [Fixture](fixture.md) |
`indexA` | number |
`fB` | [Fixture](fixture.md) |
`indexB` | number |
`evaluateFcn` | [EvaluateFunction](../globals.md#evaluatefunction) |
**Returns:** *[Contact](contact.md)*
## Methods
### _solvePositionConstraint
▸ **_solvePositionConstraint**(`step`: any, `toi`: boolean, `toiA?`: [Body](body.md) | null, `toiB?`: [Body](body.md) | null): *number*
*Defined in [index.d.ts:415](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L415)*
**Parameters:**
Name | Type |
------ | ------ |
`step` | any |
`toi` | boolean |
`toiA?` | [Body](body.md) &#124; null |
`toiB?` | [Body](body.md) &#124; null |
**Returns:** *number*
___
### evaluate
▸ **evaluate**(`manifold`: [Manifold](../interfaces/manifold.md), `xfA`: [Transform](transform.md), `xfB`: [Transform](transform.md)): *void*
*Defined in [index.d.ts:411](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L411)*
**Parameters:**
Name | Type |
------ | ------ |
`manifold` | [Manifold](../interfaces/manifold.md) |
`xfA` | [Transform](transform.md) |
`xfB` | [Transform](transform.md) |
**Returns:** *void*
___
### flagForFiltering
▸ **flagForFiltering**(): *void*
*Defined in [index.d.ts:402](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L402)*
**Returns:** *void*
___
### getChildIndexA
▸ **getChildIndexA**(): *number*
*Defined in [index.d.ts:400](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L400)*
**Returns:** *number*
___
### getChildIndexB
▸ **getChildIndexB**(): *number*
*Defined in [index.d.ts:401](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L401)*
**Returns:** *number*
___
### getFixtureA
▸ **getFixtureA**(): *[Fixture](fixture.md)*
*Defined in [index.d.ts:398](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L398)*
**Returns:** *[Fixture](fixture.md)*
___
### getFixtureB
▸ **getFixtureB**(): *[Fixture](fixture.md)*
*Defined in [index.d.ts:399](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L399)*
**Returns:** *[Fixture](fixture.md)*
___
### getFriction
▸ **getFriction**(): *number*
*Defined in [index.d.ts:404](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L404)*
**Returns:** *number*
___
### getManifold
▸ **getManifold**(): *[Manifold](../interfaces/manifold.md)*
*Defined in [index.d.ts:392](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L392)*
**Returns:** *[Manifold](../interfaces/manifold.md)*
___
### getNext
▸ **getNext**(): *[Contact](contact.md) | null*
*Defined in [index.d.ts:397](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L397)*
**Returns:** *[Contact](contact.md) | null*
___
### getRestitution
▸ **getRestitution**(): *number*
*Defined in [index.d.ts:407](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L407)*
**Returns:** *number*
___
### getTangentSpeed
▸ **getTangentSpeed**(): *number*
*Defined in [index.d.ts:410](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L410)*
**Returns:** *number*
___
### getWorldManifold
▸ **getWorldManifold**(`worldManifold`: [WorldManifold](../interfaces/worldmanifold.md) | null | undefined): *[WorldManifold](../interfaces/worldmanifold.md) | undefined*
*Defined in [index.d.ts:393](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L393)*
**Parameters:**
Name | Type |
------ | ------ |
`worldManifold` | [WorldManifold](../interfaces/worldmanifold.md) &#124; null &#124; undefined |
**Returns:** *[WorldManifold](../interfaces/worldmanifold.md) | undefined*
___
### initConstraint
▸ **initConstraint**(`step`: object): *void*
*Defined in [index.d.ts:391](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L391)*
**Parameters:**
▪ **step**: *object*
Name | Type |
------ | ------ |
`dtRatio` | number |
`warmStarting` | boolean |
**Returns:** *void*
___
### initVelocityConstraint
▸ **initVelocityConstraint**(`step`: object): *void*
*Defined in [index.d.ts:416](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L416)*
**Parameters:**
▪ **step**: *object*
Name | Type |
------ | ------ |
`blockSolve` | boolean |
**Returns:** *void*
___
### isEnabled
▸ **isEnabled**(): *boolean*
*Defined in [index.d.ts:395](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L395)*
**Returns:** *boolean*
___
### isTouching
▸ **isTouching**(): *boolean*
*Defined in [index.d.ts:396](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L396)*
**Returns:** *boolean*
___
### resetFriction
▸ **resetFriction**(): *void*
*Defined in [index.d.ts:405](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L405)*
**Returns:** *void*
___
### resetRestitution
▸ **resetRestitution**(): *void*
*Defined in [index.d.ts:408](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L408)*
**Returns:** *void*
___
### setEnabled
▸ **setEnabled**(`flag`: boolean): *void*
*Defined in [index.d.ts:394](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L394)*
**Parameters:**
Name | Type |
------ | ------ |
`flag` | boolean |
**Returns:** *void*
___
### setFriction
▸ **setFriction**(`friction`: number): *void*
*Defined in [index.d.ts:403](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L403)*
**Parameters:**
Name | Type |
------ | ------ |
`friction` | number |
**Returns:** *void*
___
### setRestitution
▸ **setRestitution**(`restitution`: number): *void*
*Defined in [index.d.ts:406](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L406)*
**Parameters:**
Name | Type |
------ | ------ |
`restitution` | number |
**Returns:** *void*
___
### setTangentSpeed
▸ **setTangentSpeed**(`speed`: number): *void*
*Defined in [index.d.ts:409](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L409)*
**Parameters:**
Name | Type |
------ | ------ |
`speed` | number |
**Returns:** *void*
___
### solvePositionConstraint
▸ **solvePositionConstraint**(`step`: any): *number*
*Defined in [index.d.ts:413](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L413)*
**Parameters:**
Name | Type |
------ | ------ |
`step` | any |
**Returns:** *number*
___
### solvePositionConstraintTOI
▸ **solvePositionConstraintTOI**(`step`: any, `toiA?`: [Body](body.md) | null, `toiB?`: [Body](body.md) | null): *number*
*Defined in [index.d.ts:414](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L414)*
**Parameters:**
Name | Type |
------ | ------ |
`step` | any |
`toiA?` | [Body](body.md) &#124; null |
`toiB?` | [Body](body.md) &#124; null |
**Returns:** *number*
___
### solveVelocityConstraint
▸ **solveVelocityConstraint**(`step`: object): *void*
*Defined in [index.d.ts:419](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L419)*
**Parameters:**
▪ **step**: *object*
Name | Type |
------ | ------ |
`blockSolve` | boolean |
**Returns:** *void*
___
### storeConstraintImpulses
▸ **storeConstraintImpulses**(`step?`: any): *void*
*Defined in [index.d.ts:418](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L418)*
**Parameters:**
Name | Type |
------ | ------ |
`step?` | any |
**Returns:** *void*
___
### update
▸ **update**(`listener?`: object): *void*
*Defined in [index.d.ts:412](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L412)*
**Parameters:**
▪`Optional` **listener**: *object*
Name | Type |
------ | ------ |
`beginContact` | |
`endContact` | |
`oreSolve` | |
**Returns:** *void*
___
### warmStartConstraint
▸ **warmStartConstraint**(`step?`: any): *void*
*Defined in [index.d.ts:417](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L417)*
**Parameters:**
Name | Type |
------ | ------ |
`step?` | any |
**Returns:** *void*

View File

@ -0,0 +1,48 @@
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [ContactEdge](contactedge.md)
# Class: ContactEdge
## Hierarchy
* **ContactEdge**
## Index
### Properties
* [contact](contactedge.md#contact)
* [next](contactedge.md#next)
* [other](contactedge.md#other)
* [prev](contactedge.md#prev)
## Properties
### contact
• **contact**: *[Contact](contact.md)*
*Defined in [index.d.ts:295](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L295)*
___
### next
• **next**: *[ContactEdge](contactedge.md) | undefined*
*Defined in [index.d.ts:297](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L297)*
___
### other
• **other**: *[Body](body.md) | undefined*
*Defined in [index.d.ts:298](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L298)*
___
### prev
• **prev**: *[ContactEdge](contactedge.md) | undefined*
*Defined in [index.d.ts:296](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L296)*

View File

@ -0,0 +1,7 @@
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [ContactImpulse](contactimpulse.md)
# Class: ContactImpulse
## Hierarchy
* **ContactImpulse**

View File

@ -0,0 +1,198 @@
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [DistanceJoint](distancejoint.md)
# Class: DistanceJoint
## Hierarchy
* any
↳ **DistanceJoint**
## Callable
▸ **DistanceJoint**(`def`: [DistanceJointDef](../interfaces/distancejointdef.md)): *[DistanceJoint](distancejoint.md)*
*Defined in [joint/index.d.ts:60](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L60)*
**Parameters:**
Name | Type |
------ | ------ |
`def` | [DistanceJointDef](../interfaces/distancejointdef.md) |
**Returns:** *[DistanceJoint](distancejoint.md)*
▸ **DistanceJoint**(`def`: [DistanceJointOpt](../interfaces/distancejointopt.md), `bodyA`: [Body](body.md), `bodyB`: [Body](body.md), `anchorA`: [Vec2](vec2.md), `anchorB`: [Vec2](vec2.md)): *[DistanceJoint](distancejoint.md)*
*Defined in [joint/index.d.ts:61](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L61)*
**Parameters:**
Name | Type |
------ | ------ |
`def` | [DistanceJointOpt](../interfaces/distancejointopt.md) |
`bodyA` | [Body](body.md) |
`bodyB` | [Body](body.md) |
`anchorA` | [Vec2](vec2.md) |
`anchorB` | [Vec2](vec2.md) |
**Returns:** *[DistanceJoint](distancejoint.md)*
## Index
### Constructors
* [constructor](distancejoint.md#constructor)
### Properties
* [TYPE](distancejoint.md#static-type)
### Methods
* [getDampingRatio](distancejoint.md#getdampingratio)
* [getFrequency](distancejoint.md#getfrequency)
* [getLength](distancejoint.md#getlength)
* [getLocalAnchorA](distancejoint.md#getlocalanchora)
* [getLocalAnchorB](distancejoint.md#getlocalanchorb)
* [setDampingRatio](distancejoint.md#setdampingratio)
* [setFrequency](distancejoint.md#setfrequency)
* [setLength](distancejoint.md#setlength)
## Constructors
### constructor
\+ **new DistanceJoint**(`def`: [DistanceJointDef](../interfaces/distancejointdef.md)): *[DistanceJoint](distancejoint.md)*
*Defined in [joint/index.d.ts:63](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L63)*
**Parameters:**
Name | Type |
------ | ------ |
`def` | [DistanceJointDef](../interfaces/distancejointdef.md) |
**Returns:** *[DistanceJoint](distancejoint.md)*
\+ **new DistanceJoint**(`def`: [DistanceJointOpt](../interfaces/distancejointopt.md), `bodyA`: [Body](body.md), `bodyB`: [Body](body.md), `anchorA`: [Vec2](vec2.md), `anchorB`: [Vec2](vec2.md)): *[DistanceJoint](distancejoint.md)*
*Defined in [joint/index.d.ts:65](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L65)*
**Parameters:**
Name | Type |
------ | ------ |
`def` | [DistanceJointOpt](../interfaces/distancejointopt.md) |
`bodyA` | [Body](body.md) |
`bodyB` | [Body](body.md) |
`anchorA` | [Vec2](vec2.md) |
`anchorB` | [Vec2](vec2.md) |
**Returns:** *[DistanceJoint](distancejoint.md)*
## Properties
### `Static` TYPE
▪ **TYPE**: *"distance-joint"*
*Defined in [joint/index.d.ts:63](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L63)*
## Methods
### getDampingRatio
▸ **getDampingRatio**(): *number*
*Defined in [joint/index.d.ts:97](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L97)*
**Returns:** *number*
___
### getFrequency
▸ **getFrequency**(): *number*
*Defined in [joint/index.d.ts:95](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L95)*
**Returns:** *number*
___
### getLength
▸ **getLength**(): *number*
*Defined in [joint/index.d.ts:93](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L93)*
**Returns:** *number*
___
### getLocalAnchorA
▸ **getLocalAnchorA**(): *[Vec2](vec2.md)*
*Defined in [joint/index.d.ts:90](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L90)*
**Returns:** *[Vec2](vec2.md)*
___
### getLocalAnchorB
▸ **getLocalAnchorB**(): *[Vec2](vec2.md)*
*Defined in [joint/index.d.ts:91](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L91)*
**Returns:** *[Vec2](vec2.md)*
___
### setDampingRatio
▸ **setDampingRatio**(`ratio`: number): *void*
*Defined in [joint/index.d.ts:96](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L96)*
**Parameters:**
Name | Type |
------ | ------ |
`ratio` | number |
**Returns:** *void*
___
### setFrequency
▸ **setFrequency**(`hz`: number): *void*
*Defined in [joint/index.d.ts:94](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L94)*
**Parameters:**
Name | Type |
------ | ------ |
`hz` | number |
**Returns:** *void*
___
### setLength
▸ **setLength**(`length`: number): *void*
*Defined in [joint/index.d.ts:92](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L92)*
**Parameters:**
Name | Type |
------ | ------ |
`length` | number |
**Returns:** *void*

View File

@ -0,0 +1,153 @@
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [DistanceProxy](distanceproxy.md)
# Class: DistanceProxy
## Hierarchy
* **DistanceProxy**
## Index
### Constructors
* [constructor](distanceproxy.md#constructor)
### Properties
* [m_buffer](distanceproxy.md#m_buffer)
* [m_count](distanceproxy.md#m_count)
* [m_radius](distanceproxy.md#m_radius)
* [m_vertices](distanceproxy.md#m_vertices)
### Methods
* [getSupport](distanceproxy.md#getsupport)
* [getSupportVertex](distanceproxy.md#getsupportvertex)
* [getVertex](distanceproxy.md#getvertex)
* [getVertexCount](distanceproxy.md#getvertexcount)
* [set](distanceproxy.md#set)
## Constructors
### constructor
\+ **new DistanceProxy**(): *[DistanceProxy](distanceproxy.md)*
*Defined in [collision/index.d.ts:19](https://github.com/shakiba/planck.js/blob/038d425/lib/collision/index.d.ts#L19)*
**Returns:** *[DistanceProxy](distanceproxy.md)*
## Properties
### m_buffer
• **m_buffer**: *[Vec2](vec2.md)[]*
*Defined in [collision/index.d.ts:22](https://github.com/shakiba/planck.js/blob/038d425/lib/collision/index.d.ts#L22)*
internal
___
### m_count
• **m_count**: *number*
*Defined in [collision/index.d.ts:24](https://github.com/shakiba/planck.js/blob/038d425/lib/collision/index.d.ts#L24)*
internal
___
### m_radius
• **m_radius**: *number*
*Defined in [collision/index.d.ts:25](https://github.com/shakiba/planck.js/blob/038d425/lib/collision/index.d.ts#L25)*
internal
___
### m_vertices
• **m_vertices**: *[Vec2](vec2.md)[]*
*Defined in [collision/index.d.ts:23](https://github.com/shakiba/planck.js/blob/038d425/lib/collision/index.d.ts#L23)*
internal
## Methods
### getSupport
▸ **getSupport**(`d`: [Vec2](vec2.md)): *number*
*Defined in [collision/index.d.ts:29](https://github.com/shakiba/planck.js/blob/038d425/lib/collision/index.d.ts#L29)*
**Parameters:**
Name | Type |
------ | ------ |
`d` | [Vec2](vec2.md) |
**Returns:** *number*
___
### getSupportVertex
▸ **getSupportVertex**(`d`: [Vec2](vec2.md)): *[Vec2](vec2.md)*
*Defined in [collision/index.d.ts:30](https://github.com/shakiba/planck.js/blob/038d425/lib/collision/index.d.ts#L30)*
**Parameters:**
Name | Type |
------ | ------ |
`d` | [Vec2](vec2.md) |
**Returns:** *[Vec2](vec2.md)*
___
### getVertex
▸ **getVertex**(`index`: number): *[Vec2](vec2.md)*
*Defined in [collision/index.d.ts:28](https://github.com/shakiba/planck.js/blob/038d425/lib/collision/index.d.ts#L28)*
**Parameters:**
Name | Type |
------ | ------ |
`index` | number |
**Returns:** *[Vec2](vec2.md)*
___
### getVertexCount
▸ **getVertexCount**(): *number*
*Defined in [collision/index.d.ts:27](https://github.com/shakiba/planck.js/blob/038d425/lib/collision/index.d.ts#L27)*
**Returns:** *number*
___
### set
▸ **set**(`shape`: [Shape](shape.md), `index`: number): *void*
*Defined in [collision/index.d.ts:31](https://github.com/shakiba/planck.js/blob/038d425/lib/collision/index.d.ts#L31)*
**Parameters:**
Name | Type |
------ | ------ |
`shape` | [Shape](shape.md) |
`index` | number |
**Returns:** *void*

View File

@ -0,0 +1,353 @@
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [DynamicTree](dynamictree.md)
# Class: DynamicTree
## Hierarchy
* **DynamicTree**
## Index
### Methods
* [allocateNode](dynamictree.md#allocatenode)
* [balance](dynamictree.md#balance)
* [computeHeight](dynamictree.md#computeheight)
* [createProxy](dynamictree.md#createproxy)
* [destroyProxy](dynamictree.md#destroyproxy)
* [freeNode](dynamictree.md#freenode)
* [getAreaRatio](dynamictree.md#getarearatio)
* [getFatAABB](dynamictree.md#getfataabb)
* [getHeight](dynamictree.md#getheight)
* [getMaxBalance](dynamictree.md#getmaxbalance)
* [getUserData](dynamictree.md#getuserdata)
* [insertLeaf](dynamictree.md#insertleaf)
* [moveProxy](dynamictree.md#moveproxy)
* [query](dynamictree.md#query)
* [rayCast](dynamictree.md#raycast)
* [rebuildBottomUp](dynamictree.md#rebuildbottomup)
* [removeLeaf](dynamictree.md#removeleaf)
* [shiftOrigin](dynamictree.md#shiftorigin)
* [validate](dynamictree.md#validate)
* [validateMetrics](dynamictree.md#validatemetrics)
* [validateStructure](dynamictree.md#validatestructure)
## Methods
### allocateNode
▸ **allocateNode**(): *[TreeNode](treenode.md)*
*Defined in [collision/index.d.ts:74](https://github.com/shakiba/planck.js/blob/038d425/lib/collision/index.d.ts#L74)*
**Returns:** *[TreeNode](treenode.md)*
___
### balance
▸ **balance**(`iA`: [TreeNode](treenode.md)): *[TreeNode](treenode.md)*
*Defined in [collision/index.d.ts:81](https://github.com/shakiba/planck.js/blob/038d425/lib/collision/index.d.ts#L81)*
**Parameters:**
Name | Type |
------ | ------ |
`iA` | [TreeNode](treenode.md) |
**Returns:** *[TreeNode](treenode.md)*
___
### computeHeight
▸ **computeHeight**(`node?`: [TreeNode](treenode.md)): *number*
*Defined in [collision/index.d.ts:84](https://github.com/shakiba/planck.js/blob/038d425/lib/collision/index.d.ts#L84)*
**Parameters:**
Name | Type |
------ | ------ |
`node?` | [TreeNode](treenode.md) |
**Returns:** *number*
___
### createProxy
▸ **createProxy**(`aabb`: [AABB](aabb.md), `userData`: any): *string*
*Defined in [collision/index.d.ts:76](https://github.com/shakiba/planck.js/blob/038d425/lib/collision/index.d.ts#L76)*
**Parameters:**
Name | Type |
------ | ------ |
`aabb` | [AABB](aabb.md) |
`userData` | any |
**Returns:** *string*
___
### destroyProxy
▸ **destroyProxy**(`id`: number): *void*
*Defined in [collision/index.d.ts:77](https://github.com/shakiba/planck.js/blob/038d425/lib/collision/index.d.ts#L77)*
**Parameters:**
Name | Type |
------ | ------ |
`id` | number |
**Returns:** *void*
___
### freeNode
▸ **freeNode**(`node`: [TreeNode](treenode.md)): *void*
*Defined in [collision/index.d.ts:75](https://github.com/shakiba/planck.js/blob/038d425/lib/collision/index.d.ts#L75)*
**Parameters:**
Name | Type |
------ | ------ |
`node` | [TreeNode](treenode.md) |
**Returns:** *void*
___
### getAreaRatio
▸ **getAreaRatio**(): *number*
*Defined in [collision/index.d.ts:83](https://github.com/shakiba/planck.js/blob/038d425/lib/collision/index.d.ts#L83)*
**Returns:** *number*
___
### getFatAABB
▸ **getFatAABB**(`id`: number): *[AABB](aabb.md)*
*Defined in [collision/index.d.ts:73](https://github.com/shakiba/planck.js/blob/038d425/lib/collision/index.d.ts#L73)*
**Parameters:**
Name | Type |
------ | ------ |
`id` | number |
**Returns:** *[AABB](aabb.md)*
___
### getHeight
▸ **getHeight**(): *number*
*Defined in [collision/index.d.ts:82](https://github.com/shakiba/planck.js/blob/038d425/lib/collision/index.d.ts#L82)*
**Returns:** *number*
___
### getMaxBalance
▸ **getMaxBalance**(): *number*
*Defined in [collision/index.d.ts:88](https://github.com/shakiba/planck.js/blob/038d425/lib/collision/index.d.ts#L88)*
**Returns:** *number*
___
### getUserData
▸ **getUserData**(`id`: number): *unknown*
*Defined in [collision/index.d.ts:72](https://github.com/shakiba/planck.js/blob/038d425/lib/collision/index.d.ts#L72)*
**Parameters:**
Name | Type |
------ | ------ |
`id` | number |
**Returns:** *unknown*
___
### insertLeaf
▸ **insertLeaf**(`leaf`: [TreeNode](treenode.md)): *void*
*Defined in [collision/index.d.ts:79](https://github.com/shakiba/planck.js/blob/038d425/lib/collision/index.d.ts#L79)*
**Parameters:**
Name | Type |
------ | ------ |
`leaf` | [TreeNode](treenode.md) |
**Returns:** *void*
___
### moveProxy
▸ **moveProxy**(`id`: number, `aabb`: [AABB](aabb.md), `d`: [Vec2](vec2.md)): *boolean*
*Defined in [collision/index.d.ts:78](https://github.com/shakiba/planck.js/blob/038d425/lib/collision/index.d.ts#L78)*
**Parameters:**
Name | Type |
------ | ------ |
`id` | number |
`aabb` | [AABB](aabb.md) |
`d` | [Vec2](vec2.md) |
**Returns:** *boolean*
___
### query
▸ **query**(`aabb`: [AABB](aabb.md), `queryCallback`: function): *void*
*Defined in [collision/index.d.ts:91](https://github.com/shakiba/planck.js/blob/038d425/lib/collision/index.d.ts#L91)*
**Parameters:**
▪ **aabb**: *[AABB](aabb.md)*
▪ **queryCallback**: *function*
▸ (`id`: number): *boolean*
**Parameters:**
Name | Type |
------ | ------ |
`id` | number |
**Returns:** *void*
___
### rayCast
▸ **rayCast**(`input`: [RayCastInput](../interfaces/raycastinput.md), `rayCastCallback`: function): *void*
*Defined in [collision/index.d.ts:92](https://github.com/shakiba/planck.js/blob/038d425/lib/collision/index.d.ts#L92)*
**Parameters:**
▪ **input**: *[RayCastInput](../interfaces/raycastinput.md)*
▪ **rayCastCallback**: *function*
▸ (`subInput`: [RayCastInput](../interfaces/raycastinput.md), `id`: number): *number*
**Parameters:**
Name | Type |
------ | ------ |
`subInput` | [RayCastInput](../interfaces/raycastinput.md) |
`id` | number |
**Returns:** *void*
___
### rebuildBottomUp
▸ **rebuildBottomUp**(): *void*
*Defined in [collision/index.d.ts:89](https://github.com/shakiba/planck.js/blob/038d425/lib/collision/index.d.ts#L89)*
**Returns:** *void*
___
### removeLeaf
▸ **removeLeaf**(`leaf`: [TreeNode](treenode.md)): *void*
*Defined in [collision/index.d.ts:80](https://github.com/shakiba/planck.js/blob/038d425/lib/collision/index.d.ts#L80)*
**Parameters:**
Name | Type |
------ | ------ |
`leaf` | [TreeNode](treenode.md) |
**Returns:** *void*
___
### shiftOrigin
▸ **shiftOrigin**(`newOrigin`: [Vec2](vec2.md)): *void*
*Defined in [collision/index.d.ts:90](https://github.com/shakiba/planck.js/blob/038d425/lib/collision/index.d.ts#L90)*
**Parameters:**
Name | Type |
------ | ------ |
`newOrigin` | [Vec2](vec2.md) |
**Returns:** *void*
___
### validate
▸ **validate**(): *void*
*Defined in [collision/index.d.ts:87](https://github.com/shakiba/planck.js/blob/038d425/lib/collision/index.d.ts#L87)*
**Returns:** *void*
___
### validateMetrics
▸ **validateMetrics**(`node`: [TreeNode](treenode.md)): *void*
*Defined in [collision/index.d.ts:86](https://github.com/shakiba/planck.js/blob/038d425/lib/collision/index.d.ts#L86)*
**Parameters:**
Name | Type |
------ | ------ |
`node` | [TreeNode](treenode.md) |
**Returns:** *void*
___
### validateStructure
▸ **validateStructure**(`node`: [TreeNode](treenode.md)): *void*
*Defined in [collision/index.d.ts:85](https://github.com/shakiba/planck.js/blob/038d425/lib/collision/index.d.ts#L85)*
**Parameters:**
Name | Type |
------ | ------ |
`node` | [TreeNode](treenode.md) |
**Returns:** *void*

View File

@ -0,0 +1,96 @@
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [EdgeShape](edgeshape.md)
# Class: EdgeShape
## Hierarchy
* any
↳ **EdgeShape**
## Callable
▸ **EdgeShape**(`v1`: [Vec2](vec2.md), `v2`: [Vec2](vec2.md)): *[EdgeShape](edgeshape.md)*
*Defined in [shape/index.d.ts:39](https://github.com/shakiba/planck.js/blob/038d425/lib/shape/index.d.ts#L39)*
**Parameters:**
Name | Type |
------ | ------ |
`v1` | [Vec2](vec2.md) |
`v2` | [Vec2](vec2.md) |
**Returns:** *[EdgeShape](edgeshape.md)*
## Index
### Constructors
* [constructor](edgeshape.md#constructor)
### Properties
* [TYPE](edgeshape.md#static-type)
### Methods
* [setNext](edgeshape.md#setnext)
* [setPrev](edgeshape.md#setprev)
## Constructors
### constructor
\+ **new EdgeShape**(`v1`: [Vec2](vec2.md), `v2`: [Vec2](vec2.md)): *[EdgeShape](edgeshape.md)*
*Defined in [shape/index.d.ts:41](https://github.com/shakiba/planck.js/blob/038d425/lib/shape/index.d.ts#L41)*
**Parameters:**
Name | Type |
------ | ------ |
`v1` | [Vec2](vec2.md) |
`v2` | [Vec2](vec2.md) |
**Returns:** *[EdgeShape](edgeshape.md)*
## Properties
### `Static` TYPE
▪ **TYPE**: *"edge"*
*Defined in [shape/index.d.ts:41](https://github.com/shakiba/planck.js/blob/038d425/lib/shape/index.d.ts#L41)*
## Methods
### setNext
▸ **setNext**(`v3?`: [Vec2](vec2.md)): *[EdgeShape](edgeshape.md)*
*Defined in [shape/index.d.ts:53](https://github.com/shakiba/planck.js/blob/038d425/lib/shape/index.d.ts#L53)*
**Parameters:**
Name | Type |
------ | ------ |
`v3?` | [Vec2](vec2.md) |
**Returns:** *[EdgeShape](edgeshape.md)*
___
### setPrev
▸ **setPrev**(`v0?`: [Vec2](vec2.md)): *[EdgeShape](edgeshape.md)*
*Defined in [shape/index.d.ts:54](https://github.com/shakiba/planck.js/blob/038d425/lib/shape/index.d.ts#L54)*
**Parameters:**
Name | Type |
------ | ------ |
`v0?` | [Vec2](vec2.md) |
**Returns:** *[EdgeShape](edgeshape.md)*

451
docs/api/classes/fixture.md Normal file
View File

@ -0,0 +1,451 @@
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [Fixture](fixture.md)
# Class: Fixture
## Hierarchy
* **Fixture**
## Index
### Constructors
* [constructor](fixture.md#constructor)
### Methods
* [createProxies](fixture.md#createproxies)
* [destroyProxies](fixture.md#destroyproxies)
* [getAABB](fixture.md#getaabb)
* [getBody](fixture.md#getbody)
* [getDensity](fixture.md#getdensity)
* [getFilterCategoryBits](fixture.md#getfiltercategorybits)
* [getFilterGroupIndex](fixture.md#getfiltergroupindex)
* [getFilterMaskBits](fixture.md#getfiltermaskbits)
* [getFriction](fixture.md#getfriction)
* [getMassData](fixture.md#getmassdata)
* [getNext](fixture.md#getnext)
* [getRestitution](fixture.md#getrestitution)
* [getShape](fixture.md#getshape)
* [getType](fixture.md#gettype)
* [getUserData](fixture.md#getuserdata)
* [isSensor](fixture.md#issensor)
* [rayCast](fixture.md#raycast)
* [refilter](fixture.md#refilter)
* [setDensity](fixture.md#setdensity)
* [setFilterData](fixture.md#setfilterdata)
* [setFriction](fixture.md#setfriction)
* [setRestitution](fixture.md#setrestitution)
* [setSensor](fixture.md#setsensor)
* [setUserData](fixture.md#setuserdata)
* [shouldCollide](fixture.md#shouldcollide)
* [synchronize](fixture.md#synchronize)
* [testPoint](fixture.md#testpoint)
## Constructors
### constructor
\+ **new Fixture**(`body`: [Body](body.md), `def`: [FixtureDef](../interfaces/fixturedef.md)): *[Fixture](fixture.md)*
*Defined in [index.d.ts:85](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L85)*
**Parameters:**
Name | Type |
------ | ------ |
`body` | [Body](body.md) |
`def` | [FixtureDef](../interfaces/fixturedef.md) |
**Returns:** *[Fixture](fixture.md)*
\+ **new Fixture**(`body`: [Body](body.md), `shape`: [Shape](shape.md), `def?`: [FixtureOpt](../interfaces/fixtureopt.md)): *[Fixture](fixture.md)*
*Defined in [index.d.ts:86](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L86)*
**Parameters:**
Name | Type |
------ | ------ |
`body` | [Body](body.md) |
`shape` | [Shape](shape.md) |
`def?` | [FixtureOpt](../interfaces/fixtureopt.md) |
**Returns:** *[Fixture](fixture.md)*
\+ **new Fixture**(`body`: [Body](body.md), `shape`: [Shape](shape.md), `density?`: number): *[Fixture](fixture.md)*
*Defined in [index.d.ts:87](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L87)*
**Parameters:**
Name | Type |
------ | ------ |
`body` | [Body](body.md) |
`shape` | [Shape](shape.md) |
`density?` | number |
**Returns:** *[Fixture](fixture.md)*
## Methods
### createProxies
▸ **createProxies**(`broadPhase`: [BroadPhase](broadphase.md), `xf`: [Transform](transform.md)): *void*
*Defined in [index.d.ts:122](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L122)*
**Parameters:**
Name | Type |
------ | ------ |
`broadPhase` | [BroadPhase](broadphase.md) |
`xf` | [Transform](transform.md) |
**Returns:** *void*
___
### destroyProxies
▸ **destroyProxies**(`broadPhase`: [BroadPhase](broadphase.md)): *void*
*Defined in [index.d.ts:123](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L123)*
**Parameters:**
Name | Type |
------ | ------ |
`broadPhase` | [BroadPhase](broadphase.md) |
**Returns:** *void*
___
### getAABB
▸ **getAABB**(`childIndex`: number): *[AABB](aabb.md)*
*Defined in [index.d.ts:121](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L121)*
**Parameters:**
Name | Type |
------ | ------ |
`childIndex` | number |
**Returns:** *[AABB](aabb.md)*
___
### getBody
▸ **getBody**(): *[Body](body.md)*
*Defined in [index.d.ts:110](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L110)*
**Returns:** *[Body](body.md)*
___
### getDensity
▸ **getDensity**(): *number*
*Defined in [index.d.ts:112](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L112)*
**Returns:** *number*
___
### getFilterCategoryBits
▸ **getFilterCategoryBits**(): *number*
*Defined in [index.d.ts:127](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L127)*
**Returns:** *number*
___
### getFilterGroupIndex
▸ **getFilterGroupIndex**(): *number*
*Defined in [index.d.ts:126](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L126)*
**Returns:** *number*
___
### getFilterMaskBits
▸ **getFilterMaskBits**(): *number*
*Defined in [index.d.ts:128](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L128)*
**Returns:** *number*
___
### getFriction
▸ **getFriction**(): *number*
*Defined in [index.d.ts:114](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L114)*
**Returns:** *number*
___
### getMassData
▸ **getMassData**(`massData`: [MassData](../interfaces/massdata.md)): *void*
*Defined in [index.d.ts:120](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L120)*
**Parameters:**
Name | Type |
------ | ------ |
`massData` | [MassData](../interfaces/massdata.md) |
**Returns:** *void*
___
### getNext
▸ **getNext**(): *[Fixture](fixture.md) | null*
*Defined in [index.d.ts:111](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L111)*
**Returns:** *[Fixture](fixture.md) | null*
___
### getRestitution
▸ **getRestitution**(): *number*
*Defined in [index.d.ts:116](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L116)*
**Returns:** *number*
___
### getShape
▸ **getShape**(): *[Shape](shape.md)*
*Defined in [index.d.ts:105](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L105)*
**Returns:** *[Shape](shape.md)*
___
### getType
▸ **getType**(): *[ShapeType](../globals.md#shapetype)*
*Defined in [index.d.ts:104](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L104)*
**Returns:** *[ShapeType](../globals.md#shapetype)*
___
### getUserData
▸ **getUserData**(): *unknown*
*Defined in [index.d.ts:108](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L108)*
**Returns:** *unknown*
___
### isSensor
▸ **isSensor**(): *boolean*
*Defined in [index.d.ts:106](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L106)*
**Returns:** *boolean*
___
### rayCast
▸ **rayCast**(`output`: [RayCastOutput](../interfaces/raycastoutput.md), `input`: [RayCastInput](../interfaces/raycastinput.md), `childIndex`: number): *boolean*
*Defined in [index.d.ts:119](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L119)*
**Parameters:**
Name | Type |
------ | ------ |
`output` | [RayCastOutput](../interfaces/raycastoutput.md) |
`input` | [RayCastInput](../interfaces/raycastinput.md) |
`childIndex` | number |
**Returns:** *boolean*
___
### refilter
▸ **refilter**(): *void*
*Defined in [index.d.ts:129](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L129)*
**Returns:** *void*
___
### setDensity
▸ **setDensity**(`density`: number): *void*
*Defined in [index.d.ts:113](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L113)*
**Parameters:**
Name | Type |
------ | ------ |
`density` | number |
**Returns:** *void*
___
### setFilterData
▸ **setFilterData**(`filter`: object): *void*
*Defined in [index.d.ts:125](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L125)*
**Parameters:**
▪ **filter**: *object*
Name | Type |
------ | ------ |
`categoryBits` | number |
`groupIndex` | number |
`maskBits` | number |
**Returns:** *void*
___
### setFriction
▸ **setFriction**(`friction`: number): *void*
*Defined in [index.d.ts:115](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L115)*
**Parameters:**
Name | Type |
------ | ------ |
`friction` | number |
**Returns:** *void*
___
### setRestitution
▸ **setRestitution**(`restitution`: number): *void*
*Defined in [index.d.ts:117](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L117)*
**Parameters:**
Name | Type |
------ | ------ |
`restitution` | number |
**Returns:** *void*
___
### setSensor
▸ **setSensor**(`sensor`: boolean): *void*
*Defined in [index.d.ts:107](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L107)*
**Parameters:**
Name | Type |
------ | ------ |
`sensor` | boolean |
**Returns:** *void*
___
### setUserData
▸ **setUserData**(`data`: any): *void*
*Defined in [index.d.ts:109](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L109)*
**Parameters:**
Name | Type |
------ | ------ |
`data` | any |
**Returns:** *void*
___
### shouldCollide
▸ **shouldCollide**(`that`: [Fixture](fixture.md)): *boolean*
*Defined in [index.d.ts:130](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L130)*
**Parameters:**
Name | Type |
------ | ------ |
`that` | [Fixture](fixture.md) |
**Returns:** *boolean*
___
### synchronize
▸ **synchronize**(`broadPhase`: [BroadPhase](broadphase.md), `xf1`: [Transform](transform.md), `xf2`: [Transform](transform.md)): *void*
*Defined in [index.d.ts:124](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L124)*
**Parameters:**
Name | Type |
------ | ------ |
`broadPhase` | [BroadPhase](broadphase.md) |
`xf1` | [Transform](transform.md) |
`xf2` | [Transform](transform.md) |
**Returns:** *void*
___
### testPoint
▸ **testPoint**(`p`: [Vec2](vec2.md)): *boolean*
*Defined in [index.d.ts:118](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L118)*
**Parameters:**
Name | Type |
------ | ------ |
`p` | [Vec2](vec2.md) |
**Returns:** *boolean*

View File

@ -0,0 +1,168 @@
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [FrictionJoint](frictionjoint.md)
# Class: FrictionJoint
## Hierarchy
* any
↳ **FrictionJoint**
## Callable
▸ **FrictionJoint**(`def`: [FrictionJointDef](../interfaces/frictionjointdef.md)): *[FrictionJoint](frictionjoint.md)*
*Defined in [joint/index.d.ts:111](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L111)*
**Parameters:**
Name | Type |
------ | ------ |
`def` | [FrictionJointDef](../interfaces/frictionjointdef.md) |
**Returns:** *[FrictionJoint](frictionjoint.md)*
▸ **FrictionJoint**(`def`: [FrictionJointOpt](../interfaces/frictionjointopt.md), `bodyA`: [Body](body.md), `bodyB`: [Body](body.md), `anchor`: [Vec2](vec2.md)): *[FrictionJoint](frictionjoint.md)*
*Defined in [joint/index.d.ts:112](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L112)*
**Parameters:**
Name | Type |
------ | ------ |
`def` | [FrictionJointOpt](../interfaces/frictionjointopt.md) |
`bodyA` | [Body](body.md) |
`bodyB` | [Body](body.md) |
`anchor` | [Vec2](vec2.md) |
**Returns:** *[FrictionJoint](frictionjoint.md)*
## Index
### Constructors
* [constructor](frictionjoint.md#constructor)
### Properties
* [TYPE](frictionjoint.md#static-type)
### Methods
* [getLocalAnchorA](frictionjoint.md#getlocalanchora)
* [getLocalAnchorB](frictionjoint.md#getlocalanchorb)
* [getMaxForce](frictionjoint.md#getmaxforce)
* [getMaxTorque](frictionjoint.md#getmaxtorque)
* [setMaxForce](frictionjoint.md#setmaxforce)
* [setMaxTorque](frictionjoint.md#setmaxtorque)
## Constructors
### constructor
\+ **new FrictionJoint**(`def`: [FrictionJointDef](../interfaces/frictionjointdef.md)): *[FrictionJoint](frictionjoint.md)*
*Defined in [joint/index.d.ts:114](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L114)*
**Parameters:**
Name | Type |
------ | ------ |
`def` | [FrictionJointDef](../interfaces/frictionjointdef.md) |
**Returns:** *[FrictionJoint](frictionjoint.md)*
\+ **new FrictionJoint**(`def`: [FrictionJointOpt](../interfaces/frictionjointopt.md), `bodyA`: [Body](body.md), `bodyB`: [Body](body.md), `anchor`: [Vec2](vec2.md)): *[FrictionJoint](frictionjoint.md)*
*Defined in [joint/index.d.ts:115](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L115)*
**Parameters:**
Name | Type |
------ | ------ |
`def` | [FrictionJointOpt](../interfaces/frictionjointopt.md) |
`bodyA` | [Body](body.md) |
`bodyB` | [Body](body.md) |
`anchor` | [Vec2](vec2.md) |
**Returns:** *[FrictionJoint](frictionjoint.md)*
## Properties
### `Static` TYPE
▪ **TYPE**: *"friction-joint"*
*Defined in [joint/index.d.ts:114](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L114)*
## Methods
### getLocalAnchorA
▸ **getLocalAnchorA**(): *[Vec2](vec2.md)*
*Defined in [joint/index.d.ts:139](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L139)*
**Returns:** *[Vec2](vec2.md)*
___
### getLocalAnchorB
▸ **getLocalAnchorB**(): *[Vec2](vec2.md)*
*Defined in [joint/index.d.ts:140](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L140)*
**Returns:** *[Vec2](vec2.md)*
___
### getMaxForce
▸ **getMaxForce**(): *number*
*Defined in [joint/index.d.ts:142](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L142)*
**Returns:** *number*
___
### getMaxTorque
▸ **getMaxTorque**(): *number*
*Defined in [joint/index.d.ts:144](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L144)*
**Returns:** *number*
___
### setMaxForce
▸ **setMaxForce**(`force`: number): *void*
*Defined in [joint/index.d.ts:141](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L141)*
**Parameters:**
Name | Type |
------ | ------ |
`force` | number |
**Returns:** *void*
___
### setMaxTorque
▸ **setMaxTorque**(`torque`: number): *void*
*Defined in [joint/index.d.ts:143](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L143)*
**Parameters:**
Name | Type |
------ | ------ |
`torque` | number |
**Returns:** *void*

View File

@ -0,0 +1,144 @@
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [GearJoint](gearjoint.md)
# Class: GearJoint
## Hierarchy
* any
↳ **GearJoint**
## Callable
▸ **GearJoint**(`def`: [GearJointDef](../interfaces/gearjointdef.md)): *[GearJoint](gearjoint.md)*
*Defined in [joint/index.d.ts:157](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L157)*
**Parameters:**
Name | Type |
------ | ------ |
`def` | [GearJointDef](../interfaces/gearjointdef.md) |
**Returns:** *[GearJoint](gearjoint.md)*
▸ **GearJoint**(`def`: [GearJointOpt](../interfaces/gearjointopt.md), `bodyA`: [Body](body.md), `bodyB`: [Body](body.md), `joint1`: [RevoluteJoint](revolutejoint.md) | [PrismaticJoint](prismaticjoint.md), `joint2`: [RevoluteJoint](revolutejoint.md) | [PrismaticJoint](prismaticjoint.md), `ratio?`: number): *[GearJoint](gearjoint.md)*
*Defined in [joint/index.d.ts:158](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L158)*
**Parameters:**
Name | Type |
------ | ------ |
`def` | [GearJointOpt](../interfaces/gearjointopt.md) |
`bodyA` | [Body](body.md) |
`bodyB` | [Body](body.md) |
`joint1` | [RevoluteJoint](revolutejoint.md) &#124; [PrismaticJoint](prismaticjoint.md) |
`joint2` | [RevoluteJoint](revolutejoint.md) &#124; [PrismaticJoint](prismaticjoint.md) |
`ratio?` | number |
**Returns:** *[GearJoint](gearjoint.md)*
## Index
### Constructors
* [constructor](gearjoint.md#constructor)
### Properties
* [TYPE](gearjoint.md#static-type)
### Methods
* [getJoint1](gearjoint.md#getjoint1)
* [getJoint2](gearjoint.md#getjoint2)
* [getRatio](gearjoint.md#getratio)
* [setRatio](gearjoint.md#setratio)
## Constructors
### constructor
\+ **new GearJoint**(`def`: [GearJointDef](../interfaces/gearjointdef.md)): *[GearJoint](gearjoint.md)*
*Defined in [joint/index.d.ts:160](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L160)*
**Parameters:**
Name | Type |
------ | ------ |
`def` | [GearJointDef](../interfaces/gearjointdef.md) |
**Returns:** *[GearJoint](gearjoint.md)*
\+ **new GearJoint**(`def`: [GearJointOpt](../interfaces/gearjointopt.md), `bodyA`: [Body](body.md), `bodyB`: [Body](body.md), `joint1`: [RevoluteJoint](revolutejoint.md) | [PrismaticJoint](prismaticjoint.md), `joint2`: [RevoluteJoint](revolutejoint.md) | [PrismaticJoint](prismaticjoint.md), `ratio?`: number): *[GearJoint](gearjoint.md)*
*Defined in [joint/index.d.ts:162](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L162)*
**Parameters:**
Name | Type |
------ | ------ |
`def` | [GearJointOpt](../interfaces/gearjointopt.md) |
`bodyA` | [Body](body.md) |
`bodyB` | [Body](body.md) |
`joint1` | [RevoluteJoint](revolutejoint.md) &#124; [PrismaticJoint](prismaticjoint.md) |
`joint2` | [RevoluteJoint](revolutejoint.md) &#124; [PrismaticJoint](prismaticjoint.md) |
`ratio?` | number |
**Returns:** *[GearJoint](gearjoint.md)*
## Properties
### `Static` TYPE
▪ **TYPE**: *"gear-joint"*
*Defined in [joint/index.d.ts:160](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L160)*
## Methods
### getJoint1
▸ **getJoint1**(): *[RevoluteJoint](revolutejoint.md) | [PrismaticJoint](prismaticjoint.md)*
*Defined in [joint/index.d.ts:191](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L191)*
**Returns:** *[RevoluteJoint](revolutejoint.md) | [PrismaticJoint](prismaticjoint.md)*
___
### getJoint2
▸ **getJoint2**(): *[RevoluteJoint](revolutejoint.md) | [PrismaticJoint](prismaticjoint.md)*
*Defined in [joint/index.d.ts:192](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L192)*
**Returns:** *[RevoluteJoint](revolutejoint.md) | [PrismaticJoint](prismaticjoint.md)*
___
### getRatio
▸ **getRatio**(): *number*
*Defined in [joint/index.d.ts:194](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L194)*
**Returns:** *number*
___
### setRatio
▸ **setRatio**(`ratio`: number): *void*
*Defined in [joint/index.d.ts:193](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L193)*
**Parameters:**
Name | Type |
------ | ------ |
`ratio` | number |
**Returns:** *void*

View File

@ -0,0 +1,48 @@
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [internal](../modules/internal.md) › [Distance](../modules/internal.distance.md) › [Cache](internal.distance.cache.md)
# Class: Cache
## Hierarchy
* **Cache**
## Index
### Properties
* [count](internal.distance.cache.md#count)
* [indexA](internal.distance.cache.md#indexa)
* [indexB](internal.distance.cache.md#indexb)
* [metric](internal.distance.cache.md#metric)
## Properties
### count
• **count**: *number*
*Defined in [index.d.ts:695](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L695)*
___
### indexA
• **indexA**: *number[]*
*Defined in [index.d.ts:693](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L693)*
___
### indexB
• **indexB**: *number[]*
*Defined in [index.d.ts:694](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L694)*
___
### metric
• **metric**: *number*
*Defined in [index.d.ts:692](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L692)*

View File

@ -0,0 +1,57 @@
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [internal](../modules/internal.md) › [Distance](../modules/internal.distance.md) › [Input](internal.distance.input.md)
# Class: Input
## Hierarchy
* **Input**
## Index
### Properties
* [proxyA](internal.distance.input.md#proxya)
* [proxyB](internal.distance.input.md#proxyb)
* [transformA](internal.distance.input.md#transforma)
* [transformB](internal.distance.input.md#transformb)
* [useRadii](internal.distance.input.md#useradii)
## Properties
### proxyA
• **proxyA**: *[DistanceProxy](distanceproxy.md)*
*Defined in [index.d.ts:679](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L679)*
___
### proxyB
• **proxyB**: *[DistanceProxy](distanceproxy.md)*
*Defined in [index.d.ts:680](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L680)*
___
### transformA
• **transformA**: *[Transform](transform.md) | null*
*Defined in [index.d.ts:681](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L681)*
___
### transformB
• **transformB**: *[Transform](transform.md) | null*
*Defined in [index.d.ts:682](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L682)*
___
### useRadii
• **useRadii**: *boolean*
*Defined in [index.d.ts:683](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L683)*

View File

@ -0,0 +1,48 @@
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [internal](../modules/internal.md) › [Distance](../modules/internal.distance.md) › [Output](internal.distance.output.md)
# Class: Output
## Hierarchy
* **Output**
## Index
### Properties
* [distance](internal.distance.output.md#distance)
* [iterations](internal.distance.output.md#iterations)
* [pointA](internal.distance.output.md#pointa)
* [pointB](internal.distance.output.md#pointb)
## Properties
### distance
• **distance**: *number*
*Defined in [index.d.ts:688](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L688)*
___
### iterations
• **iterations**: *number*
*Defined in [index.d.ts:689](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L689)*
___
### pointA
• **pointA**: *[Vec2](vec2.md)*
*Defined in [index.d.ts:686](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L686)*
___
### pointB
• **pointB**: *[Vec2](vec2.md)*
*Defined in [index.d.ts:687](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L687)*

View File

@ -0,0 +1,57 @@
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [internal](../modules/internal.md) › [TimeOfImpact](../modules/internal.timeofimpact.md) › [Input](internal.timeofimpact.input.md)
# Class: Input
## Hierarchy
* **Input**
## Index
### Properties
* [proxyA](internal.timeofimpact.input.md#proxya)
* [proxyB](internal.timeofimpact.input.md#proxyb)
* [sweepA](internal.timeofimpact.input.md#sweepa)
* [sweepB](internal.timeofimpact.input.md#sweepb)
* [tMax](internal.timeofimpact.input.md#tmax)
## Properties
### proxyA
• **proxyA**: *[DistanceProxy](distanceproxy.md)*
*Defined in [index.d.ts:702](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L702)*
___
### proxyB
• **proxyB**: *[DistanceProxy](distanceproxy.md)*
*Defined in [index.d.ts:703](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L703)*
___
### sweepA
• **sweepA**: *[Sweep](sweep.md)*
*Defined in [index.d.ts:704](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L704)*
___
### sweepB
• **sweepB**: *[Sweep](sweep.md)*
*Defined in [index.d.ts:705](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L705)*
___
### tMax
• **tMax**: *number | undefined*
*Defined in [index.d.ts:706](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L706)*

View File

@ -0,0 +1,75 @@
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [internal](../modules/internal.md) › [TimeOfImpact](../modules/internal.timeofimpact.md) › [Output](internal.timeofimpact.output.md)
# Class: Output
## Hierarchy
* **Output**
## Index
### Properties
* [state](internal.timeofimpact.output.md#state)
* [t](internal.timeofimpact.output.md#t)
* [e_failed](internal.timeofimpact.output.md#static-e_failed)
* [e_overlapped](internal.timeofimpact.output.md#static-e_overlapped)
* [e_separated](internal.timeofimpact.output.md#static-e_separated)
* [e_touching](internal.timeofimpact.output.md#static-e_touching)
* [e_unknown](internal.timeofimpact.output.md#static-e_unknown)
## Properties
### state
• **state**: *[TOIOutputState](../enums/toioutputstate.md) | undefined*
*Defined in [index.d.ts:709](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L709)*
___
### t
• **t**: *number | undefined*
*Defined in [index.d.ts:710](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L710)*
___
### `Static` e_failed
▪ **e_failed**: *[TOIOutputState](../enums/toioutputstate.md)*
*Defined in [index.d.ts:713](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L713)*
___
### `Static` e_overlapped
▪ **e_overlapped**: *[TOIOutputState](../enums/toioutputstate.md)*
*Defined in [index.d.ts:714](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L714)*
___
### `Static` e_separated
▪ **e_separated**: *[TOIOutputState](../enums/toioutputstate.md)*
*Defined in [index.d.ts:716](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L716)*
___
### `Static` e_touching
▪ **e_touching**: *[TOIOutputState](../enums/toioutputstate.md)*
*Defined in [index.d.ts:715](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L715)*
___
### `Static` e_unknown
▪ **e_unknown**: *[TOIOutputState](../enums/toioutputstate.md)*
*Defined in [index.d.ts:712](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L712)*

230
docs/api/classes/joint.md Normal file
View File

@ -0,0 +1,230 @@
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [Joint](joint.md)
# Class: Joint
## Hierarchy
* **Joint**
## Index
### Methods
* [getAnchorA](joint.md#getanchora)
* [getAnchorB](joint.md#getanchorb)
* [getBodyA](joint.md#getbodya)
* [getBodyB](joint.md#getbodyb)
* [getCollideConnected](joint.md#getcollideconnected)
* [getNext](joint.md#getnext)
* [getReactionForce](joint.md#getreactionforce)
* [getReactionTorque](joint.md#getreactiontorque)
* [getType](joint.md#gettype)
* [getUserData](joint.md#getuserdata)
* [initVelocityConstraints](joint.md#initvelocityconstraints)
* [isActive](joint.md#isactive)
* [setUserData](joint.md#setuserdata)
* [shiftOrigin](joint.md#shiftorigin)
* [solvePositionConstraints](joint.md#solvepositionconstraints)
* [solveVelocityConstraints](joint.md#solvevelocityconstraints)
## Methods
### getAnchorA
▸ **getAnchorA**(): *[Vec2](vec2.md)*
*Defined in [joint/index.d.ts:41](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L41)*
**Returns:** *[Vec2](vec2.md)*
___
### getAnchorB
▸ **getAnchorB**(): *[Vec2](vec2.md)*
*Defined in [joint/index.d.ts:42](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L42)*
**Returns:** *[Vec2](vec2.md)*
___
### getBodyA
▸ **getBodyA**(): *[Body](body.md)*
*Defined in [joint/index.d.ts:35](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L35)*
**Returns:** *[Body](body.md)*
___
### getBodyB
▸ **getBodyB**(): *[Body](body.md)*
*Defined in [joint/index.d.ts:36](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L36)*
**Returns:** *[Body](body.md)*
___
### getCollideConnected
▸ **getCollideConnected**(): *boolean*
*Defined in [joint/index.d.ts:40](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L40)*
**Returns:** *boolean*
___
### getNext
▸ **getNext**(): *[Joint](joint.md) | null*
*Defined in [joint/index.d.ts:37](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L37)*
**Returns:** *[Joint](joint.md) | null*
___
### getReactionForce
▸ **getReactionForce**(`inv_dt`: number): *[Vec2](vec2.md)*
*Defined in [joint/index.d.ts:43](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L43)*
**Parameters:**
Name | Type |
------ | ------ |
`inv_dt` | number |
**Returns:** *[Vec2](vec2.md)*
___
### getReactionTorque
▸ **getReactionTorque**(`inv_dt`: number): *number*
*Defined in [joint/index.d.ts:44](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L44)*
**Parameters:**
Name | Type |
------ | ------ |
`inv_dt` | number |
**Returns:** *number*
___
### getType
▸ **getType**(): *string*
*Defined in [joint/index.d.ts:34](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L34)*
**Returns:** *string*
___
### getUserData
▸ **getUserData**(): *unknown*
*Defined in [joint/index.d.ts:38](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L38)*
**Returns:** *unknown*
___
### initVelocityConstraints
▸ **initVelocityConstraints**(`step`: any): *void*
*Defined in [joint/index.d.ts:46](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L46)*
**Parameters:**
Name | Type |
------ | ------ |
`step` | any |
**Returns:** *void*
___
### isActive
▸ **isActive**(): *boolean*
*Defined in [joint/index.d.ts:33](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L33)*
**Returns:** *boolean*
___
### setUserData
▸ **setUserData**(`data`: any): *void*
*Defined in [joint/index.d.ts:39](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L39)*
**Parameters:**
Name | Type |
------ | ------ |
`data` | any |
**Returns:** *void*
___
### shiftOrigin
▸ **shiftOrigin**(`newOrigin`: [Vec2](vec2.md)): *void*
*Defined in [joint/index.d.ts:45](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L45)*
**Parameters:**
Name | Type |
------ | ------ |
`newOrigin` | [Vec2](vec2.md) |
**Returns:** *void*
___
### solvePositionConstraints
▸ **solvePositionConstraints**(`step`: any): *boolean*
*Defined in [joint/index.d.ts:48](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L48)*
**Parameters:**
Name | Type |
------ | ------ |
`step` | any |
**Returns:** *boolean*
___
### solveVelocityConstraints
▸ **solveVelocityConstraints**(`step`: any): *void*
*Defined in [joint/index.d.ts:47](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L47)*
**Parameters:**
Name | Type |
------ | ------ |
`step` | any |
**Returns:** *void*

357
docs/api/classes/mat22.md Normal file
View File

@ -0,0 +1,357 @@
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [Mat22](mat22.md)
# Class: Mat22
## Hierarchy
* **Mat22**
## Index
### Constructors
* [constructor](mat22.md#constructor)
### Properties
* [ex](mat22.md#ex)
* [ey](mat22.md#ey)
### Methods
* [getInverse](mat22.md#getinverse)
* [set](mat22.md#set)
* [setIdentity](mat22.md#setidentity)
* [setZero](mat22.md#setzero)
* [solve](mat22.md#solve)
* [toString](mat22.md#tostring)
* [abs](mat22.md#static-abs)
* [add](mat22.md#static-add)
* [assert](mat22.md#static-assert)
* [isValid](mat22.md#static-isvalid)
* [mul](mat22.md#static-mul)
* [mulMat22](mat22.md#static-mulmat22)
* [mulT](mat22.md#static-mult)
* [mulVec2](mat22.md#static-mulvec2)
## Constructors
### constructor
\+ **new Mat22**(`a`: number, `b`: number, `c`: number, `d`: number): *[Mat22](mat22.md)*
*Defined in [common/index.d.ts:193](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L193)*
**Parameters:**
Name | Type |
------ | ------ |
`a` | number |
`b` | number |
`c` | number |
`d` | number |
**Returns:** *[Mat22](mat22.md)*
\+ **new Mat22**(`a`: object, `b`: object): *[Mat22](mat22.md)*
*Defined in [common/index.d.ts:194](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L194)*
**Parameters:**
▪ **a**: *object*
Name | Type |
------ | ------ |
`x` | number |
`y` | number |
▪ **b**: *object*
Name | Type |
------ | ------ |
`x` | number |
`y` | number |
**Returns:** *[Mat22](mat22.md)*
\+ **new Mat22**(): *[Mat22](mat22.md)*
*Defined in [common/index.d.ts:195](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L195)*
**Returns:** *[Mat22](mat22.md)*
## Properties
### ex
• **ex**: *[Vec2](vec2.md)*
*Defined in [common/index.d.ts:210](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L210)*
___
### ey
• **ey**: *[Vec2](vec2.md)*
*Defined in [common/index.d.ts:211](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L211)*
## Methods
### getInverse
▸ **getInverse**(): *[Mat22](mat22.md)*
*Defined in [common/index.d.ts:218](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L218)*
**Returns:** *[Mat22](mat22.md)*
___
### set
▸ **set**(`a`: [Mat22](mat22.md)): *void*
*Defined in [common/index.d.ts:213](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L213)*
**Parameters:**
Name | Type |
------ | ------ |
`a` | [Mat22](mat22.md) |
**Returns:** *void*
▸ **set**(`a`: [Vec2](vec2.md), `b`: [Vec2](vec2.md)): *void*
*Defined in [common/index.d.ts:214](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L214)*
**Parameters:**
Name | Type |
------ | ------ |
`a` | [Vec2](vec2.md) |
`b` | [Vec2](vec2.md) |
**Returns:** *void*
▸ **set**(`a`: number, `b`: number, `c`: number, `d`: number): *void*
*Defined in [common/index.d.ts:215](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L215)*
**Parameters:**
Name | Type |
------ | ------ |
`a` | number |
`b` | number |
`c` | number |
`d` | number |
**Returns:** *void*
___
### setIdentity
▸ **setIdentity**(): *void*
*Defined in [common/index.d.ts:216](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L216)*
**Returns:** *void*
___
### setZero
▸ **setZero**(): *void*
*Defined in [common/index.d.ts:217](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L217)*
**Returns:** *void*
___
### solve
▸ **solve**(`v`: [Vec2](vec2.md)): *[Vec2](vec2.md)*
*Defined in [common/index.d.ts:219](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L219)*
**Parameters:**
Name | Type |
------ | ------ |
`v` | [Vec2](vec2.md) |
**Returns:** *[Vec2](vec2.md)*
___
### toString
▸ **toString**(): *string*
*Defined in [common/index.d.ts:212](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L212)*
**Returns:** *string*
___
### `Static` abs
▸ **abs**(`mx`: [Mat22](mat22.md)): *[Mat22](mat22.md)*
*Defined in [common/index.d.ts:207](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L207)*
**Parameters:**
Name | Type |
------ | ------ |
`mx` | [Mat22](mat22.md) |
**Returns:** *[Mat22](mat22.md)*
___
### `Static` add
▸ **add**(`mx1`: [Mat22](mat22.md), `mx2`: [Mat22](mat22.md)): *[Mat22](mat22.md)*
*Defined in [common/index.d.ts:208](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L208)*
**Parameters:**
Name | Type |
------ | ------ |
`mx1` | [Mat22](mat22.md) |
`mx2` | [Mat22](mat22.md) |
**Returns:** *[Mat22](mat22.md)*
___
### `Static` assert
▸ **assert**(`o`: any): *void*
*Defined in [common/index.d.ts:199](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L199)*
**Parameters:**
Name | Type |
------ | ------ |
`o` | any |
**Returns:** *void*
___
### `Static` isValid
▸ **isValid**(`o`: any): *boolean*
*Defined in [common/index.d.ts:198](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L198)*
**Parameters:**
Name | Type |
------ | ------ |
`o` | any |
**Returns:** *boolean*
___
### `Static` mul
▸ **mul**(`mx`: [Mat22](mat22.md), `my`: [Mat22](mat22.md)): *[Mat22](mat22.md)*
*Defined in [common/index.d.ts:201](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L201)*
**Parameters:**
Name | Type |
------ | ------ |
`mx` | [Mat22](mat22.md) |
`my` | [Mat22](mat22.md) |
**Returns:** *[Mat22](mat22.md)*
▸ **mul**(`mx`: [Mat22](mat22.md), `v`: [Vec2](vec2.md)): *[Vec2](vec2.md)*
*Defined in [common/index.d.ts:202](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L202)*
**Parameters:**
Name | Type |
------ | ------ |
`mx` | [Mat22](mat22.md) |
`v` | [Vec2](vec2.md) |
**Returns:** *[Vec2](vec2.md)*
___
### `Static` mulMat22
▸ **mulMat22**(`mx`: [Mat22](mat22.md), `my`: [Mat22](mat22.md)): *[Mat22](mat22.md)*
*Defined in [common/index.d.ts:204](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L204)*
**Parameters:**
Name | Type |
------ | ------ |
`mx` | [Mat22](mat22.md) |
`my` | [Mat22](mat22.md) |
**Returns:** *[Mat22](mat22.md)*
___
### `Static` mulT
▸ **mulT**(`mx`: [Mat22](mat22.md), `my`: [Mat22](mat22.md)): *[Mat22](mat22.md)*
*Defined in [common/index.d.ts:205](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L205)*
**Parameters:**
Name | Type |
------ | ------ |
`mx` | [Mat22](mat22.md) |
`my` | [Mat22](mat22.md) |
**Returns:** *[Mat22](mat22.md)*
▸ **mulT**(`mx`: [Mat22](mat22.md), `v`: [Vec2](vec2.md)): *[Vec2](vec2.md)*
*Defined in [common/index.d.ts:206](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L206)*
**Parameters:**
Name | Type |
------ | ------ |
`mx` | [Mat22](mat22.md) |
`v` | [Vec2](vec2.md) |
**Returns:** *[Vec2](vec2.md)*
___
### `Static` mulVec2
▸ **mulVec2**(`mx`: [Mat22](mat22.md), `v`: [Vec2](vec2.md)): *[Vec2](vec2.md)*
*Defined in [common/index.d.ts:203](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L203)*
**Parameters:**
Name | Type |
------ | ------ |
`mx` | [Mat22](mat22.md) |
`v` | [Vec2](vec2.md) |
**Returns:** *[Vec2](vec2.md)*

293
docs/api/classes/mat33.md Normal file
View File

@ -0,0 +1,293 @@
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [Mat33](mat33.md)
# Class: Mat33
## Hierarchy
* **Mat33**
## Index
### Constructors
* [constructor](mat33.md#constructor)
### Properties
* [ex](mat33.md#ex)
* [ey](mat33.md#ey)
* [ez](mat33.md#ez)
### Methods
* [getInverse22](mat33.md#getinverse22)
* [getSymInverse33](mat33.md#getsyminverse33)
* [setZero](mat33.md#setzero)
* [solve22](mat33.md#solve22)
* [solve33](mat33.md#solve33)
* [toString](mat33.md#tostring)
* [add](mat33.md#static-add)
* [assert](mat33.md#static-assert)
* [isValid](mat33.md#static-isvalid)
* [mul](mat33.md#static-mul)
* [mulVec2](mat33.md#static-mulvec2)
* [mulVec3](mat33.md#static-mulvec3)
## Constructors
### constructor
\+ **new Mat33**(`a`: [Vec3](vec3.md), `b`: [Vec3](vec3.md), `c`: [Vec3](vec3.md)): *[Mat33](mat33.md)*
*Defined in [common/index.d.ts:222](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L222)*
**Parameters:**
Name | Type |
------ | ------ |
`a` | [Vec3](vec3.md) |
`b` | [Vec3](vec3.md) |
`c` | [Vec3](vec3.md) |
**Returns:** *[Mat33](mat33.md)*
\+ **new Mat33**(`a`: any, `b`: any, `c`: any): *[Mat33](mat33.md)*
*Defined in [common/index.d.ts:223](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L223)*
**Parameters:**
Name | Type |
------ | ------ |
`a` | any |
`b` | any |
`c` | any |
**Returns:** *[Mat33](mat33.md)*
\+ **new Mat33**(): *[Mat33](mat33.md)*
*Defined in [common/index.d.ts:224](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L224)*
**Returns:** *[Mat33](mat33.md)*
## Properties
### ex
• **ex**: *[Vec3](vec3.md)*
*Defined in [common/index.d.ts:236](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L236)*
___
### ey
• **ey**: *[Vec3](vec3.md)*
*Defined in [common/index.d.ts:237](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L237)*
___
### ez
• **ez**: *[Vec3](vec3.md)*
*Defined in [common/index.d.ts:238](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L238)*
## Methods
### getInverse22
▸ **getInverse22**(`M`: [Mat33](mat33.md)): *void*
*Defined in [common/index.d.ts:244](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L244)*
**Parameters:**
Name | Type |
------ | ------ |
`M` | [Mat33](mat33.md) |
**Returns:** *void*
___
### getSymInverse33
▸ **getSymInverse33**(`M`: [Mat33](mat33.md)): *void*
*Defined in [common/index.d.ts:245](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L245)*
**Parameters:**
Name | Type |
------ | ------ |
`M` | [Mat33](mat33.md) |
**Returns:** *void*
___
### setZero
▸ **setZero**(): *[Mat33](mat33.md)*
*Defined in [common/index.d.ts:241](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L241)*
**Returns:** *[Mat33](mat33.md)*
___
### solve22
▸ **solve22**(`v`: [Vec2](vec2.md)): *[Vec2](vec2.md)*
*Defined in [common/index.d.ts:243](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L243)*
**Parameters:**
Name | Type |
------ | ------ |
`v` | [Vec2](vec2.md) |
**Returns:** *[Vec2](vec2.md)*
___
### solve33
▸ **solve33**(`v`: [Vec3](vec3.md)): *[Vec3](vec3.md)*
*Defined in [common/index.d.ts:242](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L242)*
**Parameters:**
Name | Type |
------ | ------ |
`v` | [Vec3](vec3.md) |
**Returns:** *[Vec3](vec3.md)*
___
### toString
▸ **toString**(): *string*
*Defined in [common/index.d.ts:240](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L240)*
**Returns:** *string*
___
### `Static` add
▸ **add**(`a`: [Mat33](mat33.md), `b`: [Mat33](mat33.md)): *[Mat33](mat33.md)*
*Defined in [common/index.d.ts:234](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L234)*
**Parameters:**
Name | Type |
------ | ------ |
`a` | [Mat33](mat33.md) |
`b` | [Mat33](mat33.md) |
**Returns:** *[Mat33](mat33.md)*
___
### `Static` assert
▸ **assert**(`o`: any): *void*
*Defined in [common/index.d.ts:228](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L228)*
**Parameters:**
Name | Type |
------ | ------ |
`o` | any |
**Returns:** *void*
___
### `Static` isValid
▸ **isValid**(`o`: any): *boolean*
*Defined in [common/index.d.ts:227](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L227)*
**Parameters:**
Name | Type |
------ | ------ |
`o` | any |
**Returns:** *boolean*
___
### `Static` mul
▸ **mul**(`a`: [Mat33](mat33.md), `b`: [Vec2](vec2.md)): *[Vec2](vec2.md)*
*Defined in [common/index.d.ts:230](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L230)*
**Parameters:**
Name | Type |
------ | ------ |
`a` | [Mat33](mat33.md) |
`b` | [Vec2](vec2.md) |
**Returns:** *[Vec2](vec2.md)*
▸ **mul**(`a`: [Mat33](mat33.md), `b`: [Vec3](vec3.md)): *[Vec3](vec3.md)*
*Defined in [common/index.d.ts:231](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L231)*
**Parameters:**
Name | Type |
------ | ------ |
`a` | [Mat33](mat33.md) |
`b` | [Vec3](vec3.md) |
**Returns:** *[Vec3](vec3.md)*
___
### `Static` mulVec2
▸ **mulVec2**(`a`: [Mat33](mat33.md), `b`: [Vec2](vec2.md)): *[Vec2](vec2.md)*
*Defined in [common/index.d.ts:233](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L233)*
**Parameters:**
Name | Type |
------ | ------ |
`a` | [Mat33](mat33.md) |
`b` | [Vec2](vec2.md) |
**Returns:** *[Vec2](vec2.md)*
___
### `Static` mulVec3
▸ **mulVec3**(`a`: [Mat33](mat33.md), `b`: [Vec3](vec3.md)): *[Vec3](vec3.md)*
*Defined in [common/index.d.ts:232](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L232)*
**Parameters:**
Name | Type |
------ | ------ |
`a` | [Mat33](mat33.md) |
`b` | [Vec3](vec3.md) |
**Returns:** *[Vec3](vec3.md)*

193
docs/api/classes/math.md Normal file
View File

@ -0,0 +1,193 @@
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [Math](math.md)
# Class: Math
## Hierarchy
* **Math**
## Index
### Properties
* [EPSILON](math.md#readonly-epsilon)
### Methods
* [assert](math.md#static-assert)
* [clamp](math.md#static-clamp)
* [invSqrt](math.md#static-invsqrt)
* [isFinite](math.md#static-isfinite)
* [isPowerOfTwo](math.md#static-ispoweroftwo)
* [mod](math.md#static-mod)
* [nextPowerOfTwo](math.md#static-nextpoweroftwo)
* [random](math.md#static-random)
## Properties
### `Readonly` EPSILON
• **EPSILON**: *number*
*Defined in [common/index.d.ts:2](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L2)*
## Methods
### `Static` assert
▸ **assert**(`x`: any): *void*
*Defined in [common/index.d.ts:8](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L8)*
**Parameters:**
Name | Type |
------ | ------ |
`x` | any |
**Returns:** *void*
___
### `Static` clamp
▸ **clamp**(`num`: number, `min`: number, `max`: number): *number*
*Defined in [common/index.d.ts:14](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L14)*
**Parameters:**
Name | Type |
------ | ------ |
`num` | number |
`min` | number |
`max` | number |
**Returns:** *number*
___
### `Static` invSqrt
▸ **invSqrt**(`x`: number): *number*
*Defined in [common/index.d.ts:9](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L9)*
**Parameters:**
Name | Type |
------ | ------ |
`x` | number |
**Returns:** *number*
___
### `Static` isFinite
▸ **isFinite**(`x`: any): *boolean*
*Defined in [common/index.d.ts:7](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L7)*
This function is used to ensure that a floating point number is not a NaN or
infinity.
**Parameters:**
Name | Type |
------ | ------ |
`x` | any |
**Returns:** *boolean*
___
### `Static` isPowerOfTwo
▸ **isPowerOfTwo**(`x`: number): *boolean*
*Defined in [common/index.d.ts:11](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L11)*
**Parameters:**
Name | Type |
------ | ------ |
`x` | number |
**Returns:** *boolean*
___
### `Static` mod
▸ **mod**(`num`: number, `min`: number, `max`: number): *number*
*Defined in [common/index.d.ts:12](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L12)*
**Parameters:**
Name | Type |
------ | ------ |
`num` | number |
`min` | number |
`max` | number |
**Returns:** *number*
▸ **mod**(`num`: number, `max?`: number): *number*
*Defined in [common/index.d.ts:13](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L13)*
**Parameters:**
Name | Type |
------ | ------ |
`num` | number |
`max?` | number |
**Returns:** *number*
___
### `Static` nextPowerOfTwo
▸ **nextPowerOfTwo**(`x`: number): *number*
*Defined in [common/index.d.ts:10](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L10)*
**Parameters:**
Name | Type |
------ | ------ |
`x` | number |
**Returns:** *number*
___
### `Static` random
▸ **random**(`min`: number, `max`: number): *number*
*Defined in [common/index.d.ts:15](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L15)*
**Parameters:**
Name | Type |
------ | ------ |
`min` | number |
`max` | number |
**Returns:** *number*
▸ **random**(`max?`: number): *number*
*Defined in [common/index.d.ts:16](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L16)*
**Parameters:**
Name | Type |
------ | ------ |
`max?` | number |
**Returns:** *number*

View File

@ -0,0 +1,228 @@
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [MotorJoint](motorjoint.md)
# Class: MotorJoint
## Hierarchy
* any
↳ **MotorJoint**
## Callable
▸ **MotorJoint**(`def`: [MotorJointDef](../interfaces/motorjointdef.md)): *[MotorJoint](motorjoint.md)*
*Defined in [joint/index.d.ts:206](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L206)*
**Parameters:**
Name | Type |
------ | ------ |
`def` | [MotorJointDef](../interfaces/motorjointdef.md) |
**Returns:** *[MotorJoint](motorjoint.md)*
▸ **MotorJoint**(`def`: [MotorJointOpt](../interfaces/motorjointopt.md), `bodyA`: [Body](body.md), `bodyB`: [Body](body.md)): *[MotorJoint](motorjoint.md)*
*Defined in [joint/index.d.ts:207](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L207)*
**Parameters:**
Name | Type |
------ | ------ |
`def` | [MotorJointOpt](../interfaces/motorjointopt.md) |
`bodyA` | [Body](body.md) |
`bodyB` | [Body](body.md) |
**Returns:** *[MotorJoint](motorjoint.md)*
## Index
### Constructors
* [constructor](motorjoint.md#constructor)
### Properties
* [TYPE](motorjoint.md#static-type)
### Methods
* [getAngularOffset](motorjoint.md#getangularoffset)
* [getCorrectionFactor](motorjoint.md#getcorrectionfactor)
* [getLinearOffset](motorjoint.md#getlinearoffset)
* [getMaxForce](motorjoint.md#getmaxforce)
* [getMaxTorque](motorjoint.md#getmaxtorque)
* [setAngularOffset](motorjoint.md#setangularoffset)
* [setCorrectionFactor](motorjoint.md#setcorrectionfactor)
* [setLinearOffset](motorjoint.md#setlinearoffset)
* [setMaxForce](motorjoint.md#setmaxforce)
* [setMaxTorque](motorjoint.md#setmaxtorque)
## Constructors
### constructor
\+ **new MotorJoint**(`def`: [MotorJointDef](../interfaces/motorjointdef.md)): *[MotorJoint](motorjoint.md)*
*Defined in [joint/index.d.ts:209](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L209)*
**Parameters:**
Name | Type |
------ | ------ |
`def` | [MotorJointDef](../interfaces/motorjointdef.md) |
**Returns:** *[MotorJoint](motorjoint.md)*
\+ **new MotorJoint**(`def`: [MotorJointOpt](../interfaces/motorjointopt.md), `bodyA`: [Body](body.md), `bodyB`: [Body](body.md)): *[MotorJoint](motorjoint.md)*
*Defined in [joint/index.d.ts:211](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L211)*
**Parameters:**
Name | Type |
------ | ------ |
`def` | [MotorJointOpt](../interfaces/motorjointopt.md) |
`bodyA` | [Body](body.md) |
`bodyB` | [Body](body.md) |
**Returns:** *[MotorJoint](motorjoint.md)*
## Properties
### `Static` TYPE
▪ **TYPE**: *"motor-joint"*
*Defined in [joint/index.d.ts:209](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L209)*
## Methods
### getAngularOffset
▸ **getAngularOffset**(): *number*
*Defined in [joint/index.d.ts:245](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L245)*
**Returns:** *number*
___
### getCorrectionFactor
▸ **getCorrectionFactor**(): *number*
*Defined in [joint/index.d.ts:241](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L241)*
**Returns:** *number*
___
### getLinearOffset
▸ **getLinearOffset**(): *[Vec2](vec2.md)*
*Defined in [joint/index.d.ts:243](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L243)*
**Returns:** *[Vec2](vec2.md)*
___
### getMaxForce
▸ **getMaxForce**(): *number*
*Defined in [joint/index.d.ts:237](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L237)*
**Returns:** *number*
___
### getMaxTorque
▸ **getMaxTorque**(): *number*
*Defined in [joint/index.d.ts:239](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L239)*
**Returns:** *number*
___
### setAngularOffset
▸ **setAngularOffset**(`angularOffset`: number): *void*
*Defined in [joint/index.d.ts:244](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L244)*
**Parameters:**
Name | Type |
------ | ------ |
`angularOffset` | number |
**Returns:** *void*
___
### setCorrectionFactor
▸ **setCorrectionFactor**(`factor`: number): *void*
*Defined in [joint/index.d.ts:240](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L240)*
**Parameters:**
Name | Type |
------ | ------ |
`factor` | number |
**Returns:** *void*
___
### setLinearOffset
▸ **setLinearOffset**(`linearOffset`: [Vec2](vec2.md)): *void*
*Defined in [joint/index.d.ts:242](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L242)*
**Parameters:**
Name | Type |
------ | ------ |
`linearOffset` | [Vec2](vec2.md) |
**Returns:** *void*
___
### setMaxForce
▸ **setMaxForce**(`force`: number): *void*
*Defined in [joint/index.d.ts:236](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L236)*
**Parameters:**
Name | Type |
------ | ------ |
`force` | number |
**Returns:** *void*
___
### setMaxTorque
▸ **setMaxTorque**(`torque`: number): *void*
*Defined in [joint/index.d.ts:238](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L238)*
**Parameters:**
Name | Type |
------ | ------ |
`torque` | number |
**Returns:** *void*

View File

@ -0,0 +1,202 @@
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [MouseJoint](mousejoint.md)
# Class: MouseJoint
## Hierarchy
* any
↳ **MouseJoint**
## Callable
▸ **MouseJoint**(`def`: [MouseJointDef](../interfaces/mousejointdef.md)): *[MouseJoint](mousejoint.md)*
*Defined in [joint/index.d.ts:258](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L258)*
**Parameters:**
Name | Type |
------ | ------ |
`def` | [MouseJointDef](../interfaces/mousejointdef.md) |
**Returns:** *[MouseJoint](mousejoint.md)*
▸ **MouseJoint**(`def`: [MouseJointOpt](../interfaces/mousejointopt.md), `bodyA`: [Body](body.md), `bodyB`: [Body](body.md), `target`: [Vec2](vec2.md)): *[MouseJoint](mousejoint.md)*
*Defined in [joint/index.d.ts:259](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L259)*
**Parameters:**
Name | Type |
------ | ------ |
`def` | [MouseJointOpt](../interfaces/mousejointopt.md) |
`bodyA` | [Body](body.md) |
`bodyB` | [Body](body.md) |
`target` | [Vec2](vec2.md) |
**Returns:** *[MouseJoint](mousejoint.md)*
## Index
### Constructors
* [constructor](mousejoint.md#constructor)
### Properties
* [TYPE](mousejoint.md#static-type)
### Methods
* [getDampingRatio](mousejoint.md#getdampingratio)
* [getFrequency](mousejoint.md#getfrequency)
* [getMaxForce](mousejoint.md#getmaxforce)
* [getTarget](mousejoint.md#gettarget)
* [setDampingRatio](mousejoint.md#setdampingratio)
* [setFrequency](mousejoint.md#setfrequency)
* [setMaxForce](mousejoint.md#setmaxforce)
* [setTarget](mousejoint.md#settarget)
## Constructors
### constructor
\+ **new MouseJoint**(`def`: [MouseJointDef](../interfaces/mousejointdef.md)): *[MouseJoint](mousejoint.md)*
*Defined in [joint/index.d.ts:261](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L261)*
**Parameters:**
Name | Type |
------ | ------ |
`def` | [MouseJointDef](../interfaces/mousejointdef.md) |
**Returns:** *[MouseJoint](mousejoint.md)*
\+ **new MouseJoint**(`def`: [MouseJointOpt](../interfaces/mousejointopt.md), `bodyA`: [Body](body.md), `bodyB`: [Body](body.md), `target`: [Vec2](vec2.md)): *[MouseJoint](mousejoint.md)*
*Defined in [joint/index.d.ts:263](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L263)*
**Parameters:**
Name | Type |
------ | ------ |
`def` | [MouseJointOpt](../interfaces/mousejointopt.md) |
`bodyA` | [Body](body.md) |
`bodyB` | [Body](body.md) |
`target` | [Vec2](vec2.md) |
**Returns:** *[MouseJoint](mousejoint.md)*
## Properties
### `Static` TYPE
▪ **TYPE**: *"mouse-joint"*
*Defined in [joint/index.d.ts:261](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L261)*
## Methods
### getDampingRatio
▸ **getDampingRatio**(): *number*
*Defined in [joint/index.d.ts:290](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L290)*
**Returns:** *number*
___
### getFrequency
▸ **getFrequency**(): *number*
*Defined in [joint/index.d.ts:288](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L288)*
**Returns:** *number*
___
### getMaxForce
▸ **getMaxForce**(): *number*
*Defined in [joint/index.d.ts:286](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L286)*
**Returns:** *number*
___
### getTarget
▸ **getTarget**(): *[Vec2](vec2.md)*
*Defined in [joint/index.d.ts:284](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L284)*
**Returns:** *[Vec2](vec2.md)*
___
### setDampingRatio
▸ **setDampingRatio**(`ratio`: number): *void*
*Defined in [joint/index.d.ts:289](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L289)*
**Parameters:**
Name | Type |
------ | ------ |
`ratio` | number |
**Returns:** *void*
___
### setFrequency
▸ **setFrequency**(`hz`: number): *void*
*Defined in [joint/index.d.ts:287](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L287)*
**Parameters:**
Name | Type |
------ | ------ |
`hz` | number |
**Returns:** *void*
___
### setMaxForce
▸ **setMaxForce**(`force`: number): *void*
*Defined in [joint/index.d.ts:285](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L285)*
**Parameters:**
Name | Type |
------ | ------ |
`force` | number |
**Returns:** *void*
___
### setTarget
▸ **setTarget**(`target`: [Vec2](vec2.md)): *void*
*Defined in [joint/index.d.ts:283](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L283)*
**Parameters:**
Name | Type |
------ | ------ |
`target` | [Vec2](vec2.md) |
**Returns:** *void*

View File

@ -0,0 +1,88 @@
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [PolygonShape](polygonshape.md)
# Class: PolygonShape
## Hierarchy
* any
↳ **PolygonShape**
## Callable
▸ **PolygonShape**(`vertices`: [Vec2](vec2.md)[]): *[PolygonShape](polygonshape.md)*
*Defined in [shape/index.d.ts:58](https://github.com/shakiba/planck.js/blob/038d425/lib/shape/index.d.ts#L58)*
**Parameters:**
Name | Type |
------ | ------ |
`vertices` | [Vec2](vec2.md)[] |
**Returns:** *[PolygonShape](polygonshape.md)*
## Index
### Constructors
* [constructor](polygonshape.md#constructor)
### Properties
* [TYPE](polygonshape.md#static-type)
### Methods
* [getVertex](polygonshape.md#getvertex)
* [validate](polygonshape.md#validate)
## Constructors
### constructor
\+ **new PolygonShape**(`vertices`: [Vec2](vec2.md)[]): *[PolygonShape](polygonshape.md)*
*Defined in [shape/index.d.ts:60](https://github.com/shakiba/planck.js/blob/038d425/lib/shape/index.d.ts#L60)*
**Parameters:**
Name | Type |
------ | ------ |
`vertices` | [Vec2](vec2.md)[] |
**Returns:** *[PolygonShape](polygonshape.md)*
## Properties
### `Static` TYPE
▪ **TYPE**: *"polygon"*
*Defined in [shape/index.d.ts:60](https://github.com/shakiba/planck.js/blob/038d425/lib/shape/index.d.ts#L60)*
## Methods
### getVertex
▸ **getVertex**(`index`: number): *[Vec2](vec2.md)*
*Defined in [shape/index.d.ts:70](https://github.com/shakiba/planck.js/blob/038d425/lib/shape/index.d.ts#L70)*
**Parameters:**
Name | Type |
------ | ------ |
`index` | number |
**Returns:** *[Vec2](vec2.md)*
___
### validate
▸ **validate**(): *void*
*Defined in [shape/index.d.ts:71](https://github.com/shakiba/planck.js/blob/038d425/lib/shape/index.d.ts#L71)*
**Returns:** *void*

View File

@ -0,0 +1,51 @@
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [Position](position.md)
# Class: Position
## Hierarchy
* **Position**
## Index
### Properties
* [a](position.md#a)
* [c](position.md#c)
### Methods
* [getTransform](position.md#gettransform)
## Properties
### a
• **a**: *number*
*Defined in [common/index.d.ts:26](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L26)*
___
### c
• **c**: *[Vec2](vec2.md)*
*Defined in [common/index.d.ts:25](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L25)*
## Methods
### getTransform
▸ **getTransform**(`xf`: [Transform](transform.md), `p`: [Vec2](vec2.md)): *[Transform](transform.md)*
*Defined in [common/index.d.ts:27](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L27)*
**Parameters:**
Name | Type |
------ | ------ |
`xf` | [Transform](transform.md) |
`p` | [Vec2](vec2.md) |
**Returns:** *[Transform](transform.md)*

View File

@ -0,0 +1,316 @@
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [PrismaticJoint](prismaticjoint.md)
# Class: PrismaticJoint
## Hierarchy
* any
↳ **PrismaticJoint**
## Callable
▸ **PrismaticJoint**(`def`: [PrismaticJointDef](../interfaces/prismaticjointdef.md)): *[PrismaticJoint](prismaticjoint.md)*
*Defined in [joint/index.d.ts:303](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L303)*
**Parameters:**
Name | Type |
------ | ------ |
`def` | [PrismaticJointDef](../interfaces/prismaticjointdef.md) |
**Returns:** *[PrismaticJoint](prismaticjoint.md)*
▸ **PrismaticJoint**(`def`: [PrismaticJointOpt](../interfaces/prismaticjointopt.md), `bodyA`: [Body](body.md), `bodyB`: [Body](body.md), `anchor`: [Vec2](vec2.md), `axis`: [Vec2](vec2.md)): *[PrismaticJoint](prismaticjoint.md)*
*Defined in [joint/index.d.ts:304](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L304)*
**Parameters:**
Name | Type |
------ | ------ |
`def` | [PrismaticJointOpt](../interfaces/prismaticjointopt.md) |
`bodyA` | [Body](body.md) |
`bodyB` | [Body](body.md) |
`anchor` | [Vec2](vec2.md) |
`axis` | [Vec2](vec2.md) |
**Returns:** *[PrismaticJoint](prismaticjoint.md)*
## Index
### Constructors
* [constructor](prismaticjoint.md#constructor)
### Properties
* [TYPE](prismaticjoint.md#static-type)
### Methods
* [enableLimit](prismaticjoint.md#enablelimit)
* [enableMotor](prismaticjoint.md#enablemotor)
* [getJointSpeed](prismaticjoint.md#getjointspeed)
* [getJointTranslation](prismaticjoint.md#getjointtranslation)
* [getLocalAnchorA](prismaticjoint.md#getlocalanchora)
* [getLocalAnchorB](prismaticjoint.md#getlocalanchorb)
* [getLocalAxisA](prismaticjoint.md#getlocalaxisa)
* [getLowerLimit](prismaticjoint.md#getlowerlimit)
* [getMotorForce](prismaticjoint.md#getmotorforce)
* [getMotorSpeed](prismaticjoint.md#getmotorspeed)
* [getReferenceAngle](prismaticjoint.md#getreferenceangle)
* [getUpperLimit](prismaticjoint.md#getupperlimit)
* [isLimitEnabled](prismaticjoint.md#islimitenabled)
* [isMotorEnabled](prismaticjoint.md#ismotorenabled)
* [setLimits](prismaticjoint.md#setlimits)
* [setMaxMotorForce](prismaticjoint.md#setmaxmotorforce)
* [setMotorSpeed](prismaticjoint.md#setmotorspeed)
## Constructors
### constructor
\+ **new PrismaticJoint**(`def`: [PrismaticJointDef](../interfaces/prismaticjointdef.md)): *[PrismaticJoint](prismaticjoint.md)*
*Defined in [joint/index.d.ts:306](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L306)*
**Parameters:**
Name | Type |
------ | ------ |
`def` | [PrismaticJointDef](../interfaces/prismaticjointdef.md) |
**Returns:** *[PrismaticJoint](prismaticjoint.md)*
\+ **new PrismaticJoint**(`def`: [PrismaticJointOpt](../interfaces/prismaticjointopt.md), `bodyA`: [Body](body.md), `bodyB`: [Body](body.md), `anchor`: [Vec2](vec2.md), `axis`: [Vec2](vec2.md)): *[PrismaticJoint](prismaticjoint.md)*
*Defined in [joint/index.d.ts:308](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L308)*
**Parameters:**
Name | Type |
------ | ------ |
`def` | [PrismaticJointOpt](../interfaces/prismaticjointopt.md) |
`bodyA` | [Body](body.md) |
`bodyB` | [Body](body.md) |
`anchor` | [Vec2](vec2.md) |
`axis` | [Vec2](vec2.md) |
**Returns:** *[PrismaticJoint](prismaticjoint.md)*
## Properties
### `Static` TYPE
▪ **TYPE**: *"prismatic-joint"*
*Defined in [joint/index.d.ts:306](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L306)*
## Methods
### enableLimit
▸ **enableLimit**(`flag`: boolean): *void*
*Defined in [joint/index.d.ts:349](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L349)*
**Parameters:**
Name | Type |
------ | ------ |
`flag` | boolean |
**Returns:** *void*
___
### enableMotor
▸ **enableMotor**(`flag`: boolean): *void*
*Defined in [joint/index.d.ts:354](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L354)*
**Parameters:**
Name | Type |
------ | ------ |
`flag` | boolean |
**Returns:** *void*
___
### getJointSpeed
▸ **getJointSpeed**(): *number*
*Defined in [joint/index.d.ts:347](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L347)*
**Returns:** *number*
___
### getJointTranslation
▸ **getJointTranslation**(): *number*
*Defined in [joint/index.d.ts:346](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L346)*
**Returns:** *number*
___
### getLocalAnchorA
▸ **getLocalAnchorA**(): *[Vec2](vec2.md)*
*Defined in [joint/index.d.ts:342](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L342)*
**Returns:** *[Vec2](vec2.md)*
___
### getLocalAnchorB
▸ **getLocalAnchorB**(): *[Vec2](vec2.md)*
*Defined in [joint/index.d.ts:343](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L343)*
**Returns:** *[Vec2](vec2.md)*
___
### getLocalAxisA
▸ **getLocalAxisA**(): *[Vec2](vec2.md)*
*Defined in [joint/index.d.ts:344](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L344)*
**Returns:** *[Vec2](vec2.md)*
___
### getLowerLimit
▸ **getLowerLimit**(): *number*
*Defined in [joint/index.d.ts:350](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L350)*
**Returns:** *number*
___
### getMotorForce
▸ **getMotorForce**(`inv_dt`: number): *number*
*Defined in [joint/index.d.ts:358](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L358)*
**Parameters:**
Name | Type |
------ | ------ |
`inv_dt` | number |
**Returns:** *number*
___
### getMotorSpeed
▸ **getMotorSpeed**(): *number*
*Defined in [joint/index.d.ts:357](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L357)*
**Returns:** *number*
___
### getReferenceAngle
▸ **getReferenceAngle**(): *number*
*Defined in [joint/index.d.ts:345](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L345)*
**Returns:** *number*
___
### getUpperLimit
▸ **getUpperLimit**(): *number*
*Defined in [joint/index.d.ts:351](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L351)*
**Returns:** *number*
___
### isLimitEnabled
▸ **isLimitEnabled**(): *boolean*
*Defined in [joint/index.d.ts:348](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L348)*
**Returns:** *boolean*
___
### isMotorEnabled
▸ **isMotorEnabled**(): *boolean*
*Defined in [joint/index.d.ts:353](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L353)*
**Returns:** *boolean*
___
### setLimits
▸ **setLimits**(`lower`: number, `upper`: number): *void*
*Defined in [joint/index.d.ts:352](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L352)*
**Parameters:**
Name | Type |
------ | ------ |
`lower` | number |
`upper` | number |
**Returns:** *void*
___
### setMaxMotorForce
▸ **setMaxMotorForce**(`force`: number): *void*
*Defined in [joint/index.d.ts:356](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L356)*
**Parameters:**
Name | Type |
------ | ------ |
`force` | number |
**Returns:** *void*
___
### setMotorSpeed
▸ **setMotorSpeed**(`speed`: number): *void*
*Defined in [joint/index.d.ts:355](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L355)*
**Parameters:**
Name | Type |
------ | ------ |
`speed` | number |
**Returns:** *void*

View File

@ -0,0 +1,184 @@
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [PulleyJoint](pulleyjoint.md)
# Class: PulleyJoint
## Hierarchy
* any
↳ **PulleyJoint**
## Callable
▸ **PulleyJoint**(`def`: [PulleyJointDef](../interfaces/pulleyjointdef.md)): *[PulleyJoint](pulleyjoint.md)*
*Defined in [joint/index.d.ts:377](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L377)*
**Parameters:**
Name | Type |
------ | ------ |
`def` | [PulleyJointDef](../interfaces/pulleyjointdef.md) |
**Returns:** *[PulleyJoint](pulleyjoint.md)*
▸ **PulleyJoint**(`def`: [PulleyJointOpt](../interfaces/pulleyjointopt.md), `bodyA`: [Body](body.md), `bodyB`: [Body](body.md), `groundA`: [Vec2](vec2.md), `groundB`: [Vec2](vec2.md), `anchorA`: [Vec2](vec2.md), `anchorB`: [Vec2](vec2.md), `ratio`: number): *[PulleyJoint](pulleyjoint.md)*
*Defined in [joint/index.d.ts:378](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L378)*
**Parameters:**
Name | Type |
------ | ------ |
`def` | [PulleyJointOpt](../interfaces/pulleyjointopt.md) |
`bodyA` | [Body](body.md) |
`bodyB` | [Body](body.md) |
`groundA` | [Vec2](vec2.md) |
`groundB` | [Vec2](vec2.md) |
`anchorA` | [Vec2](vec2.md) |
`anchorB` | [Vec2](vec2.md) |
`ratio` | number |
**Returns:** *[PulleyJoint](pulleyjoint.md)*
## Index
### Constructors
* [constructor](pulleyjoint.md#constructor)
### Properties
* [MIN_PULLEY_LENGTH](pulleyjoint.md#static-min_pulley_length)
* [TYPE](pulleyjoint.md#static-type)
### Methods
* [getCurrentLengthA](pulleyjoint.md#getcurrentlengtha)
* [getCurrentLengthB](pulleyjoint.md#getcurrentlengthb)
* [getGroundAnchorA](pulleyjoint.md#getgroundanchora)
* [getGroundAnchorB](pulleyjoint.md#getgroundanchorb)
* [getLengthA](pulleyjoint.md#getlengtha)
* [getLengthB](pulleyjoint.md#getlengthb)
* [getRatio](pulleyjoint.md#getratio)
## Constructors
### constructor
\+ **new PulleyJoint**(`def`: [PulleyJointDef](../interfaces/pulleyjointdef.md)): *[PulleyJoint](pulleyjoint.md)*
*Defined in [joint/index.d.ts:381](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L381)*
**Parameters:**
Name | Type |
------ | ------ |
`def` | [PulleyJointDef](../interfaces/pulleyjointdef.md) |
**Returns:** *[PulleyJoint](pulleyjoint.md)*
\+ **new PulleyJoint**(`def`: [PulleyJointOpt](../interfaces/pulleyjointopt.md), `bodyA`: [Body](body.md), `bodyB`: [Body](body.md), `groundA`: [Vec2](vec2.md), `groundB`: [Vec2](vec2.md), `anchorA`: [Vec2](vec2.md), `anchorB`: [Vec2](vec2.md), `ratio`: number): *[PulleyJoint](pulleyjoint.md)*
*Defined in [joint/index.d.ts:383](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L383)*
**Parameters:**
Name | Type |
------ | ------ |
`def` | [PulleyJointOpt](../interfaces/pulleyjointopt.md) |
`bodyA` | [Body](body.md) |
`bodyB` | [Body](body.md) |
`groundA` | [Vec2](vec2.md) |
`groundB` | [Vec2](vec2.md) |
`anchorA` | [Vec2](vec2.md) |
`anchorB` | [Vec2](vec2.md) |
`ratio` | number |
**Returns:** *[PulleyJoint](pulleyjoint.md)*
## Properties
### `Static` MIN_PULLEY_LENGTH
▪ **MIN_PULLEY_LENGTH**: *number*
*Defined in [joint/index.d.ts:381](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L381)*
___
### `Static` TYPE
▪ **TYPE**: *"pulley-joint"*
*Defined in [joint/index.d.ts:380](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L380)*
## Methods
### getCurrentLengthA
▸ **getCurrentLengthA**(): *number*
*Defined in [joint/index.d.ts:414](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L414)*
**Returns:** *number*
___
### getCurrentLengthB
▸ **getCurrentLengthB**(): *number*
*Defined in [joint/index.d.ts:415](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L415)*
**Returns:** *number*
___
### getGroundAnchorA
▸ **getGroundAnchorA**(): *[Vec2](vec2.md)*
*Defined in [joint/index.d.ts:409](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L409)*
**Returns:** *[Vec2](vec2.md)*
___
### getGroundAnchorB
▸ **getGroundAnchorB**(): *[Vec2](vec2.md)*
*Defined in [joint/index.d.ts:410](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L410)*
**Returns:** *[Vec2](vec2.md)*
___
### getLengthA
▸ **getLengthA**(): *number*
*Defined in [joint/index.d.ts:411](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L411)*
**Returns:** *number*
___
### getLengthB
▸ **getLengthB**(): *number*
*Defined in [joint/index.d.ts:412](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L412)*
**Returns:** *number*
___
### getRatio
▸ **getRatio**(): *number*
*Defined in [joint/index.d.ts:413](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L413)*
**Returns:** *number*

View File

@ -0,0 +1,314 @@
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [RevoluteJoint](revolutejoint.md)
# Class: RevoluteJoint
## Hierarchy
* any
↳ **RevoluteJoint**
## Callable
▸ **RevoluteJoint**(`def`: [RevoluteJointDef](../interfaces/revolutejointdef.md)): *[RevoluteJoint](revolutejoint.md)*
*Defined in [joint/index.d.ts:432](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L432)*
**Parameters:**
Name | Type |
------ | ------ |
`def` | [RevoluteJointDef](../interfaces/revolutejointdef.md) |
**Returns:** *[RevoluteJoint](revolutejoint.md)*
▸ **RevoluteJoint**(`def`: [RevoluteJointOpt](../interfaces/revolutejointopt.md), `bodyA`: [Body](body.md), `bodyB`: [Body](body.md), `anchor`: [Vec2](vec2.md)): *[RevoluteJoint](revolutejoint.md)*
*Defined in [joint/index.d.ts:433](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L433)*
**Parameters:**
Name | Type |
------ | ------ |
`def` | [RevoluteJointOpt](../interfaces/revolutejointopt.md) |
`bodyA` | [Body](body.md) |
`bodyB` | [Body](body.md) |
`anchor` | [Vec2](vec2.md) |
**Returns:** *[RevoluteJoint](revolutejoint.md)*
## Index
### Constructors
* [constructor](revolutejoint.md#constructor)
### Properties
* [TYPE](revolutejoint.md#static-type)
### Methods
* [enableLimit](revolutejoint.md#enablelimit)
* [enableMotor](revolutejoint.md#enablemotor)
* [getJointAngle](revolutejoint.md#getjointangle)
* [getJointSpeed](revolutejoint.md#getjointspeed)
* [getLocalAnchorA](revolutejoint.md#getlocalanchora)
* [getLocalAnchorB](revolutejoint.md#getlocalanchorb)
* [getLowerLimit](revolutejoint.md#getlowerlimit)
* [getMaxMotorTorque](revolutejoint.md#getmaxmotortorque)
* [getMotorSpeed](revolutejoint.md#getmotorspeed)
* [getMotorTorque](revolutejoint.md#getmotortorque)
* [getReferenceAngle](revolutejoint.md#getreferenceangle)
* [getUpperLimit](revolutejoint.md#getupperlimit)
* [isLimitEnabled](revolutejoint.md#islimitenabled)
* [isMotorEnabled](revolutejoint.md#ismotorenabled)
* [setLimits](revolutejoint.md#setlimits)
* [setMaxMotorTorque](revolutejoint.md#setmaxmotortorque)
* [setMotorSpeed](revolutejoint.md#setmotorspeed)
## Constructors
### constructor
\+ **new RevoluteJoint**(`def`: [RevoluteJointDef](../interfaces/revolutejointdef.md)): *[RevoluteJoint](revolutejoint.md)*
*Defined in [joint/index.d.ts:435](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L435)*
**Parameters:**
Name | Type |
------ | ------ |
`def` | [RevoluteJointDef](../interfaces/revolutejointdef.md) |
**Returns:** *[RevoluteJoint](revolutejoint.md)*
\+ **new RevoluteJoint**(`def`: [RevoluteJointOpt](../interfaces/revolutejointopt.md), `bodyA`: [Body](body.md), `bodyB`: [Body](body.md), `anchor`: [Vec2](vec2.md)): *[RevoluteJoint](revolutejoint.md)*
*Defined in [joint/index.d.ts:437](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L437)*
**Parameters:**
Name | Type |
------ | ------ |
`def` | [RevoluteJointOpt](../interfaces/revolutejointopt.md) |
`bodyA` | [Body](body.md) |
`bodyB` | [Body](body.md) |
`anchor` | [Vec2](vec2.md) |
**Returns:** *[RevoluteJoint](revolutejoint.md)*
## Properties
### `Static` TYPE
▪ **TYPE**: *"revolute-joint"*
*Defined in [joint/index.d.ts:435](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L435)*
## Methods
### enableLimit
▸ **enableLimit**(`flag`: boolean): *void*
*Defined in [joint/index.d.ts:481](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L481)*
**Parameters:**
Name | Type |
------ | ------ |
`flag` | boolean |
**Returns:** *void*
___
### enableMotor
▸ **enableMotor**(`flag`: boolean): *void*
*Defined in [joint/index.d.ts:474](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L474)*
**Parameters:**
Name | Type |
------ | ------ |
`flag` | boolean |
**Returns:** *void*
___
### getJointAngle
▸ **getJointAngle**(): *number*
*Defined in [joint/index.d.ts:471](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L471)*
**Returns:** *number*
___
### getJointSpeed
▸ **getJointSpeed**(): *number*
*Defined in [joint/index.d.ts:472](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L472)*
**Returns:** *number*
___
### getLocalAnchorA
▸ **getLocalAnchorA**(): *[Vec2](vec2.md)*
*Defined in [joint/index.d.ts:468](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L468)*
**Returns:** *[Vec2](vec2.md)*
___
### getLocalAnchorB
▸ **getLocalAnchorB**(): *[Vec2](vec2.md)*
*Defined in [joint/index.d.ts:469](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L469)*
**Returns:** *[Vec2](vec2.md)*
___
### getLowerLimit
▸ **getLowerLimit**(): *number*
*Defined in [joint/index.d.ts:482](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L482)*
**Returns:** *number*
___
### getMaxMotorTorque
▸ **getMaxMotorTorque**(): *number*
*Defined in [joint/index.d.ts:479](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L479)*
**Returns:** *number*
___
### getMotorSpeed
▸ **getMotorSpeed**(): *number*
*Defined in [joint/index.d.ts:477](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L477)*
**Returns:** *number*
___
### getMotorTorque
▸ **getMotorTorque**(`inv_dt`: number): *number*
*Defined in [joint/index.d.ts:475](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L475)*
**Parameters:**
Name | Type |
------ | ------ |
`inv_dt` | number |
**Returns:** *number*
___
### getReferenceAngle
▸ **getReferenceAngle**(): *number*
*Defined in [joint/index.d.ts:470](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L470)*
**Returns:** *number*
___
### getUpperLimit
▸ **getUpperLimit**(): *number*
*Defined in [joint/index.d.ts:483](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L483)*
**Returns:** *number*
___
### isLimitEnabled
▸ **isLimitEnabled**(): *boolean*
*Defined in [joint/index.d.ts:480](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L480)*
**Returns:** *boolean*
___
### isMotorEnabled
▸ **isMotorEnabled**(): *boolean*
*Defined in [joint/index.d.ts:473](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L473)*
**Returns:** *boolean*
___
### setLimits
▸ **setLimits**(`lower`: number, `upper`: number): *void*
*Defined in [joint/index.d.ts:484](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L484)*
**Parameters:**
Name | Type |
------ | ------ |
`lower` | number |
`upper` | number |
**Returns:** *void*
___
### setMaxMotorTorque
▸ **setMaxMotorTorque**(`torque`: number): *void*
*Defined in [joint/index.d.ts:478](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L478)*
**Parameters:**
Name | Type |
------ | ------ |
`torque` | number |
**Returns:** *void*
___
### setMotorSpeed
▸ **setMotorSpeed**(`speed`: number): *void*
*Defined in [joint/index.d.ts:476](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L476)*
**Parameters:**
Name | Type |
------ | ------ |
`speed` | number |
**Returns:** *void*

View File

@ -0,0 +1,151 @@
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [RopeJoint](ropejoint.md)
# Class: RopeJoint
## Hierarchy
* any
↳ **RopeJoint**
## Callable
▸ **RopeJoint**(`def`: [RopeJointDef](../interfaces/ropejointdef.md)): *[RopeJoint](ropejoint.md)*
*Defined in [joint/index.d.ts:502](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L502)*
**Parameters:**
Name | Type |
------ | ------ |
`def` | [RopeJointDef](../interfaces/ropejointdef.md) |
**Returns:** *[RopeJoint](ropejoint.md)*
▸ **RopeJoint**(`def`: [RopeJointOpt](../interfaces/ropejointopt.md), `bodyA`: [Body](body.md), `bodyB`: [Body](body.md), `anchor`: [Vec2](vec2.md)): *[RopeJoint](ropejoint.md)*
*Defined in [joint/index.d.ts:503](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L503)*
**Parameters:**
Name | Type |
------ | ------ |
`def` | [RopeJointOpt](../interfaces/ropejointopt.md) |
`bodyA` | [Body](body.md) |
`bodyB` | [Body](body.md) |
`anchor` | [Vec2](vec2.md) |
**Returns:** *[RopeJoint](ropejoint.md)*
## Index
### Constructors
* [constructor](ropejoint.md#constructor)
### Properties
* [TYPE](ropejoint.md#static-type)
### Methods
* [getLimitState](ropejoint.md#getlimitstate)
* [getLocalAnchorA](ropejoint.md#getlocalanchora)
* [getLocalAnchorB](ropejoint.md#getlocalanchorb)
* [getMaxLength](ropejoint.md#getmaxlength)
* [setMaxLength](ropejoint.md#setmaxlength)
## Constructors
### constructor
\+ **new RopeJoint**(`def`: [RopeJointDef](../interfaces/ropejointdef.md)): *[RopeJoint](ropejoint.md)*
*Defined in [joint/index.d.ts:505](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L505)*
**Parameters:**
Name | Type |
------ | ------ |
`def` | [RopeJointDef](../interfaces/ropejointdef.md) |
**Returns:** *[RopeJoint](ropejoint.md)*
\+ **new RopeJoint**(`def`: [RopeJointOpt](../interfaces/ropejointopt.md), `bodyA`: [Body](body.md), `bodyB`: [Body](body.md), `anchor`: [Vec2](vec2.md)): *[RopeJoint](ropejoint.md)*
*Defined in [joint/index.d.ts:507](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L507)*
**Parameters:**
Name | Type |
------ | ------ |
`def` | [RopeJointOpt](../interfaces/ropejointopt.md) |
`bodyA` | [Body](body.md) |
`bodyB` | [Body](body.md) |
`anchor` | [Vec2](vec2.md) |
**Returns:** *[RopeJoint](ropejoint.md)*
## Properties
### `Static` TYPE
▪ **TYPE**: *"rope-joint"*
*Defined in [joint/index.d.ts:505](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L505)*
## Methods
### getLimitState
▸ **getLimitState**(): *[LIMIT_STATE](../enums/limit_state.md)*
*Defined in [joint/index.d.ts:535](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L535)*
**Returns:** *[LIMIT_STATE](../enums/limit_state.md)*
___
### getLocalAnchorA
▸ **getLocalAnchorA**(): *[Vec2](vec2.md)*
*Defined in [joint/index.d.ts:531](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L531)*
**Returns:** *[Vec2](vec2.md)*
___
### getLocalAnchorB
▸ **getLocalAnchorB**(): *[Vec2](vec2.md)*
*Defined in [joint/index.d.ts:532](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L532)*
**Returns:** *[Vec2](vec2.md)*
___
### getMaxLength
▸ **getMaxLength**(): *number*
*Defined in [joint/index.d.ts:534](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L534)*
**Returns:** *number*
___
### setMaxLength
▸ **setMaxLength**(`length`: number): *void*
*Defined in [joint/index.d.ts:533](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L533)*
**Parameters:**
Name | Type |
------ | ------ |
`length` | number |
**Returns:** *void*

396
docs/api/classes/rot.md Normal file
View File

@ -0,0 +1,396 @@
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [Rot](rot.md)
# Class: Rot
## Hierarchy
* **Rot**
## Callable
▸ **Rot**(`angle`: number): *[Rot](rot.md)*
*Defined in [common/index.d.ts:159](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L159)*
**Parameters:**
Name | Type |
------ | ------ |
`angle` | number |
**Returns:** *[Rot](rot.md)*
▸ **Rot**(`rot`: [Rot](rot.md)): *[Rot](rot.md)*
*Defined in [common/index.d.ts:160](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L160)*
**Parameters:**
Name | Type |
------ | ------ |
`rot` | [Rot](rot.md) |
**Returns:** *[Rot](rot.md)*
▸ **Rot**(): *[Rot](rot.md)*
*Defined in [common/index.d.ts:161](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L161)*
**Returns:** *[Rot](rot.md)*
## Index
### Constructors
* [constructor](rot.md#constructor)
### Properties
* [c](rot.md#c)
* [s](rot.md#s)
### Methods
* [getAngle](rot.md#getangle)
* [getXAxis](rot.md#getxaxis)
* [getYAxis](rot.md#getyaxis)
* [set](rot.md#set)
* [setAngle](rot.md#setangle)
* [setIdentity](rot.md#setidentity)
* [assert](rot.md#static-assert)
* [clone](rot.md#static-clone)
* [identity](rot.md#static-identity)
* [isValid](rot.md#static-isvalid)
* [mul](rot.md#static-mul)
* [mulRot](rot.md#static-mulrot)
* [mulSub](rot.md#static-mulsub)
* [mulT](rot.md#static-mult)
* [mulTRot](rot.md#static-multrot)
* [mulTVec2](rot.md#static-multvec2)
* [mulVec2](rot.md#static-mulvec2)
## Constructors
### constructor
\+ **new Rot**(`angle`: number): *[Rot](rot.md)*
*Defined in [common/index.d.ts:171](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L171)*
**Parameters:**
Name | Type |
------ | ------ |
`angle` | number |
**Returns:** *[Rot](rot.md)*
\+ **new Rot**(`rot`: [Rot](rot.md)): *[Rot](rot.md)*
*Defined in [common/index.d.ts:173](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L173)*
**Parameters:**
Name | Type |
------ | ------ |
`rot` | [Rot](rot.md) |
**Returns:** *[Rot](rot.md)*
\+ **new Rot**(): *[Rot](rot.md)*
*Defined in [common/index.d.ts:174](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L174)*
**Returns:** *[Rot](rot.md)*
## Properties
### c
• **c**: *number*
*Defined in [common/index.d.ts:164](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L164)*
___
### s
• **s**: *number*
*Defined in [common/index.d.ts:163](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L163)*
## Methods
### getAngle
▸ **getAngle**(): *number*
*Defined in [common/index.d.ts:169](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L169)*
**Returns:** *number*
___
### getXAxis
▸ **getXAxis**(): *[Vec2](vec2.md)*
*Defined in [common/index.d.ts:170](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L170)*
**Returns:** *[Vec2](vec2.md)*
___
### getYAxis
▸ **getYAxis**(): *[Vec2](vec2.md)*
*Defined in [common/index.d.ts:171](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L171)*
**Returns:** *[Vec2](vec2.md)*
___
### set
▸ **set**(`angle`: number | [Rot](rot.md)): *void*
*Defined in [common/index.d.ts:167](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L167)*
**Parameters:**
Name | Type |
------ | ------ |
`angle` | number &#124; [Rot](rot.md) |
**Returns:** *void*
___
### setAngle
▸ **setAngle**(`angle`: number): *void*
*Defined in [common/index.d.ts:168](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L168)*
**Parameters:**
Name | Type |
------ | ------ |
`angle` | number |
**Returns:** *void*
___
### setIdentity
▸ **setIdentity**(): *void*
*Defined in [common/index.d.ts:166](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L166)*
**Returns:** *void*
___
### `Static` assert
▸ **assert**(`o`: any): *void*
*Defined in [common/index.d.ts:181](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L181)*
**Parameters:**
Name | Type |
------ | ------ |
`o` | any |
**Returns:** *void*
___
### `Static` clone
▸ **clone**(`rot`: [Rot](rot.md)): *[Rot](rot.md)*
*Defined in [common/index.d.ts:178](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L178)*
**Parameters:**
Name | Type |
------ | ------ |
`rot` | [Rot](rot.md) |
**Returns:** *[Rot](rot.md)*
___
### `Static` identity
▸ **identity**(): *[Rot](rot.md)*
*Defined in [common/index.d.ts:179](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L179)*
**Returns:** *[Rot](rot.md)*
___
### `Static` isValid
▸ **isValid**(`o`: any): *boolean*
*Defined in [common/index.d.ts:180](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L180)*
**Parameters:**
Name | Type |
------ | ------ |
`o` | any |
**Returns:** *boolean*
___
### `Static` mul
▸ **mul**(`rot`: [Rot](rot.md), `m`: [Rot](rot.md)): *[Rot](rot.md)*
*Defined in [common/index.d.ts:182](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L182)*
**Parameters:**
Name | Type |
------ | ------ |
`rot` | [Rot](rot.md) |
`m` | [Rot](rot.md) |
**Returns:** *[Rot](rot.md)*
▸ **mul**(`rot`: [Rot](rot.md), `m`: [Vec2](vec2.md)): *[Vec2](vec2.md)*
*Defined in [common/index.d.ts:183](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L183)*
**Parameters:**
Name | Type |
------ | ------ |
`rot` | [Rot](rot.md) |
`m` | [Vec2](vec2.md) |
**Returns:** *[Vec2](vec2.md)*
___
### `Static` mulRot
▸ **mulRot**(`rot`: [Rot](rot.md), `m`: [Rot](rot.md)): *[Rot](rot.md)*
*Defined in [common/index.d.ts:184](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L184)*
**Parameters:**
Name | Type |
------ | ------ |
`rot` | [Rot](rot.md) |
`m` | [Rot](rot.md) |
**Returns:** *[Rot](rot.md)*
___
### `Static` mulSub
▸ **mulSub**(`rot`: [Rot](rot.md), `v`: [Vec2](vec2.md), `w`: [Vec2](vec2.md)): *[Vec2](vec2.md)*
*Defined in [common/index.d.ts:186](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L186)*
**Parameters:**
Name | Type |
------ | ------ |
`rot` | [Rot](rot.md) |
`v` | [Vec2](vec2.md) |
`w` | [Vec2](vec2.md) |
**Returns:** *[Vec2](vec2.md)*
___
### `Static` mulT
▸ **mulT**(`rot`: [Rot](rot.md), `m`: [Rot](rot.md)): *[Rot](rot.md)*
*Defined in [common/index.d.ts:187](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L187)*
**Parameters:**
Name | Type |
------ | ------ |
`rot` | [Rot](rot.md) |
`m` | [Rot](rot.md) |
**Returns:** *[Rot](rot.md)*
▸ **mulT**(`rot`: [Rot](rot.md), `m`: [Vec2](vec2.md)): *[Vec2](vec2.md)*
*Defined in [common/index.d.ts:188](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L188)*
**Parameters:**
Name | Type |
------ | ------ |
`rot` | [Rot](rot.md) |
`m` | [Vec2](vec2.md) |
**Returns:** *[Vec2](vec2.md)*
___
### `Static` mulTRot
▸ **mulTRot**(`rot`: [Rot](rot.md), `m`: [Rot](rot.md)): *[Rot](rot.md)*
*Defined in [common/index.d.ts:189](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L189)*
**Parameters:**
Name | Type |
------ | ------ |
`rot` | [Rot](rot.md) |
`m` | [Rot](rot.md) |
**Returns:** *[Rot](rot.md)*
___
### `Static` mulTVec2
▸ **mulTVec2**(`rot`: [Rot](rot.md), `m`: [Vec2](vec2.md)): *[Vec2](vec2.md)*
*Defined in [common/index.d.ts:190](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L190)*
**Parameters:**
Name | Type |
------ | ------ |
`rot` | [Rot](rot.md) |
`m` | [Vec2](vec2.md) |
**Returns:** *[Vec2](vec2.md)*
___
### `Static` mulVec2
▸ **mulVec2**(`rot`: [Rot](rot.md), `m`: [Vec2](vec2.md)): *[Vec2](vec2.md)*
*Defined in [common/index.d.ts:185](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L185)*
**Parameters:**
Name | Type |
------ | ------ |
`rot` | [Rot](rot.md) |
`m` | [Vec2](vec2.md) |
**Returns:** *[Vec2](vec2.md)*

View File

@ -0,0 +1,305 @@
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [Settings](settings.md)
# Class: Settings
Tuning constants based on meters-kilograms-seconds (MKS) units.
## Hierarchy
* **Settings**
## Index
### Properties
* [aabbExtension](settings.md#aabbextension)
* [aabbMultiplier](settings.md#aabbmultiplier)
* [angularSleepTolerance](settings.md#angularsleeptolerance)
* [angularSleepToleranceSqr](settings.md#angularsleeptolerancesqr)
* [angularSlop](settings.md#angularslop)
* [baumgarte](settings.md#baumgarte)
* [linearSleepTolerance](settings.md#linearsleeptolerance)
* [linearSleepToleranceSqr](settings.md#linearsleeptolerancesqr)
* [linearSlop](settings.md#linearslop)
* [linearSlopSquared](settings.md#linearslopsquared)
* [maxAngularCorrection](settings.md#maxangularcorrection)
* [maxDistnceIterations](settings.md#maxdistnceiterations)
* [maxLinearCorrection](settings.md#maxlinearcorrection)
* [maxManifoldPoints](settings.md#maxmanifoldpoints)
* [maxPolygonVertices](settings.md#maxpolygonvertices)
* [maxRotation](settings.md#maxrotation)
* [maxRotationSquared](settings.md#maxrotationsquared)
* [maxSubSteps](settings.md#maxsubsteps)
* [maxTOIContacts](settings.md#maxtoicontacts)
* [maxTOIIterations](settings.md#maxtoiiterations)
* [maxTranslation](settings.md#maxtranslation)
* [maxTranslationSquared](settings.md#maxtranslationsquared)
* [polygonRadius](settings.md#polygonradius)
* [timeToSleep](settings.md#timetosleep)
* [toiBaugarte](settings.md#toibaugarte)
* [velocityThreshold](settings.md#velocitythreshold)
## Properties
### aabbExtension
• **aabbExtension**: *number*
*Defined in [index.d.ts:553](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L553)*
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
• **aabbMultiplier**: *number*
*Defined in [index.d.ts:560](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L560)*
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
• **angularSleepTolerance**: *number*
*Defined in [index.d.ts:661](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L661)*
A body cannot sleep if its angular velocity is above this tolerance.
___
### angularSleepToleranceSqr
• **angularSleepToleranceSqr**: *number*
*Defined in [index.d.ts:662](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L662)*
___
### angularSlop
• **angularSlop**: *number*
*Defined in [index.d.ts:573](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L573)*
A small angle used as a collision and constraint tolerance. Usually it is
chosen to be numerically significant, but visually insignificant.
___
### baumgarte
• **baumgarte**: *number*
*Defined in [index.d.ts:642](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L642)*
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.
___
### linearSleepTolerance
• **linearSleepTolerance**: *number*
*Defined in [index.d.ts:655](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L655)*
A body cannot sleep if its linear velocity is above this tolerance.
___
### linearSleepToleranceSqr
• **linearSleepToleranceSqr**: *number*
*Defined in [index.d.ts:656](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L656)*
___
### linearSlop
• **linearSlop**: *number*
*Defined in [index.d.ts:566](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L566)*
A small length used as a collision and constraint tolerance. Usually it is
chosen to be numerically significant, but visually insignificant.
___
### linearSlopSquared
• **linearSlopSquared**: *number*
*Defined in [index.d.ts:567](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L567)*
___
### maxAngularCorrection
• **maxAngularCorrection**: *number*
*Defined in [index.d.ts:621](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L621)*
The maximum angular position correction used when solving constraints. This
helps to prevent overshoot.
___
### maxDistnceIterations
• **maxDistnceIterations**: *number*
*Defined in [index.d.ts:603](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L603)*
Maximum iterations to find Distance.
___
### maxLinearCorrection
• **maxLinearCorrection**: *number*
*Defined in [index.d.ts:615](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L615)*
The maximum linear position correction used when solving constraints. This
helps to prevent overshoot.
___
### maxManifoldPoints
• **maxManifoldPoints**: *number*
*Defined in [index.d.ts:541](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L541)*
The maximum number of contact points between two convex shapes. Do not change
this value.
___
### maxPolygonVertices
• **maxPolygonVertices**: *number*
*Defined in [index.d.ts:547](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L547)*
The maximum number of vertices on a convex polygon. You cannot increase this
too much because BlockAllocator has a maximum object size.
___
### maxRotation
• **maxRotation**: *number*
*Defined in [index.d.ts:634](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L634)*
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 this.
___
### maxRotationSquared
• **maxRotationSquared**: *number*
*Defined in [index.d.ts:635](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L635)*
___
### maxSubSteps
• **maxSubSteps**: *number*
*Defined in [index.d.ts:586](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L586)*
Maximum number of sub-steps per contact in continuous physics simulation.
___
### maxTOIContacts
• **maxTOIContacts**: *number*
*Defined in [index.d.ts:593](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L593)*
Maximum number of contacts to be handled to solve a TOI impact.
___
### maxTOIIterations
• **maxTOIIterations**: *number*
*Defined in [index.d.ts:598](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L598)*
Maximum iterations to solve a TOI.
___
### maxTranslation
• **maxTranslation**: *number*
*Defined in [index.d.ts:627](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L627)*
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 this.
___
### maxTranslationSquared
• **maxTranslationSquared**: *number*
*Defined in [index.d.ts:628](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L628)*
___
### polygonRadius
• **polygonRadius**: *number*
*Defined in [index.d.ts:581](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L581)*
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.
___
### timeToSleep
• **timeToSleep**: *number*
*Defined in [index.d.ts:650](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L650)*
The time that a body must be still before it will go to sleep.
___
### toiBaugarte
• **toiBaugarte**: *number*
*Defined in [index.d.ts:643](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L643)*
___
### velocityThreshold
• **velocityThreshold**: *number*
*Defined in [index.d.ts:609](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L609)*
A velocity threshold for elastic collisions. Any collision with a relative
linear velocity below this threshold will be treated as inelastic.

154
docs/api/classes/shape.md Normal file
View File

@ -0,0 +1,154 @@
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [Shape](shape.md)
# Class: Shape
## Hierarchy
* **Shape**
## Index
### Methods
* [computeAABB](shape.md#computeaabb)
* [computeDistanceProxy](shape.md#computedistanceproxy)
* [computeMass](shape.md#computemass)
* [getChildCount](shape.md#getchildcount)
* [getRadius](shape.md#getradius)
* [getType](shape.md#gettype)
* [isValid](shape.md#isvalid)
* [rayCast](shape.md#raycast)
* [testPoint](shape.md#testpoint)
## Methods
### computeAABB
▸ **computeAABB**(`aabb`: [AABB](aabb.md), `xf`: [Transform](transform.md), `childIndex?`: number): *void*
*Defined in [shape/index.d.ts:18](https://github.com/shakiba/planck.js/blob/038d425/lib/shape/index.d.ts#L18)*
**Parameters:**
Name | Type |
------ | ------ |
`aabb` | [AABB](aabb.md) |
`xf` | [Transform](transform.md) |
`childIndex?` | number |
**Returns:** *void*
___
### computeDistanceProxy
▸ **computeDistanceProxy**(`proxy`: [DistanceProxy](distanceproxy.md)): *void*
*Defined in [shape/index.d.ts:20](https://github.com/shakiba/planck.js/blob/038d425/lib/shape/index.d.ts#L20)*
**Parameters:**
Name | Type |
------ | ------ |
`proxy` | [DistanceProxy](distanceproxy.md) |
**Returns:** *void*
___
### computeMass
▸ **computeMass**(`massData`: [MassData](../interfaces/massdata.md), `density?`: number): *void*
*Defined in [shape/index.d.ts:19](https://github.com/shakiba/planck.js/blob/038d425/lib/shape/index.d.ts#L19)*
**Parameters:**
Name | Type |
------ | ------ |
`massData` | [MassData](../interfaces/massdata.md) |
`density?` | number |
**Returns:** *void*
___
### getChildCount
▸ **getChildCount**(): *number*
*Defined in [shape/index.d.ts:15](https://github.com/shakiba/planck.js/blob/038d425/lib/shape/index.d.ts#L15)*
**Returns:** *number*
___
### getRadius
▸ **getRadius**(): *number*
*Defined in [shape/index.d.ts:13](https://github.com/shakiba/planck.js/blob/038d425/lib/shape/index.d.ts#L13)*
**Returns:** *number*
___
### getType
▸ **getType**(): *[ShapeType](../globals.md#shapetype)*
*Defined in [shape/index.d.ts:14](https://github.com/shakiba/planck.js/blob/038d425/lib/shape/index.d.ts#L14)*
**Returns:** *[ShapeType](../globals.md#shapetype)*
___
### isValid
▸ **isValid**(`shape`: any): *boolean*
*Defined in [shape/index.d.ts:12](https://github.com/shakiba/planck.js/blob/038d425/lib/shape/index.d.ts#L12)*
**Parameters:**
Name | Type |
------ | ------ |
`shape` | any |
**Returns:** *boolean*
___
### rayCast
▸ **rayCast**(`output`: [RayCastOutput](../interfaces/raycastoutput.md), `input`: [RayCastInput](../interfaces/raycastinput.md), `xf`: [Transform](transform.md), `childIndex?`: number): *boolean*
*Defined in [shape/index.d.ts:17](https://github.com/shakiba/planck.js/blob/038d425/lib/shape/index.d.ts#L17)*
**Parameters:**
Name | Type |
------ | ------ |
`output` | [RayCastOutput](../interfaces/raycastoutput.md) |
`input` | [RayCastInput](../interfaces/raycastinput.md) |
`xf` | [Transform](transform.md) |
`childIndex?` | number |
**Returns:** *boolean*
___
### testPoint
▸ **testPoint**(`xf`: [Transform](transform.md), `p`: [Vec2](vec2.md)): *false*
*Defined in [shape/index.d.ts:16](https://github.com/shakiba/planck.js/blob/038d425/lib/shape/index.d.ts#L16)*
**Parameters:**
Name | Type |
------ | ------ |
`xf` | [Transform](transform.md) |
`p` | [Vec2](vec2.md) |
**Returns:** *false*

View File

@ -0,0 +1,7 @@
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [Solver](solver.md)
# Class: Solver
## Hierarchy
* **Solver**

189
docs/api/classes/sweep.md Normal file
View File

@ -0,0 +1,189 @@
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [Sweep](sweep.md)
# Class: Sweep
## Hierarchy
* **Sweep**
## Index
### Properties
* [a](sweep.md#a)
* [a0](sweep.md#a0)
* [alpha0](sweep.md#alpha0)
* [c](sweep.md#c)
* [c0](sweep.md#c0)
* [localCenter](sweep.md#localcenter)
### Methods
* [advance](sweep.md#advance)
* [clone](sweep.md#clone)
* [forward](sweep.md#forward)
* [getTransform](sweep.md#gettransform)
* [normalize](sweep.md#normalize)
* [set](sweep.md#set)
* [setLocalCenter](sweep.md#setlocalcenter)
* [setTransform](sweep.md#settransform)
## Properties
### a
• **a**: *number*
*Defined in [common/index.d.ts:251](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L251)*
___
### a0
• **a0**: *number*
*Defined in [common/index.d.ts:254](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L254)*
___
### alpha0
• **alpha0**: *number*
*Defined in [common/index.d.ts:252](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L252)*
___
### c
• **c**: *[Vec2](vec2.md)*
*Defined in [common/index.d.ts:250](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L250)*
___
### c0
• **c0**: *[Vec2](vec2.md)*
*Defined in [common/index.d.ts:253](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L253)*
___
### localCenter
• **localCenter**: *[Vec2](vec2.md)*
*Defined in [common/index.d.ts:249](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L249)*
## Methods
### advance
▸ **advance**(`alpha`: number): *void*
*Defined in [common/index.d.ts:259](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L259)*
**Parameters:**
Name | Type |
------ | ------ |
`alpha` | number |
**Returns:** *void*
___
### clone
▸ **clone**(): *[Sweep](sweep.md)*
*Defined in [common/index.d.ts:262](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L262)*
**Returns:** *[Sweep](sweep.md)*
___
### forward
▸ **forward**(): *void*
*Defined in [common/index.d.ts:260](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L260)*
**Returns:** *void*
___
### getTransform
▸ **getTransform**(`xf`: [Transform](transform.md), `beta`: number): *void*
*Defined in [common/index.d.ts:258](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L258)*
**Parameters:**
Name | Type |
------ | ------ |
`xf` | [Transform](transform.md) |
`beta` | number |
**Returns:** *void*
___
### normalize
▸ **normalize**(): *void*
*Defined in [common/index.d.ts:261](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L261)*
**Returns:** *void*
___
### set
▸ **set**(`sweep`: [Sweep](sweep.md)): *void*
*Defined in [common/index.d.ts:263](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L263)*
**Parameters:**
Name | Type |
------ | ------ |
`sweep` | [Sweep](sweep.md) |
**Returns:** *void*
___
### setLocalCenter
▸ **setLocalCenter**(`localCenter`: [Vec2](vec2.md), `xf`: [Transform](transform.md)): *void*
*Defined in [common/index.d.ts:257](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L257)*
**Parameters:**
Name | Type |
------ | ------ |
`localCenter` | [Vec2](vec2.md) |
`xf` | [Transform](transform.md) |
**Returns:** *void*
___
### setTransform
▸ **setTransform**(`xf`: [Transform](transform.md)): *void*
*Defined in [common/index.d.ts:256](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L256)*
**Parameters:**
Name | Type |
------ | ------ |
`xf` | [Transform](transform.md) |
**Returns:** *void*

View File

@ -0,0 +1,344 @@
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [Transform](transform.md)
# Class: Transform
## Hierarchy
* **Transform**
## Callable
▸ **Transform**(`position`: [Vec2](vec2.md), `rotation`: number): *[Transform](transform.md)*
*Defined in [common/index.d.ts:126](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L126)*
**Parameters:**
Name | Type |
------ | ------ |
`position` | [Vec2](vec2.md) |
`rotation` | number |
**Returns:** *[Transform](transform.md)*
▸ **Transform**(): *[Transform](transform.md)*
*Defined in [common/index.d.ts:127](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L127)*
**Returns:** *[Transform](transform.md)*
## Index
### Constructors
* [constructor](transform.md#constructor)
### Properties
* [p](transform.md#p)
* [q](transform.md#q)
### Methods
* [set](transform.md#set)
* [setIdentity](transform.md#setidentity)
* [assert](transform.md#static-assert)
* [clone](transform.md#static-clone)
* [identity](transform.md#static-identity)
* [isValid](transform.md#static-isvalid)
* [mul](transform.md#static-mul)
* [mulT](transform.md#static-mult)
* [mulTVec2](transform.md#static-multvec2)
* [mulTXf](transform.md#static-multxf)
* [mulVec2](transform.md#static-mulvec2)
* [mulXf](transform.md#static-mulxf)
## Constructors
### constructor
\+ **new Transform**(`position`: [Vec2](vec2.md), `rotation`: number): *[Transform](transform.md)*
*Defined in [common/index.d.ts:134](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L134)*
**Parameters:**
Name | Type |
------ | ------ |
`position` | [Vec2](vec2.md) |
`rotation` | number |
**Returns:** *[Transform](transform.md)*
\+ **new Transform**(): *[Transform](transform.md)*
*Defined in [common/index.d.ts:136](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L136)*
**Returns:** *[Transform](transform.md)*
## Properties
### p
• **p**: *[Vec2](vec2.md)*
*Defined in [common/index.d.ts:129](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L129)*
___
### q
• **q**: *[Rot](rot.md)*
*Defined in [common/index.d.ts:130](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L130)*
## Methods
### set
▸ **set**(`position`: [Vec2](vec2.md), `rotation`: number): *void*
*Defined in [common/index.d.ts:133](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L133)*
**Parameters:**
Name | Type |
------ | ------ |
`position` | [Vec2](vec2.md) |
`rotation` | number |
**Returns:** *void*
▸ **set**(`xf`: [Transform](transform.md)): *void*
*Defined in [common/index.d.ts:134](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L134)*
**Parameters:**
Name | Type |
------ | ------ |
`xf` | [Transform](transform.md) |
**Returns:** *void*
___
### setIdentity
▸ **setIdentity**(): *void*
*Defined in [common/index.d.ts:132](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L132)*
**Returns:** *void*
___
### `Static` assert
▸ **assert**(`o`: any): *void*
*Defined in [common/index.d.ts:143](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L143)*
**Parameters:**
Name | Type |
------ | ------ |
`o` | any |
**Returns:** *void*
___
### `Static` clone
▸ **clone**(`xf`: [Transform](transform.md)): *[Transform](transform.md)*
*Defined in [common/index.d.ts:139](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L139)*
**Parameters:**
Name | Type |
------ | ------ |
`xf` | [Transform](transform.md) |
**Returns:** *[Transform](transform.md)*
___
### `Static` identity
▸ **identity**(): *[Transform](transform.md)*
*Defined in [common/index.d.ts:141](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L141)*
**Returns:** *[Transform](transform.md)*
___
### `Static` isValid
▸ **isValid**(`o`: any): *boolean*
*Defined in [common/index.d.ts:142](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L142)*
**Parameters:**
Name | Type |
------ | ------ |
`o` | any |
**Returns:** *boolean*
___
### `Static` mul
▸ **mul**(`a`: [Transform](transform.md), `b`: [Vec2](vec2.md)): *[Vec2](vec2.md)*
*Defined in [common/index.d.ts:144](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L144)*
**Parameters:**
Name | Type |
------ | ------ |
`a` | [Transform](transform.md) |
`b` | [Vec2](vec2.md) |
**Returns:** *[Vec2](vec2.md)*
▸ **mul**(`a`: [Transform](transform.md), `b`: [Transform](transform.md)): *[Transform](transform.md)*
*Defined in [common/index.d.ts:145](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L145)*
**Parameters:**
Name | Type |
------ | ------ |
`a` | [Transform](transform.md) |
`b` | [Transform](transform.md) |
**Returns:** *[Transform](transform.md)*
▸ **mul**(`a`: [Transform](transform.md), `b`: [Vec2](vec2.md)[]): *[Vec2](vec2.md)[]*
*Defined in [common/index.d.ts:146](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L146)*
**Parameters:**
Name | Type |
------ | ------ |
`a` | [Transform](transform.md) |
`b` | [Vec2](vec2.md)[] |
**Returns:** *[Vec2](vec2.md)[]*
▸ **mul**(`a`: [Transform](transform.md), `b`: [Transform](transform.md)[]): *[Transform](transform.md)[]*
*Defined in [common/index.d.ts:147](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L147)*
**Parameters:**
Name | Type |
------ | ------ |
`a` | [Transform](transform.md) |
`b` | [Transform](transform.md)[] |
**Returns:** *[Transform](transform.md)[]*
___
### `Static` mulT
▸ **mulT**(`a`: [Transform](transform.md), `b`: [Vec2](vec2.md)): *[Vec2](vec2.md)*
*Defined in [common/index.d.ts:153](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L153)*
**Parameters:**
Name | Type |
------ | ------ |
`a` | [Transform](transform.md) |
`b` | [Vec2](vec2.md) |
**Returns:** *[Vec2](vec2.md)*
▸ **mulT**(`a`: [Transform](transform.md), `b`: [Transform](transform.md)): *[Transform](transform.md)*
*Defined in [common/index.d.ts:154](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L154)*
**Parameters:**
Name | Type |
------ | ------ |
`a` | [Transform](transform.md) |
`b` | [Transform](transform.md) |
**Returns:** *[Transform](transform.md)*
___
### `Static` mulTVec2
▸ **mulTVec2**(`a`: [Transform](transform.md), `b`: [Vec2](vec2.md)): *[Vec2](vec2.md)*
*Defined in [common/index.d.ts:155](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L155)*
**Parameters:**
Name | Type |
------ | ------ |
`a` | [Transform](transform.md) |
`b` | [Vec2](vec2.md) |
**Returns:** *[Vec2](vec2.md)*
___
### `Static` mulTXf
▸ **mulTXf**(`a`: [Transform](transform.md), `b`: [Transform](transform.md)): *[Transform](transform.md)*
*Defined in [common/index.d.ts:156](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L156)*
**Parameters:**
Name | Type |
------ | ------ |
`a` | [Transform](transform.md) |
`b` | [Transform](transform.md) |
**Returns:** *[Transform](transform.md)*
___
### `Static` mulVec2
▸ **mulVec2**(`a`: [Transform](transform.md), `b`: [Vec2](vec2.md)): *[Vec2](vec2.md)*
*Defined in [common/index.d.ts:151](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L151)*
**Parameters:**
Name | Type |
------ | ------ |
`a` | [Transform](transform.md) |
`b` | [Vec2](vec2.md) |
**Returns:** *[Vec2](vec2.md)*
___
### `Static` mulXf
▸ **mulXf**(`a`: [Transform](transform.md), `b`: [Transform](transform.md)): *[Transform](transform.md)*
*Defined in [common/index.d.ts:152](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L152)*
**Parameters:**
Name | Type |
------ | ------ |
`a` | [Transform](transform.md) |
`b` | [Transform](transform.md) |
**Returns:** *[Transform](transform.md)*

View File

@ -0,0 +1,75 @@
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [TreeNode](treenode.md)
# Class: TreeNode
## Hierarchy
* **TreeNode**
## Index
### Properties
* [aabb](treenode.md#aabb)
* [child1](treenode.md#child1)
* [child2](treenode.md#child2)
* [height](treenode.md#height)
* [id](treenode.md#id)
* [parent](treenode.md#parent)
* [userData](treenode.md#userdata)
## Properties
### aabb
• **aabb**: *[AABB](aabb.md)*
*Defined in [collision/index.d.ts:63](https://github.com/shakiba/planck.js/blob/038d425/lib/collision/index.d.ts#L63)*
___
### child1
• **child1**: *[TreeNode](treenode.md)*
*Defined in [collision/index.d.ts:66](https://github.com/shakiba/planck.js/blob/038d425/lib/collision/index.d.ts#L66)*
___
### child2
• **child2**: *[TreeNode](treenode.md)*
*Defined in [collision/index.d.ts:67](https://github.com/shakiba/planck.js/blob/038d425/lib/collision/index.d.ts#L67)*
___
### height
• **height**: *number*
*Defined in [collision/index.d.ts:68](https://github.com/shakiba/planck.js/blob/038d425/lib/collision/index.d.ts#L68)*
___
### id
• **id**: *number*
*Defined in [collision/index.d.ts:62](https://github.com/shakiba/planck.js/blob/038d425/lib/collision/index.d.ts#L62)*
___
### parent
• **parent**: *[TreeNode](treenode.md)*
*Defined in [collision/index.d.ts:65](https://github.com/shakiba/planck.js/blob/038d425/lib/collision/index.d.ts#L65)*
___
### userData
• **userData**: *any*
*Defined in [collision/index.d.ts:64](https://github.com/shakiba/planck.js/blob/038d425/lib/collision/index.d.ts#L64)*

855
docs/api/classes/vec2.md Normal file
View File

@ -0,0 +1,855 @@
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [Vec2](vec2.md)
# Class: Vec2
## Hierarchy
* **Vec2**
## Callable
▸ **Vec2**(`x`: number, `y`: number): *[Vec2](vec2.md)*
*Defined in [common/index.d.ts:30](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L30)*
**Parameters:**
Name | Type |
------ | ------ |
`x` | number |
`y` | number |
**Returns:** *[Vec2](vec2.md)*
▸ **Vec2**(`obj`: object): *[Vec2](vec2.md)*
*Defined in [common/index.d.ts:31](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L31)*
**Parameters:**
▪ **obj**: *object*
Name | Type |
------ | ------ |
`x` | number |
`y` | number |
**Returns:** *[Vec2](vec2.md)*
▸ **Vec2**(): *[Vec2](vec2.md)*
*Defined in [common/index.d.ts:32](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L32)*
**Returns:** *[Vec2](vec2.md)*
## Index
### Constructors
* [constructor](vec2.md#constructor)
### Properties
* [x](vec2.md#x)
* [y](vec2.md#y)
### Methods
* [add](vec2.md#add)
* [addCombine](vec2.md#addcombine)
* [addMul](vec2.md#addmul)
* [clamp](vec2.md#clamp)
* [clone](vec2.md#clone)
* [length](vec2.md#length)
* [lengthSquared](vec2.md#lengthsquared)
* [mul](vec2.md#mul)
* [neg](vec2.md#neg)
* [normalize](vec2.md#normalize)
* [set](vec2.md#set)
* [setCombine](vec2.md#setcombine)
* [setMul](vec2.md#setmul)
* [setZero](vec2.md#setzero)
* [sub](vec2.md#sub)
* [subCombine](vec2.md#subcombine)
* [subMul](vec2.md#submul)
* [toString](vec2.md#tostring)
* [abs](vec2.md#static-abs)
* [add](vec2.md#static-add)
* [addCross](vec2.md#static-addcross)
* [areEqual](vec2.md#static-areequal)
* [assert](vec2.md#static-assert)
* [clamp](vec2.md#static-clamp)
* [clone](vec2.md#static-clone)
* [combine](vec2.md#static-combine)
* [cross](vec2.md#static-cross)
* [distance](vec2.md#static-distance)
* [distanceSquared](vec2.md#static-distancesquared)
* [dot](vec2.md#static-dot)
* [isValid](vec2.md#static-isvalid)
* [lengthOf](vec2.md#static-lengthof)
* [lengthSquared](vec2.md#static-lengthsquared)
* [lower](vec2.md#static-lower)
* [mid](vec2.md#static-mid)
* [mul](vec2.md#static-mul)
* [neg](vec2.md#static-neg)
* [skew](vec2.md#static-skew)
* [sub](vec2.md#static-sub)
* [upper](vec2.md#static-upper)
* [zero](vec2.md#static-zero)
## Constructors
### constructor
\+ **new Vec2**(`x`: number, `y`: number): *[Vec2](vec2.md)*
*Defined in [common/index.d.ts:55](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L55)*
**Parameters:**
Name | Type |
------ | ------ |
`x` | number |
`y` | number |
**Returns:** *[Vec2](vec2.md)*
\+ **new Vec2**(`obj`: object): *[Vec2](vec2.md)*
*Defined in [common/index.d.ts:57](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L57)*
**Parameters:**
▪ **obj**: *object*
Name | Type |
------ | ------ |
`x` | number |
`y` | number |
**Returns:** *[Vec2](vec2.md)*
\+ **new Vec2**(): *[Vec2](vec2.md)*
*Defined in [common/index.d.ts:58](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L58)*
**Returns:** *[Vec2](vec2.md)*
## Properties
### x
• **x**: *number*
*Defined in [common/index.d.ts:34](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L34)*
___
### y
• **y**: *number*
*Defined in [common/index.d.ts:35](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L35)*
## Methods
### add
▸ **add**(`w`: [Vec2](vec2.md)): *[Vec2](vec2.md)*
*Defined in [common/index.d.ts:44](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L44)*
**Parameters:**
Name | Type |
------ | ------ |
`w` | [Vec2](vec2.md) |
**Returns:** *[Vec2](vec2.md)*
___
### addCombine
▸ **addCombine**(`a`: number, `v`: [Vec2](vec2.md), `b`: number, `w`: [Vec2](vec2.md)): *[Vec2](vec2.md)*
*Defined in [common/index.d.ts:45](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L45)*
**Parameters:**
Name | Type |
------ | ------ |
`a` | number |
`v` | [Vec2](vec2.md) |
`b` | number |
`w` | [Vec2](vec2.md) |
**Returns:** *[Vec2](vec2.md)*
___
### addMul
▸ **addMul**(`a`: number, `v`: [Vec2](vec2.md)): *[Vec2](vec2.md)*
*Defined in [common/index.d.ts:46](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L46)*
**Parameters:**
Name | Type |
------ | ------ |
`a` | number |
`v` | [Vec2](vec2.md) |
**Returns:** *[Vec2](vec2.md)*
___
### clamp
▸ **clamp**(`max`: number): *[Vec2](vec2.md)*
*Defined in [common/index.d.ts:55](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L55)*
**Parameters:**
Name | Type |
------ | ------ |
`max` | number |
**Returns:** *[Vec2](vec2.md)*
___
### clone
▸ **clone**(): *[Vec2](vec2.md)*
*Defined in [common/index.d.ts:38](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L38)*
**Returns:** *[Vec2](vec2.md)*
___
### length
▸ **length**(): *number*
*Defined in [common/index.d.ts:51](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L51)*
**Returns:** *number*
___
### lengthSquared
▸ **lengthSquared**(): *number*
*Defined in [common/index.d.ts:52](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L52)*
**Returns:** *number*
___
### mul
▸ **mul**(`m`: number): *[Vec2](vec2.md)*
*Defined in [common/index.d.ts:50](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L50)*
**Parameters:**
Name | Type |
------ | ------ |
`m` | number |
**Returns:** *[Vec2](vec2.md)*
___
### neg
▸ **neg**(): *[Vec2](vec2.md)*
*Defined in [common/index.d.ts:54](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L54)*
**Returns:** *[Vec2](vec2.md)*
___
### normalize
▸ **normalize**(): *number*
*Defined in [common/index.d.ts:53](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L53)*
**Returns:** *number*
___
### set
▸ **set**(`x`: number, `y`: number): *[Vec2](vec2.md)*
*Defined in [common/index.d.ts:40](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L40)*
**Parameters:**
Name | Type |
------ | ------ |
`x` | number |
`y` | number |
**Returns:** *[Vec2](vec2.md)*
▸ **set**(`value`: [Vec2](vec2.md)): *[Vec2](vec2.md)*
*Defined in [common/index.d.ts:41](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L41)*
**Parameters:**
Name | Type |
------ | ------ |
`value` | [Vec2](vec2.md) |
**Returns:** *[Vec2](vec2.md)*
___
### setCombine
▸ **setCombine**(`a`: number, `v`: [Vec2](vec2.md), `b`: number, `w`: [Vec2](vec2.md)): *[Vec2](vec2.md)*
*Defined in [common/index.d.ts:42](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L42)*
**Parameters:**
Name | Type |
------ | ------ |
`a` | number |
`v` | [Vec2](vec2.md) |
`b` | number |
`w` | [Vec2](vec2.md) |
**Returns:** *[Vec2](vec2.md)*
___
### setMul
▸ **setMul**(`a`: number, `v`: [Vec2](vec2.md)): *[Vec2](vec2.md)*
*Defined in [common/index.d.ts:43](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L43)*
**Parameters:**
Name | Type |
------ | ------ |
`a` | number |
`v` | [Vec2](vec2.md) |
**Returns:** *[Vec2](vec2.md)*
___
### setZero
▸ **setZero**(): *[Vec2](vec2.md)*
*Defined in [common/index.d.ts:39](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L39)*
**Returns:** *[Vec2](vec2.md)*
___
### sub
▸ **sub**(`w`: [Vec2](vec2.md)): *[Vec2](vec2.md)*
*Defined in [common/index.d.ts:47](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L47)*
**Parameters:**
Name | Type |
------ | ------ |
`w` | [Vec2](vec2.md) |
**Returns:** *[Vec2](vec2.md)*
___
### subCombine
▸ **subCombine**(`a`: number, `v`: [Vec2](vec2.md), `b`: number, `w`: [Vec2](vec2.md)): *[Vec2](vec2.md)*
*Defined in [common/index.d.ts:48](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L48)*
**Parameters:**
Name | Type |
------ | ------ |
`a` | number |
`v` | [Vec2](vec2.md) |
`b` | number |
`w` | [Vec2](vec2.md) |
**Returns:** *[Vec2](vec2.md)*
___
### subMul
▸ **subMul**(`a`: number, `v`: [Vec2](vec2.md)): *[Vec2](vec2.md)*
*Defined in [common/index.d.ts:49](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L49)*
**Parameters:**
Name | Type |
------ | ------ |
`a` | number |
`v` | [Vec2](vec2.md) |
**Returns:** *[Vec2](vec2.md)*
___
### toString
▸ **toString**(): *string*
*Defined in [common/index.d.ts:37](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L37)*
**Returns:** *string*
___
### `Static` abs
▸ **abs**(`v`: [Vec2](vec2.md)): *[Vec2](vec2.md)*
*Defined in [common/index.d.ts:85](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L85)*
**Parameters:**
Name | Type |
------ | ------ |
`v` | [Vec2](vec2.md) |
**Returns:** *[Vec2](vec2.md)*
___
### `Static` add
▸ **add**(`v`: [Vec2](vec2.md), `w`: [Vec2](vec2.md)): *[Vec2](vec2.md)*
*Defined in [common/index.d.ts:78](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L78)*
**Parameters:**
Name | Type |
------ | ------ |
`v` | [Vec2](vec2.md) |
`w` | [Vec2](vec2.md) |
**Returns:** *[Vec2](vec2.md)*
___
### `Static` addCross
▸ **addCross**(`a`: [Vec2](vec2.md), `v`: [Vec2](vec2.md), `w`: number): *[Vec2](vec2.md)*
*Defined in [common/index.d.ts:76](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L76)*
**Parameters:**
Name | Type |
------ | ------ |
`a` | [Vec2](vec2.md) |
`v` | [Vec2](vec2.md) |
`w` | number |
**Returns:** *[Vec2](vec2.md)*
▸ **addCross**(`a`: [Vec2](vec2.md), `v`: number, `w`: [Vec2](vec2.md)): *[Vec2](vec2.md)*
*Defined in [common/index.d.ts:77](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L77)*
**Parameters:**
Name | Type |
------ | ------ |
`a` | [Vec2](vec2.md) |
`v` | number |
`w` | [Vec2](vec2.md) |
**Returns:** *[Vec2](vec2.md)*
___
### `Static` areEqual
▸ **areEqual**(`v`: [Vec2](vec2.md), `w`: [Vec2](vec2.md)): *boolean*
*Defined in [common/index.d.ts:70](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L70)*
**Parameters:**
Name | Type |
------ | ------ |
`v` | [Vec2](vec2.md) |
`w` | [Vec2](vec2.md) |
**Returns:** *boolean*
___
### `Static` assert
▸ **assert**(`o`: any): *void*
*Defined in [common/index.d.ts:65](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L65)*
**Parameters:**
Name | Type |
------ | ------ |
`o` | any |
**Returns:** *void*
___
### `Static` clamp
▸ **clamp**(`v`: [Vec2](vec2.md), `max`: number): *[Vec2](vec2.md)*
*Defined in [common/index.d.ts:89](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L89)*
**Parameters:**
Name | Type |
------ | ------ |
`v` | [Vec2](vec2.md) |
`max` | number |
**Returns:** *[Vec2](vec2.md)*
___
### `Static` clone
▸ **clone**(`v`: [Vec2](vec2.md)): *[Vec2](vec2.md)*
*Defined in [common/index.d.ts:63](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L63)*
**Parameters:**
Name | Type |
------ | ------ |
`v` | [Vec2](vec2.md) |
**Returns:** *[Vec2](vec2.md)*
___
### `Static` combine
▸ **combine**(`a`: number, `v`: [Vec2](vec2.md), `b`: number, `w`: [Vec2](vec2.md)): *[Vec2](vec2.md)*
*Defined in [common/index.d.ts:79](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L79)*
**Parameters:**
Name | Type |
------ | ------ |
`a` | number |
`v` | [Vec2](vec2.md) |
`b` | number |
`w` | [Vec2](vec2.md) |
**Returns:** *[Vec2](vec2.md)*
___
### `Static` cross
▸ **cross**(`v`: [Vec2](vec2.md), `w`: [Vec2](vec2.md)): *number*
*Defined in [common/index.d.ts:73](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L73)*
**Parameters:**
Name | Type |
------ | ------ |
`v` | [Vec2](vec2.md) |
`w` | [Vec2](vec2.md) |
**Returns:** *number*
▸ **cross**(`v`: [Vec2](vec2.md), `w`: number): *[Vec2](vec2.md)*
*Defined in [common/index.d.ts:74](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L74)*
**Parameters:**
Name | Type |
------ | ------ |
`v` | [Vec2](vec2.md) |
`w` | number |
**Returns:** *[Vec2](vec2.md)*
▸ **cross**(`v`: number, `w`: [Vec2](vec2.md)): *[Vec2](vec2.md)*
*Defined in [common/index.d.ts:75](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L75)*
**Parameters:**
Name | Type |
------ | ------ |
`v` | number |
`w` | [Vec2](vec2.md) |
**Returns:** *[Vec2](vec2.md)*
___
### `Static` distance
▸ **distance**(`v`: [Vec2](vec2.md), `w`: [Vec2](vec2.md)): *number*
*Defined in [common/index.d.ts:68](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L68)*
**Parameters:**
Name | Type |
------ | ------ |
`v` | [Vec2](vec2.md) |
`w` | [Vec2](vec2.md) |
**Returns:** *number*
___
### `Static` distanceSquared
▸ **distanceSquared**(`v`: [Vec2](vec2.md), `w`: [Vec2](vec2.md)): *number*
*Defined in [common/index.d.ts:69](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L69)*
**Parameters:**
Name | Type |
------ | ------ |
`v` | [Vec2](vec2.md) |
`w` | [Vec2](vec2.md) |
**Returns:** *number*
___
### `Static` dot
▸ **dot**(`v`: [Vec2](vec2.md), `w`: [Vec2](vec2.md)): *number*
*Defined in [common/index.d.ts:72](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L72)*
**Parameters:**
Name | Type |
------ | ------ |
`v` | [Vec2](vec2.md) |
`w` | [Vec2](vec2.md) |
**Returns:** *number*
___
### `Static` isValid
▸ **isValid**(`v`: any): *boolean*
*Defined in [common/index.d.ts:64](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L64)*
**Parameters:**
Name | Type |
------ | ------ |
`v` | any |
**Returns:** *boolean*
___
### `Static` lengthOf
▸ **lengthOf**(`v`: [Vec2](vec2.md)): *number*
*Defined in [common/index.d.ts:66](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L66)*
**Parameters:**
Name | Type |
------ | ------ |
`v` | [Vec2](vec2.md) |
**Returns:** *number*
___
### `Static` lengthSquared
▸ **lengthSquared**(`v`: [Vec2](vec2.md)): *number*
*Defined in [common/index.d.ts:67](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L67)*
**Parameters:**
Name | Type |
------ | ------ |
`v` | [Vec2](vec2.md) |
**Returns:** *number*
___
### `Static` lower
▸ **lower**(`v`: [Vec2](vec2.md), `w`: [Vec2](vec2.md)): *[Vec2](vec2.md)*
*Defined in [common/index.d.ts:88](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L88)*
**Parameters:**
Name | Type |
------ | ------ |
`v` | [Vec2](vec2.md) |
`w` | [Vec2](vec2.md) |
**Returns:** *[Vec2](vec2.md)*
___
### `Static` mid
▸ **mid**(`v`: [Vec2](vec2.md), `w`: [Vec2](vec2.md)): *[Vec2](vec2.md)*
*Defined in [common/index.d.ts:86](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L86)*
**Parameters:**
Name | Type |
------ | ------ |
`v` | [Vec2](vec2.md) |
`w` | [Vec2](vec2.md) |
**Returns:** *[Vec2](vec2.md)*
___
### `Static` mul
▸ **mul**(`a`: [Vec2](vec2.md), `b`: number): *[Vec2](vec2.md)*
*Defined in [common/index.d.ts:82](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L82)*
**Parameters:**
Name | Type |
------ | ------ |
`a` | [Vec2](vec2.md) |
`b` | number |
**Returns:** *[Vec2](vec2.md)*
▸ **mul**(`a`: number, `b`: [Vec2](vec2.md)): *[Vec2](vec2.md)*
*Defined in [common/index.d.ts:83](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L83)*
**Parameters:**
Name | Type |
------ | ------ |
`a` | number |
`b` | [Vec2](vec2.md) |
**Returns:** *[Vec2](vec2.md)*
___
### `Static` neg
▸ **neg**(`v`: [Vec2](vec2.md)): *[Vec2](vec2.md)*
*Defined in [common/index.d.ts:84](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L84)*
**Parameters:**
Name | Type |
------ | ------ |
`v` | [Vec2](vec2.md) |
**Returns:** *[Vec2](vec2.md)*
___
### `Static` skew
▸ **skew**(`v`: [Vec2](vec2.md)): *[Vec2](vec2.md)*
*Defined in [common/index.d.ts:71](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L71)*
**Parameters:**
Name | Type |
------ | ------ |
`v` | [Vec2](vec2.md) |
**Returns:** *[Vec2](vec2.md)*
___
### `Static` sub
▸ **sub**(`v`: [Vec2](vec2.md), `w`: [Vec2](vec2.md)): *[Vec2](vec2.md)*
*Defined in [common/index.d.ts:81](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L81)*
**Parameters:**
Name | Type |
------ | ------ |
`v` | [Vec2](vec2.md) |
`w` | [Vec2](vec2.md) |
**Returns:** *[Vec2](vec2.md)*
___
### `Static` upper
▸ **upper**(`v`: [Vec2](vec2.md), `w`: [Vec2](vec2.md)): *[Vec2](vec2.md)*
*Defined in [common/index.d.ts:87](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L87)*
**Parameters:**
Name | Type |
------ | ------ |
`v` | [Vec2](vec2.md) |
`w` | [Vec2](vec2.md) |
**Returns:** *[Vec2](vec2.md)*
___
### `Static` zero
▸ **zero**(): *[Vec2](vec2.md)*
*Defined in [common/index.d.ts:61](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L61)*
**Returns:** *[Vec2](vec2.md)*

403
docs/api/classes/vec3.md Normal file
View File

@ -0,0 +1,403 @@
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [Vec3](vec3.md)
# Class: Vec3
## Hierarchy
* **Vec3**
## Callable
▸ **Vec3**(`x`: number, `y`: number, `z`: number): *[Vec3](vec3.md)*
*Defined in [common/index.d.ts:92](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L92)*
**Parameters:**
Name | Type |
------ | ------ |
`x` | number |
`y` | number |
`z` | number |
**Returns:** *[Vec3](vec3.md)*
▸ **Vec3**(`obj`: object): *[Vec3](vec3.md)*
*Defined in [common/index.d.ts:93](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L93)*
**Parameters:**
▪ **obj**: *object*
Name | Type |
------ | ------ |
`x` | number |
`y` | number |
`z` | number |
**Returns:** *[Vec3](vec3.md)*
▸ **Vec3**(): *[Vec3](vec3.md)*
*Defined in [common/index.d.ts:94](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L94)*
**Returns:** *[Vec3](vec3.md)*
## Index
### Constructors
* [constructor](vec3.md#constructor)
### Properties
* [x](vec3.md#x)
* [y](vec3.md#y)
* [z](vec3.md#z)
### Methods
* [add](vec3.md#add)
* [mul](vec3.md#mul)
* [neg](vec3.md#neg)
* [set](vec3.md#set)
* [setZero](vec3.md#setzero)
* [sub](vec3.md#sub)
* [toString](vec3.md#tostring)
* [add](vec3.md#static-add)
* [areEqual](vec3.md#static-areequal)
* [assert](vec3.md#static-assert)
* [clone](vec3.md#static-clone)
* [cross](vec3.md#static-cross)
* [dot](vec3.md#static-dot)
* [isValid](vec3.md#static-isvalid)
* [mul](vec3.md#static-mul)
* [neg](vec3.md#static-neg)
* [sub](vec3.md#static-sub)
## Constructors
### constructor
\+ **new Vec3**(`x`: number, `y`: number, `z`: number): *[Vec3](vec3.md)*
*Defined in [common/index.d.ts:106](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L106)*
**Parameters:**
Name | Type |
------ | ------ |
`x` | number |
`y` | number |
`z` | number |
**Returns:** *[Vec3](vec3.md)*
\+ **new Vec3**(`obj`: object): *[Vec3](vec3.md)*
*Defined in [common/index.d.ts:108](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L108)*
**Parameters:**
▪ **obj**: *object*
Name | Type |
------ | ------ |
`x` | number |
`y` | number |
`z` | number |
**Returns:** *[Vec3](vec3.md)*
\+ **new Vec3**(): *[Vec3](vec3.md)*
*Defined in [common/index.d.ts:109](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L109)*
**Returns:** *[Vec3](vec3.md)*
## Properties
### x
• **x**: *number*
*Defined in [common/index.d.ts:96](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L96)*
___
### y
• **y**: *number*
*Defined in [common/index.d.ts:97](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L97)*
___
### z
• **z**: *number*
*Defined in [common/index.d.ts:98](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L98)*
## Methods
### add
▸ **add**(`w`: [Vec3](vec3.md)): *[Vec3](vec3.md)*
*Defined in [common/index.d.ts:103](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L103)*
**Parameters:**
Name | Type |
------ | ------ |
`w` | [Vec3](vec3.md) |
**Returns:** *[Vec3](vec3.md)*
___
### mul
▸ **mul**(`m`: number): *[Vec3](vec3.md)*
*Defined in [common/index.d.ts:105](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L105)*
**Parameters:**
Name | Type |
------ | ------ |
`m` | number |
**Returns:** *[Vec3](vec3.md)*
___
### neg
▸ **neg**(): *[Vec3](vec3.md)*
*Defined in [common/index.d.ts:106](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L106)*
**Returns:** *[Vec3](vec3.md)*
___
### set
▸ **set**(`x`: number, `y`: number, `z`: number): *[Vec3](vec3.md)*
*Defined in [common/index.d.ts:102](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L102)*
**Parameters:**
Name | Type |
------ | ------ |
`x` | number |
`y` | number |
`z` | number |
**Returns:** *[Vec3](vec3.md)*
___
### setZero
▸ **setZero**(): *[Vec3](vec3.md)*
*Defined in [common/index.d.ts:101](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L101)*
**Returns:** *[Vec3](vec3.md)*
___
### sub
▸ **sub**(`w`: [Vec3](vec3.md)): *[Vec3](vec3.md)*
*Defined in [common/index.d.ts:104](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L104)*
**Parameters:**
Name | Type |
------ | ------ |
`w` | [Vec3](vec3.md) |
**Returns:** *[Vec3](vec3.md)*
___
### toString
▸ **toString**(): *string*
*Defined in [common/index.d.ts:100](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L100)*
**Returns:** *string*
___
### `Static` add
▸ **add**(`v`: [Vec3](vec3.md), `w`: [Vec3](vec3.md)): *[Vec3](vec3.md)*
*Defined in [common/index.d.ts:117](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L117)*
**Parameters:**
Name | Type |
------ | ------ |
`v` | [Vec3](vec3.md) |
`w` | [Vec3](vec3.md) |
**Returns:** *[Vec3](vec3.md)*
___
### `Static` areEqual
▸ **areEqual**(`v`: [Vec3](vec3.md), `w`: [Vec3](vec3.md)): *boolean*
*Defined in [common/index.d.ts:114](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L114)*
**Parameters:**
Name | Type |
------ | ------ |
`v` | [Vec3](vec3.md) |
`w` | [Vec3](vec3.md) |
**Returns:** *boolean*
___
### `Static` assert
▸ **assert**(`o`: any): *void*
*Defined in [common/index.d.ts:123](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L123)*
**Parameters:**
Name | Type |
------ | ------ |
`o` | any |
**Returns:** *void*
___
### `Static` clone
▸ **clone**(`v`: [Vec3](vec3.md)): *[Vec3](vec3.md)*
*Defined in [common/index.d.ts:113](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L113)*
**Parameters:**
Name | Type |
------ | ------ |
`v` | [Vec3](vec3.md) |
**Returns:** *[Vec3](vec3.md)*
___
### `Static` cross
▸ **cross**(`v`: [Vec3](vec3.md), `w`: [Vec3](vec3.md)): *[Vec3](vec3.md)*
*Defined in [common/index.d.ts:116](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L116)*
**Parameters:**
Name | Type |
------ | ------ |
`v` | [Vec3](vec3.md) |
`w` | [Vec3](vec3.md) |
**Returns:** *[Vec3](vec3.md)*
___
### `Static` dot
▸ **dot**(`v`: [Vec3](vec3.md), `w`: [Vec3](vec3.md)): *number*
*Defined in [common/index.d.ts:115](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L115)*
**Parameters:**
Name | Type |
------ | ------ |
`v` | [Vec3](vec3.md) |
`w` | [Vec3](vec3.md) |
**Returns:** *number*
___
### `Static` isValid
▸ **isValid**(`v`: any): *void*
*Defined in [common/index.d.ts:122](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L122)*
**Parameters:**
Name | Type |
------ | ------ |
`v` | any |
**Returns:** *void*
___
### `Static` mul
▸ **mul**(`v`: [Vec3](vec3.md), `m`: number): *[Vec3](vec3.md)*
*Defined in [common/index.d.ts:119](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L119)*
**Parameters:**
Name | Type |
------ | ------ |
`v` | [Vec3](vec3.md) |
`m` | number |
**Returns:** *[Vec3](vec3.md)*
___
### `Static` neg
▸ **neg**(`v`: [Vec3](vec3.md)): *[Vec3](vec3.md)*
*Defined in [common/index.d.ts:120](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L120)*
**Parameters:**
Name | Type |
------ | ------ |
`v` | [Vec3](vec3.md) |
**Returns:** *[Vec3](vec3.md)*
___
### `Static` sub
▸ **sub**(`v`: [Vec3](vec3.md), `w`: [Vec3](vec3.md)): *[Vec3](vec3.md)*
*Defined in [common/index.d.ts:118](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L118)*
**Parameters:**
Name | Type |
------ | ------ |
`v` | [Vec3](vec3.md) |
`w` | [Vec3](vec3.md) |
**Returns:** *[Vec3](vec3.md)*

View File

@ -0,0 +1,30 @@
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [Velocity](velocity.md)
# Class: Velocity
## Hierarchy
* **Velocity**
## Index
### Properties
* [v](velocity.md#v)
* [w](velocity.md#w)
## Properties
### v
• **v**: *[Vec2](vec2.md)*
*Defined in [common/index.d.ts:20](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L20)*
___
### w
• **w**: *number*
*Defined in [common/index.d.ts:21](https://github.com/shakiba/planck.js/blob/038d425/lib/common/index.d.ts#L21)*

View File

@ -0,0 +1,75 @@
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [VelocityConstraintPoint](velocityconstraintpoint.md)
# Class: VelocityConstraintPoint
## Hierarchy
* **VelocityConstraintPoint**
## Index
### Properties
* [normalImpulse](velocityconstraintpoint.md#normalimpulse)
* [normalMass](velocityconstraintpoint.md#normalmass)
* [rA](velocityconstraintpoint.md#ra)
* [rB](velocityconstraintpoint.md#rb)
* [tangentImpulse](velocityconstraintpoint.md#tangentimpulse)
* [tangentMass](velocityconstraintpoint.md#tangentmass)
* [velocityBias](velocityconstraintpoint.md#velocitybias)
## Properties
### normalImpulse
• **normalImpulse**: *number*
*Defined in [index.d.ts:304](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L304)*
___
### normalMass
• **normalMass**: *number*
*Defined in [index.d.ts:306](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L306)*
___
### rA
• **rA**: *[Vec2](vec2.md)*
*Defined in [index.d.ts:302](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L302)*
___
### rB
• **rB**: *[Vec2](vec2.md)*
*Defined in [index.d.ts:303](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L303)*
___
### tangentImpulse
• **tangentImpulse**: *number*
*Defined in [index.d.ts:305](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L305)*
___
### tangentMass
• **tangentMass**: *number*
*Defined in [index.d.ts:307](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L307)*
___
### velocityBias
• **velocityBias**: *number*
*Defined in [index.d.ts:308](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L308)*

View File

@ -0,0 +1,179 @@
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [WeldJoint](weldjoint.md)
# Class: WeldJoint
## Hierarchy
* any
↳ **WeldJoint**
## Callable
▸ **WeldJoint**(`def`: [WeldJointDef](../interfaces/weldjointdef.md)): *[WeldJoint](weldjoint.md)*
*Defined in [joint/index.d.ts:547](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L547)*
**Parameters:**
Name | Type |
------ | ------ |
`def` | [WeldJointDef](../interfaces/weldjointdef.md) |
**Returns:** *[WeldJoint](weldjoint.md)*
▸ **WeldJoint**(`def`: [WeldJointOpt](../interfaces/weldjointopt.md), `bodyA`: [Body](body.md), `bodyB`: [Body](body.md), `anchor`: [Vec2](vec2.md)): *[WeldJoint](weldjoint.md)*
*Defined in [joint/index.d.ts:548](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L548)*
**Parameters:**
Name | Type |
------ | ------ |
`def` | [WeldJointOpt](../interfaces/weldjointopt.md) |
`bodyA` | [Body](body.md) |
`bodyB` | [Body](body.md) |
`anchor` | [Vec2](vec2.md) |
**Returns:** *[WeldJoint](weldjoint.md)*
## Index
### Constructors
* [constructor](weldjoint.md#constructor)
### Properties
* [TYPE](weldjoint.md#static-type)
### Methods
* [getDampingRatio](weldjoint.md#getdampingratio)
* [getFrequency](weldjoint.md#getfrequency)
* [getLocalAnchorA](weldjoint.md#getlocalanchora)
* [getLocalAnchorB](weldjoint.md#getlocalanchorb)
* [getReferenceAngle](weldjoint.md#getreferenceangle)
* [setDampingRatio](weldjoint.md#setdampingratio)
* [setFrequency](weldjoint.md#setfrequency)
## Constructors
### constructor
\+ **new WeldJoint**(`def`: [WeldJointDef](../interfaces/weldjointdef.md)): *[WeldJoint](weldjoint.md)*
*Defined in [joint/index.d.ts:550](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L550)*
**Parameters:**
Name | Type |
------ | ------ |
`def` | [WeldJointDef](../interfaces/weldjointdef.md) |
**Returns:** *[WeldJoint](weldjoint.md)*
\+ **new WeldJoint**(`def`: [WeldJointOpt](../interfaces/weldjointopt.md), `bodyA`: [Body](body.md), `bodyB`: [Body](body.md), `anchor`: [Vec2](vec2.md)): *[WeldJoint](weldjoint.md)*
*Defined in [joint/index.d.ts:552](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L552)*
**Parameters:**
Name | Type |
------ | ------ |
`def` | [WeldJointOpt](../interfaces/weldjointopt.md) |
`bodyA` | [Body](body.md) |
`bodyB` | [Body](body.md) |
`anchor` | [Vec2](vec2.md) |
**Returns:** *[WeldJoint](weldjoint.md)*
## Properties
### `Static` TYPE
▪ **TYPE**: *"weld-joint"*
*Defined in [joint/index.d.ts:550](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L550)*
## Methods
### getDampingRatio
▸ **getDampingRatio**(): *number*
*Defined in [joint/index.d.ts:581](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L581)*
**Returns:** *number*
___
### getFrequency
▸ **getFrequency**(): *number*
*Defined in [joint/index.d.ts:579](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L579)*
**Returns:** *number*
___
### getLocalAnchorA
▸ **getLocalAnchorA**(): *[Vec2](vec2.md)*
*Defined in [joint/index.d.ts:575](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L575)*
**Returns:** *[Vec2](vec2.md)*
___
### getLocalAnchorB
▸ **getLocalAnchorB**(): *[Vec2](vec2.md)*
*Defined in [joint/index.d.ts:576](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L576)*
**Returns:** *[Vec2](vec2.md)*
___
### getReferenceAngle
▸ **getReferenceAngle**(): *number*
*Defined in [joint/index.d.ts:577](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L577)*
**Returns:** *number*
___
### setDampingRatio
▸ **setDampingRatio**(`ratio`: number): *void*
*Defined in [joint/index.d.ts:580](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L580)*
**Parameters:**
Name | Type |
------ | ------ |
`ratio` | number |
**Returns:** *void*
___
### setFrequency
▸ **setFrequency**(`hz`: number): *void*
*Defined in [joint/index.d.ts:578](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L578)*
**Parameters:**
Name | Type |
------ | ------ |
`hz` | number |
**Returns:** *void*

View File

@ -0,0 +1,304 @@
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [WheelJoint](wheeljoint.md)
# Class: WheelJoint
## Hierarchy
* any
↳ **WheelJoint**
## Callable
▸ **WheelJoint**(`def`: [WheelJointDef](../interfaces/wheeljointdef.md)): *[WheelJoint](wheeljoint.md)*
*Defined in [joint/index.d.ts:596](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L596)*
**Parameters:**
Name | Type |
------ | ------ |
`def` | [WheelJointDef](../interfaces/wheeljointdef.md) |
**Returns:** *[WheelJoint](wheeljoint.md)*
▸ **WheelJoint**(`def`: [WheelJointOpt](../interfaces/wheeljointopt.md), `bodyA`: [Body](body.md), `bodyB`: [Body](body.md), `anchor`: [Vec2](vec2.md), `axis`: [Vec2](vec2.md)): *[WheelJoint](wheeljoint.md)*
*Defined in [joint/index.d.ts:597](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L597)*
**Parameters:**
Name | Type |
------ | ------ |
`def` | [WheelJointOpt](../interfaces/wheeljointopt.md) |
`bodyA` | [Body](body.md) |
`bodyB` | [Body](body.md) |
`anchor` | [Vec2](vec2.md) |
`axis` | [Vec2](vec2.md) |
**Returns:** *[WheelJoint](wheeljoint.md)*
## Index
### Constructors
* [constructor](wheeljoint.md#constructor)
### Properties
* [TYPE](wheeljoint.md#static-type)
### Methods
* [enableMotor](wheeljoint.md#enablemotor)
* [getJointSpeed](wheeljoint.md#getjointspeed)
* [getJointTranslation](wheeljoint.md#getjointtranslation)
* [getLocalAnchorA](wheeljoint.md#getlocalanchora)
* [getLocalAnchorB](wheeljoint.md#getlocalanchorb)
* [getLocalAxisA](wheeljoint.md#getlocalaxisa)
* [getMaxMotorTorque](wheeljoint.md#getmaxmotortorque)
* [getMotorSpeed](wheeljoint.md#getmotorspeed)
* [getMotorTorque](wheeljoint.md#getmotortorque)
* [getSpringDampingRatio](wheeljoint.md#getspringdampingratio)
* [getSpringFrequencyHz](wheeljoint.md#getspringfrequencyhz)
* [isMotorEnabled](wheeljoint.md#ismotorenabled)
* [setMaxMotorTorque](wheeljoint.md#setmaxmotortorque)
* [setMotorSpeed](wheeljoint.md#setmotorspeed)
* [setSpringDampingRatio](wheeljoint.md#setspringdampingratio)
* [setSpringFrequencyHz](wheeljoint.md#setspringfrequencyhz)
## Constructors
### constructor
\+ **new WheelJoint**(`def`: [WheelJointDef](../interfaces/wheeljointdef.md)): *[WheelJoint](wheeljoint.md)*
*Defined in [joint/index.d.ts:599](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L599)*
**Parameters:**
Name | Type |
------ | ------ |
`def` | [WheelJointDef](../interfaces/wheeljointdef.md) |
**Returns:** *[WheelJoint](wheeljoint.md)*
\+ **new WheelJoint**(`def`: [WheelJointOpt](../interfaces/wheeljointopt.md), `bodyA`: [Body](body.md), `bodyB`: [Body](body.md), `anchor`: [Vec2](vec2.md), `axis`: [Vec2](vec2.md)): *[WheelJoint](wheeljoint.md)*
*Defined in [joint/index.d.ts:601](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L601)*
**Parameters:**
Name | Type |
------ | ------ |
`def` | [WheelJointOpt](../interfaces/wheeljointopt.md) |
`bodyA` | [Body](body.md) |
`bodyB` | [Body](body.md) |
`anchor` | [Vec2](vec2.md) |
`axis` | [Vec2](vec2.md) |
**Returns:** *[WheelJoint](wheeljoint.md)*
## Properties
### `Static` TYPE
▪ **TYPE**: *"wheel-joint"*
*Defined in [joint/index.d.ts:599](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L599)*
## Methods
### enableMotor
▸ **enableMotor**(`flag`: boolean): *void*
*Defined in [joint/index.d.ts:642](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L642)*
**Parameters:**
Name | Type |
------ | ------ |
`flag` | boolean |
**Returns:** *void*
___
### getJointSpeed
▸ **getJointSpeed**(): *number*
*Defined in [joint/index.d.ts:640](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L640)*
**Returns:** *number*
___
### getJointTranslation
▸ **getJointTranslation**(): *number*
*Defined in [joint/index.d.ts:639](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L639)*
**Returns:** *number*
___
### getLocalAnchorA
▸ **getLocalAnchorA**(): *[Vec2](vec2.md)*
*Defined in [joint/index.d.ts:636](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L636)*
**Returns:** *[Vec2](vec2.md)*
___
### getLocalAnchorB
▸ **getLocalAnchorB**(): *[Vec2](vec2.md)*
*Defined in [joint/index.d.ts:637](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L637)*
**Returns:** *[Vec2](vec2.md)*
___
### getLocalAxisA
▸ **getLocalAxisA**(): *[Vec2](vec2.md)*
*Defined in [joint/index.d.ts:638](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L638)*
**Returns:** *[Vec2](vec2.md)*
___
### getMaxMotorTorque
▸ **getMaxMotorTorque**(): *number*
*Defined in [joint/index.d.ts:646](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L646)*
**Returns:** *number*
___
### getMotorSpeed
▸ **getMotorSpeed**(): *number*
*Defined in [joint/index.d.ts:644](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L644)*
**Returns:** *number*
___
### getMotorTorque
▸ **getMotorTorque**(`inv_dt`: number): *number*
*Defined in [joint/index.d.ts:647](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L647)*
**Parameters:**
Name | Type |
------ | ------ |
`inv_dt` | number |
**Returns:** *number*
___
### getSpringDampingRatio
▸ **getSpringDampingRatio**(): *number*
*Defined in [joint/index.d.ts:651](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L651)*
**Returns:** *number*
___
### getSpringFrequencyHz
▸ **getSpringFrequencyHz**(): *number*
*Defined in [joint/index.d.ts:649](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L649)*
**Returns:** *number*
___
### isMotorEnabled
▸ **isMotorEnabled**(): *boolean*
*Defined in [joint/index.d.ts:641](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L641)*
**Returns:** *boolean*
___
### setMaxMotorTorque
▸ **setMaxMotorTorque**(`torque`: number): *void*
*Defined in [joint/index.d.ts:645](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L645)*
**Parameters:**
Name | Type |
------ | ------ |
`torque` | number |
**Returns:** *void*
___
### setMotorSpeed
▸ **setMotorSpeed**(`speed`: number): *void*
*Defined in [joint/index.d.ts:643](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L643)*
**Parameters:**
Name | Type |
------ | ------ |
`speed` | number |
**Returns:** *void*
___
### setSpringDampingRatio
▸ **setSpringDampingRatio**(`ratio`: number): *void*
*Defined in [joint/index.d.ts:650](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L650)*
**Parameters:**
Name | Type |
------ | ------ |
`ratio` | number |
**Returns:** *void*
___
### setSpringFrequencyHz
▸ **setSpringFrequencyHz**(`hz`: number): *void*
*Defined in [joint/index.d.ts:648](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L648)*
**Parameters:**
Name | Type |
------ | ------ |
`hz` | number |
**Returns:** *void*

914
docs/api/classes/world.md Normal file
View File

@ -0,0 +1,914 @@
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [World](world.md)
# Class: World
## Hierarchy
* **World**
## Callable
▸ **World**(`def?`: [WorldDef](../interfaces/worlddef.md)): *[World](world.md)*
*Defined in [index.d.ts:433](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L433)*
**Parameters:**
Name | Type |
------ | ------ |
`def?` | [WorldDef](../interfaces/worlddef.md) |
**Returns:** *[World](world.md)*
## Index
### Constructors
* [constructor](world.md#constructor)
### Methods
* [clearForces](world.md#clearforces)
* [createBody](world.md#createbody)
* [createDynamicBody](world.md#createdynamicbody)
* [createJoint](world.md#createjoint)
* [createKinematicBody](world.md#createkinematicbody)
* [destroyBody](world.md#destroybody)
* [destroyJoint](world.md#destroyjoint)
* [getAllowSleeping](world.md#getallowsleeping)
* [getAutoClearForces](world.md#getautoclearforces)
* [getBodyCount](world.md#getbodycount)
* [getBodyList](world.md#getbodylist)
* [getContactCount](world.md#getcontactcount)
* [getContactList](world.md#getcontactlist)
* [getContinuousPhysics](world.md#getcontinuousphysics)
* [getGravity](world.md#getgravity)
* [getJointCount](world.md#getjointcount)
* [getJointList](world.md#getjointlist)
* [getProxyCount](world.md#getproxycount)
* [getSubStepping](world.md#getsubstepping)
* [getTreeBalance](world.md#gettreebalance)
* [getTreeHeight](world.md#gettreeheight)
* [getTreeQuality](world.md#gettreequality)
* [getWarmStarting](world.md#getwarmstarting)
* [isLocked](world.md#islocked)
* [off](world.md#off)
* [on](world.md#on)
* [publish](world.md#publish)
* [queryAABB](world.md#queryaabb)
* [rayCast](world.md#raycast)
* [setAllowSleeping](world.md#setallowsleeping)
* [setAutoClearForces](world.md#setautoclearforces)
* [setContinuousPhysics](world.md#setcontinuousphysics)
* [setGravity](world.md#setgravity)
* [setSubStepping](world.md#setsubstepping)
* [setWarmStarting](world.md#setwarmstarting)
* [shiftOrigin](world.md#shiftorigin)
* [step](world.md#step)
## Constructors
### constructor
\+ **new World**(`def?`: [WorldDef](../interfaces/worlddef.md)): *[World](world.md)*
*Defined in [index.d.ts:434](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L434)*
**Parameters:**
Name | Type |
------ | ------ |
`def?` | [WorldDef](../interfaces/worlddef.md) |
**Returns:** *[World](world.md)*
## Methods
### clearForces
▸ **clearForces**(): *void*
*Defined in [index.d.ts:480](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L480)*
**Returns:** *void*
___
### createBody
▸ **createBody**(`def`: [BodyDef](../interfaces/bodydef.md)): *[Body](body.md)*
*Defined in [index.d.ts:488](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L488)*
**Parameters:**
Name | Type |
------ | ------ |
`def` | [BodyDef](../interfaces/bodydef.md) |
**Returns:** *[Body](body.md)*
▸ **createBody**(`position`: [Vec2](vec2.md), `angle?`: number): *[Body](body.md)*
*Defined in [index.d.ts:489](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L489)*
**Parameters:**
Name | Type |
------ | ------ |
`position` | [Vec2](vec2.md) |
`angle?` | number |
**Returns:** *[Body](body.md)*
▸ **createBody**(): *[Body](body.md)*
*Defined in [index.d.ts:490](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L490)*
**Returns:** *[Body](body.md)*
___
### createDynamicBody
▸ **createDynamicBody**(`def`: [BodyDef](../interfaces/bodydef.md)): *[Body](body.md)*
*Defined in [index.d.ts:491](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L491)*
**Parameters:**
Name | Type |
------ | ------ |
`def` | [BodyDef](../interfaces/bodydef.md) |
**Returns:** *[Body](body.md)*
▸ **createDynamicBody**(`position`: [Vec2](vec2.md), `angle?`: number): *[Body](body.md)*
*Defined in [index.d.ts:492](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L492)*
**Parameters:**
Name | Type |
------ | ------ |
`position` | [Vec2](vec2.md) |
`angle?` | number |
**Returns:** *[Body](body.md)*
▸ **createDynamicBody**(): *[Body](body.md)*
*Defined in [index.d.ts:493](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L493)*
**Returns:** *[Body](body.md)*
___
### createJoint
▸ **createJoint**‹**T**›(`joint`: T): *T | null*
*Defined in [index.d.ts:498](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L498)*
**Type parameters:**
▪ **T**: *[Joint](joint.md)*
**Parameters:**
Name | Type |
------ | ------ |
`joint` | T |
**Returns:** *T | null*
___
### createKinematicBody
▸ **createKinematicBody**(`def`: [BodyDef](../interfaces/bodydef.md)): *[Body](body.md)*
*Defined in [index.d.ts:494](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L494)*
**Parameters:**
Name | Type |
------ | ------ |
`def` | [BodyDef](../interfaces/bodydef.md) |
**Returns:** *[Body](body.md)*
▸ **createKinematicBody**(`position`: [Vec2](vec2.md), `angle?`: number): *[Body](body.md)*
*Defined in [index.d.ts:495](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L495)*
**Parameters:**
Name | Type |
------ | ------ |
`position` | [Vec2](vec2.md) |
`angle?` | number |
**Returns:** *[Body](body.md)*
▸ **createKinematicBody**(): *[Body](body.md)*
*Defined in [index.d.ts:496](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L496)*
**Returns:** *[Body](body.md)*
___
### destroyBody
▸ **destroyBody**(`b`: [Body](body.md)): *boolean*
*Defined in [index.d.ts:497](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L497)*
**Parameters:**
Name | Type |
------ | ------ |
`b` | [Body](body.md) |
**Returns:** *boolean*
___
### destroyJoint
▸ **destroyJoint**(`joint`: [Joint](joint.md)): *void*
*Defined in [index.d.ts:499](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L499)*
**Parameters:**
Name | Type |
------ | ------ |
`joint` | [Joint](joint.md) |
**Returns:** *void*
___
### getAllowSleeping
▸ **getAllowSleeping**(): *boolean*
*Defined in [index.d.ts:471](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L471)*
**Returns:** *boolean*
___
### getAutoClearForces
▸ **getAutoClearForces**(): *boolean*
*Defined in [index.d.ts:479](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L479)*
**Returns:** *boolean*
___
### getBodyCount
▸ **getBodyCount**(): *number*
*Defined in [index.d.ts:464](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L464)*
**Returns:** *number*
___
### getBodyList
▸ **getBodyList**(): *[Body](body.md) | null*
*Defined in [index.d.ts:461](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L461)*
**Returns:** *[Body](body.md) | null*
___
### getContactCount
▸ **getContactCount**(): *number*
*Defined in [index.d.ts:466](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L466)*
**Returns:** *number*
___
### getContactList
▸ **getContactList**(): *[Contact](contact.md) | null*
*Defined in [index.d.ts:463](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L463)*
**Returns:** *[Contact](contact.md) | null*
___
### getContinuousPhysics
▸ **getContinuousPhysics**(): *boolean*
*Defined in [index.d.ts:475](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L475)*
**Returns:** *boolean*
___
### getGravity
▸ **getGravity**(): *[Vec2](vec2.md)*
*Defined in [index.d.ts:468](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L468)*
**Returns:** *[Vec2](vec2.md)*
___
### getJointCount
▸ **getJointCount**(): *number*
*Defined in [index.d.ts:465](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L465)*
**Returns:** *number*
___
### getJointList
▸ **getJointList**(): *[Joint](joint.md) | null*
*Defined in [index.d.ts:462](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L462)*
**Returns:** *[Joint](joint.md) | null*
___
### getProxyCount
▸ **getProxyCount**(): *number*
*Defined in [index.d.ts:483](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L483)*
**Returns:** *number*
___
### getSubStepping
▸ **getSubStepping**(): *boolean*
*Defined in [index.d.ts:477](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L477)*
**Returns:** *boolean*
___
### getTreeBalance
▸ **getTreeBalance**(): *number*
*Defined in [index.d.ts:485](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L485)*
**Returns:** *number*
___
### getTreeHeight
▸ **getTreeHeight**(): *number*
*Defined in [index.d.ts:484](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L484)*
**Returns:** *number*
___
### getTreeQuality
▸ **getTreeQuality**(): *number*
*Defined in [index.d.ts:486](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L486)*
**Returns:** *number*
___
### getWarmStarting
▸ **getWarmStarting**(): *boolean*
*Defined in [index.d.ts:473](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L473)*
**Returns:** *boolean*
___
### isLocked
▸ **isLocked**(): *boolean*
*Defined in [index.d.ts:469](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L469)*
**Returns:** *boolean*
___
### off
▸ **off**(`name`: "begin-contact", `listener`: function): *[World](world.md)*
*Defined in [index.d.ts:516](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L516)*
**Parameters:**
▪ **name**: *"begin-contact"*
▪ **listener**: *function*
▸ (`contact`: [Contact](contact.md)): *void*
**Parameters:**
Name | Type |
------ | ------ |
`contact` | [Contact](contact.md) |
**Returns:** *[World](world.md)*
▸ **off**(`name`: "end-contact", `listener`: function): *[World](world.md)*
*Defined in [index.d.ts:517](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L517)*
**Parameters:**
▪ **name**: *"end-contact"*
▪ **listener**: *function*
▸ (`contact`: [Contact](contact.md)): *void*
**Parameters:**
Name | Type |
------ | ------ |
`contact` | [Contact](contact.md) |
**Returns:** *[World](world.md)*
▸ **off**(`name`: "pre-solve", `listener`: function): *[World](world.md)*
*Defined in [index.d.ts:518](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L518)*
**Parameters:**
▪ **name**: *"pre-solve"*
▪ **listener**: *function*
▸ (`contact`: [Contact](contact.md), `oldManifold`: [Manifold](../interfaces/manifold.md)): *void*
**Parameters:**
Name | Type |
------ | ------ |
`contact` | [Contact](contact.md) |
`oldManifold` | [Manifold](../interfaces/manifold.md) |
**Returns:** *[World](world.md)*
▸ **off**(`name`: "post-solve", `listener`: function): *[World](world.md)*
*Defined in [index.d.ts:519](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L519)*
**Parameters:**
▪ **name**: *"post-solve"*
▪ **listener**: *function*
▸ (`contact`: [Contact](contact.md), `impulse`: [ContactImpulse](contactimpulse.md)): *void*
**Parameters:**
Name | Type |
------ | ------ |
`contact` | [Contact](contact.md) |
`impulse` | [ContactImpulse](contactimpulse.md) |
**Returns:** *[World](world.md)*
▸ **off**(`name`: "remove-body", `listener`: function): *[World](world.md)*
*Defined in [index.d.ts:520](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L520)*
**Parameters:**
▪ **name**: *"remove-body"*
▪ **listener**: *function*
▸ (`body`: [Body](body.md)): *void*
**Parameters:**
Name | Type |
------ | ------ |
`body` | [Body](body.md) |
**Returns:** *[World](world.md)*
▸ **off**(`name`: "remove-joint", `listener`: function): *[World](world.md)*
*Defined in [index.d.ts:521](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L521)*
**Parameters:**
▪ **name**: *"remove-joint"*
▪ **listener**: *function*
▸ (`joint`: [Joint](joint.md)): *void*
**Parameters:**
Name | Type |
------ | ------ |
`joint` | [Joint](joint.md) |
**Returns:** *[World](world.md)*
▸ **off**(`name`: "remove-fixture", `listener`: function): *[World](world.md)*
*Defined in [index.d.ts:522](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L522)*
**Parameters:**
▪ **name**: *"remove-fixture"*
▪ **listener**: *function*
▸ (`fixture`: [Fixture](fixture.md)): *void*
**Parameters:**
Name | Type |
------ | ------ |
`fixture` | [Fixture](fixture.md) |
**Returns:** *[World](world.md)*
___
### on
▸ **on**(`name`: "begin-contact", `listener`: function): *[World](world.md)*
*Defined in [index.d.ts:509](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L509)*
**Parameters:**
▪ **name**: *"begin-contact"*
▪ **listener**: *function*
▸ (`contact`: [Contact](contact.md)): *void*
**Parameters:**
Name | Type |
------ | ------ |
`contact` | [Contact](contact.md) |
**Returns:** *[World](world.md)*
▸ **on**(`name`: "end-contact", `listener`: function): *[World](world.md)*
*Defined in [index.d.ts:510](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L510)*
**Parameters:**
▪ **name**: *"end-contact"*
▪ **listener**: *function*
▸ (`contact`: [Contact](contact.md)): *void*
**Parameters:**
Name | Type |
------ | ------ |
`contact` | [Contact](contact.md) |
**Returns:** *[World](world.md)*
▸ **on**(`name`: "pre-solve", `listener`: function): *[World](world.md)*
*Defined in [index.d.ts:511](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L511)*
**Parameters:**
▪ **name**: *"pre-solve"*
▪ **listener**: *function*
▸ (`contact`: [Contact](contact.md), `oldManifold`: [Manifold](../interfaces/manifold.md)): *void*
**Parameters:**
Name | Type |
------ | ------ |
`contact` | [Contact](contact.md) |
`oldManifold` | [Manifold](../interfaces/manifold.md) |
**Returns:** *[World](world.md)*
▸ **on**(`name`: "post-solve", `listener`: function): *[World](world.md)*
*Defined in [index.d.ts:512](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L512)*
**Parameters:**
▪ **name**: *"post-solve"*
▪ **listener**: *function*
▸ (`contact`: [Contact](contact.md), `impulse`: [ContactImpulse](contactimpulse.md)): *void*
**Parameters:**
Name | Type |
------ | ------ |
`contact` | [Contact](contact.md) |
`impulse` | [ContactImpulse](contactimpulse.md) |
**Returns:** *[World](world.md)*
▸ **on**(`name`: "remove-body", `listener`: function): *[World](world.md)*
*Defined in [index.d.ts:513](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L513)*
**Parameters:**
▪ **name**: *"remove-body"*
▪ **listener**: *function*
▸ (`body`: [Body](body.md)): *void*
**Parameters:**
Name | Type |
------ | ------ |
`body` | [Body](body.md) |
**Returns:** *[World](world.md)*
▸ **on**(`name`: "remove-joint", `listener`: function): *[World](world.md)*
*Defined in [index.d.ts:514](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L514)*
**Parameters:**
▪ **name**: *"remove-joint"*
▪ **listener**: *function*
▸ (`joint`: [Joint](joint.md)): *void*
**Parameters:**
Name | Type |
------ | ------ |
`joint` | [Joint](joint.md) |
**Returns:** *[World](world.md)*
▸ **on**(`name`: "remove-fixture", `listener`: function): *[World](world.md)*
*Defined in [index.d.ts:515](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L515)*
**Parameters:**
▪ **name**: *"remove-fixture"*
▪ **listener**: *function*
▸ (`fixture`: [Fixture](fixture.md)): *void*
**Parameters:**
Name | Type |
------ | ------ |
`fixture` | [Fixture](fixture.md) |
**Returns:** *[World](world.md)*
___
### publish
▸ **publish**(`name`: string, `arg1`: any, `arg2`: any, `arg3`: any): *number*
*Defined in [index.d.ts:524](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L524)*
**Parameters:**
Name | Type |
------ | ------ |
`name` | string |
`arg1` | any |
`arg2` | any |
`arg3` | any |
**Returns:** *number*
___
### queryAABB
▸ **queryAABB**(`aabb`: [AABB](aabb.md), `queryCallback`: function): *void*
*Defined in [index.d.ts:481](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L481)*
**Parameters:**
▪ **aabb**: *[AABB](aabb.md)*
▪ **queryCallback**: *function*
▸ (`fixture`: [Fixture](fixture.md)): *boolean*
**Parameters:**
Name | Type |
------ | ------ |
`fixture` | [Fixture](fixture.md) |
**Returns:** *void*
___
### rayCast
▸ **rayCast**(`point1`: [Vec2](vec2.md), `point2`: [Vec2](vec2.md), `reportFixtureCallback`: function): *void*
*Defined in [index.d.ts:482](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L482)*
**Parameters:**
▪ **point1**: *[Vec2](vec2.md)*
▪ **point2**: *[Vec2](vec2.md)*
▪ **reportFixtureCallback**: *function*
▸ (`fixture`: [Fixture](fixture.md), `point`: [Vec2](vec2.md), `normal`: [Vec2](vec2.md), `fraction`: number): *number*
**Parameters:**
Name | Type |
------ | ------ |
`fixture` | [Fixture](fixture.md) |
`point` | [Vec2](vec2.md) |
`normal` | [Vec2](vec2.md) |
`fraction` | number |
**Returns:** *void*
___
### setAllowSleeping
▸ **setAllowSleeping**(`flag`: boolean): *void*
*Defined in [index.d.ts:470](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L470)*
**Parameters:**
Name | Type |
------ | ------ |
`flag` | boolean |
**Returns:** *void*
___
### setAutoClearForces
▸ **setAutoClearForces**(`flag`: boolean): *void*
*Defined in [index.d.ts:478](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L478)*
**Parameters:**
Name | Type |
------ | ------ |
`flag` | boolean |
**Returns:** *void*
___
### setContinuousPhysics
▸ **setContinuousPhysics**(`flag`: boolean): *void*
*Defined in [index.d.ts:474](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L474)*
**Parameters:**
Name | Type |
------ | ------ |
`flag` | boolean |
**Returns:** *void*
___
### setGravity
▸ **setGravity**(`gravity`: [Vec2](vec2.md)): *void*
*Defined in [index.d.ts:467](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L467)*
**Parameters:**
Name | Type |
------ | ------ |
`gravity` | [Vec2](vec2.md) |
**Returns:** *void*
___
### setSubStepping
▸ **setSubStepping**(`flag`: boolean): *void*
*Defined in [index.d.ts:476](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L476)*
**Parameters:**
Name | Type |
------ | ------ |
`flag` | boolean |
**Returns:** *void*
___
### setWarmStarting
▸ **setWarmStarting**(`flag`: boolean): *void*
*Defined in [index.d.ts:472](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L472)*
**Parameters:**
Name | Type |
------ | ------ |
`flag` | boolean |
**Returns:** *void*
___
### shiftOrigin
▸ **shiftOrigin**(`newOrigin`: [Vec2](vec2.md)): *void*
*Defined in [index.d.ts:487](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L487)*
**Parameters:**
Name | Type |
------ | ------ |
`newOrigin` | [Vec2](vec2.md) |
**Returns:** *void*
___
### step
▸ **step**(`timeStep`: number, `velocityIterations?`: number, `positionIterations?`: number): *void*
*Defined in [index.d.ts:500](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L500)*
**Parameters:**
Name | Type |
------ | ------ |
`timeStep` | number |
`velocityIterations?` | number |
`positionIterations?` | number |
**Returns:** *void*

View File

@ -0,0 +1,26 @@
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [ContactFeatureType](contactfeaturetype.md)
# Enumeration: ContactFeatureType
## Index
### Enumeration members
* [Face](contactfeaturetype.md#face)
* [Vertex](contactfeaturetype.md#vertex)
## Enumeration members
### Face
• **Face**: = 1
*Defined in [index.d.ts:20](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L20)*
___
### Vertex
• **Vertex**: = 0
*Defined in [index.d.ts:19](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L19)*

View File

@ -0,0 +1,44 @@
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [LIMIT_STATE](limit_state.md)
# Enumeration: LIMIT_STATE
## Index
### Enumeration members
* [AT_LOWER_LIMIT](limit_state.md#at_lower_limit)
* [AT_UPPER_LIMIT](limit_state.md#at_upper_limit)
* [EQUAL_LIMITS](limit_state.md#equal_limits)
* [INACTIVE_LIMIT](limit_state.md#inactive_limit)
## Enumeration members
### AT_LOWER_LIMIT
• **AT_LOWER_LIMIT**:
*Defined in [joint/index.d.ts:8](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L8)*
___
### AT_UPPER_LIMIT
• **AT_UPPER_LIMIT**:
*Defined in [joint/index.d.ts:9](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L9)*
___
### EQUAL_LIMITS
• **EQUAL_LIMITS**:
*Defined in [joint/index.d.ts:10](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L10)*
___
### INACTIVE_LIMIT
• **INACTIVE_LIMIT**:
*Defined in [joint/index.d.ts:7](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L7)*

View File

@ -0,0 +1,35 @@
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [ManifoldType](manifoldtype.md)
# Enumeration: ManifoldType
## Index
### Enumeration members
* [Circles](manifoldtype.md#circles)
* [FaceA](manifoldtype.md#facea)
* [FaceB](manifoldtype.md#faceb)
## Enumeration members
### Circles
• **Circles**: = 0
*Defined in [index.d.ts:36](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L36)*
___
### FaceA
• **FaceA**: = 1
*Defined in [index.d.ts:37](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L37)*
___
### FaceB
• **FaceB**: = 2
*Defined in [index.d.ts:38](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L38)*

View File

@ -0,0 +1,5 @@
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [TOIOutputState](toioutputstate.md)
# Enumeration: TOIOutputState

173
docs/api/globals.md Normal file
View File

@ -0,0 +1,173 @@
[Planck.js API Doc](README.md) › [Globals](globals.md)
# Planck.js API Doc
## Index
### Namespaces
* [internal](modules/internal.md)
### Enumerations
* [ContactFeatureType](enums/contactfeaturetype.md)
* [LIMIT_STATE](enums/limit_state.md)
* [ManifoldType](enums/manifoldtype.md)
* [TOIOutputState](enums/toioutputstate.md)
### Classes
* [AABB](classes/aabb.md)
* [Body](classes/body.md)
* [BoxShape](classes/boxshape.md)
* [BroadPhase](classes/broadphase.md)
* [ChainShape](classes/chainshape.md)
* [CircleShape](classes/circleshape.md)
* [Contact](classes/contact.md)
* [ContactEdge](classes/contactedge.md)
* [ContactImpulse](classes/contactimpulse.md)
* [DistanceJoint](classes/distancejoint.md)
* [DistanceProxy](classes/distanceproxy.md)
* [DynamicTree](classes/dynamictree.md)
* [EdgeShape](classes/edgeshape.md)
* [Fixture](classes/fixture.md)
* [FrictionJoint](classes/frictionjoint.md)
* [GearJoint](classes/gearjoint.md)
* [Joint](classes/joint.md)
* [Mat22](classes/mat22.md)
* [Mat33](classes/mat33.md)
* [Math](classes/math.md)
* [MotorJoint](classes/motorjoint.md)
* [MouseJoint](classes/mousejoint.md)
* [PolygonShape](classes/polygonshape.md)
* [Position](classes/position.md)
* [PrismaticJoint](classes/prismaticjoint.md)
* [PulleyJoint](classes/pulleyjoint.md)
* [RevoluteJoint](classes/revolutejoint.md)
* [RopeJoint](classes/ropejoint.md)
* [Rot](classes/rot.md)
* [Settings](classes/settings.md)
* [Shape](classes/shape.md)
* [Solver](classes/solver.md)
* [Sweep](classes/sweep.md)
* [Transform](classes/transform.md)
* [TreeNode](classes/treenode.md)
* [Vec2](classes/vec2.md)
* [Vec3](classes/vec3.md)
* [Velocity](classes/velocity.md)
* [VelocityConstraintPoint](classes/velocityconstraintpoint.md)
* [WeldJoint](classes/weldjoint.md)
* [WheelJoint](classes/wheeljoint.md)
* [World](classes/world.md)
### Interfaces
* [BodyDef](interfaces/bodydef.md)
* [ContactFeature](interfaces/contactfeature.md)
* [ContactID](interfaces/contactid.md)
* [DistanceJointDef](interfaces/distancejointdef.md)
* [DistanceJointOpt](interfaces/distancejointopt.md)
* [FixtureDef](interfaces/fixturedef.md)
* [FixtureOpt](interfaces/fixtureopt.md)
* [FixtureProxy](interfaces/fixtureproxy.md)
* [FrictionJointDef](interfaces/frictionjointdef.md)
* [FrictionJointOpt](interfaces/frictionjointopt.md)
* [GearJointDef](interfaces/gearjointdef.md)
* [GearJointOpt](interfaces/gearjointopt.md)
* [JointDef](interfaces/jointdef.md)
* [JointEdge](interfaces/jointedge.md)
* [JointOpt](interfaces/jointopt.md)
* [Manifold](interfaces/manifold.md)
* [ManifoldPoint](interfaces/manifoldpoint.md)
* [MassData](interfaces/massdata.md)
* [MotorJointDef](interfaces/motorjointdef.md)
* [MotorJointOpt](interfaces/motorjointopt.md)
* [MouseJointDef](interfaces/mousejointdef.md)
* [MouseJointOpt](interfaces/mousejointopt.md)
* [PrismaticJointDef](interfaces/prismaticjointdef.md)
* [PrismaticJointOpt](interfaces/prismaticjointopt.md)
* [PulleyJointDef](interfaces/pulleyjointdef.md)
* [PulleyJointOpt](interfaces/pulleyjointopt.md)
* [RayCastInput](interfaces/raycastinput.md)
* [RayCastOutput](interfaces/raycastoutput.md)
* [RevoluteJointDef](interfaces/revolutejointdef.md)
* [RevoluteJointOpt](interfaces/revolutejointopt.md)
* [RopeJointDef](interfaces/ropejointdef.md)
* [RopeJointOpt](interfaces/ropejointopt.md)
* [WeldJointDef](interfaces/weldjointdef.md)
* [WeldJointOpt](interfaces/weldjointopt.md)
* [WheelJointDef](interfaces/wheeljointdef.md)
* [WheelJointOpt](interfaces/wheeljointopt.md)
* [WorldDef](interfaces/worlddef.md)
* [WorldManifold](interfaces/worldmanifold.md)
### Type aliases
* [BodyType](globals.md#bodytype)
* [ContactCallack](globals.md#contactcallack)
* [EvaluateFunction](globals.md#evaluatefunction)
* [ShapeType](globals.md#shapetype)
## Type aliases
### BodyType
Ƭ **BodyType**: *"static" | "kinematic" | "dynamic"*
*Defined in [index.d.ts:148](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L148)*
___
### ContactCallack
Ƭ **ContactCallack**: *function*
*Defined in [index.d.ts:311](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L311)*
#### Type declaration:
▸ (`manifold`: [Manifold](interfaces/manifold.md), `xfA`: [Transform](classes/transform.md), `fixtureA`: [Fixture](classes/fixture.md), `indexA`: number, `xfB`: [Transform](classes/transform.md), `fixtureB`: [Fixture](classes/fixture.md), `indexB`: number): *void & object*
**Parameters:**
Name | Type |
------ | ------ |
`manifold` | [Manifold](interfaces/manifold.md) |
`xfA` | [Transform](classes/transform.md) |
`fixtureA` | [Fixture](classes/fixture.md) |
`indexA` | number |
`xfB` | [Transform](classes/transform.md) |
`fixtureB` | [Fixture](classes/fixture.md) |
`indexB` | number |
___
### EvaluateFunction
Ƭ **EvaluateFunction**: *function*
*Defined in [index.d.ts:321](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L321)*
#### Type declaration:
▸ (`manifold`: [Manifold](interfaces/manifold.md), `xfA`: [Transform](classes/transform.md), `fixtureA`: [Fixture](classes/fixture.md), `indexA`: number, `xfB`: [Transform](classes/transform.md), `fixtureB`: [Fixture](classes/fixture.md), `indexB`: number): *void*
**Parameters:**
Name | Type |
------ | ------ |
`manifold` | [Manifold](interfaces/manifold.md) |
`xfA` | [Transform](classes/transform.md) |
`fixtureA` | [Fixture](classes/fixture.md) |
`indexA` | number |
`xfB` | [Transform](classes/transform.md) |
`fixtureB` | [Fixture](classes/fixture.md) |
`indexB` | number |
___
### ShapeType
Ƭ **ShapeType**: *"circle" | "edge" | "polygon" | "chain"*
*Defined in [shape/index.d.ts:6](https://github.com/shakiba/planck.js/blob/038d425/lib/shape/index.d.ts#L6)*

View File

@ -0,0 +1,138 @@
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [BodyDef](bodydef.md)
# Interface: BodyDef
## Hierarchy
* **BodyDef**
## Index
### Properties
* [active](bodydef.md#optional-active)
* [allowSleep](bodydef.md#optional-allowsleep)
* [angle](bodydef.md#optional-angle)
* [angularDamping](bodydef.md#optional-angulardamping)
* [angularVelocity](bodydef.md#optional-angularvelocity)
* [awake](bodydef.md#optional-awake)
* [bullet](bodydef.md#optional-bullet)
* [fixedRotation](bodydef.md#optional-fixedrotation)
* [gravityScale](bodydef.md#optional-gravityscale)
* [linearDamping](bodydef.md#optional-lineardamping)
* [linearVelocity](bodydef.md#optional-linearvelocity)
* [position](bodydef.md#optional-position)
* [type](bodydef.md#optional-type)
* [userData](bodydef.md#optional-userdata)
## Properties
### `Optional` active
• **active**? : *boolean*
*Defined in [index.d.ts:290](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L290)*
___
### `Optional` allowSleep
• **allowSleep**? : *boolean*
*Defined in [index.d.ts:288](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L288)*
___
### `Optional` angle
• **angle**? : *number*
*Defined in [index.d.ts:280](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L280)*
___
### `Optional` angularDamping
• **angularDamping**? : *number*
*Defined in [index.d.ts:284](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L284)*
___
### `Optional` angularVelocity
• **angularVelocity**? : *number*
*Defined in [index.d.ts:282](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L282)*
___
### `Optional` awake
• **awake**? : *boolean*
*Defined in [index.d.ts:289](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L289)*
___
### `Optional` bullet
• **bullet**? : *boolean*
*Defined in [index.d.ts:286](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L286)*
___
### `Optional` fixedRotation
• **fixedRotation**? : *boolean*
*Defined in [index.d.ts:285](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L285)*
___
### `Optional` gravityScale
• **gravityScale**? : *number*
*Defined in [index.d.ts:287](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L287)*
___
### `Optional` linearDamping
• **linearDamping**? : *number*
*Defined in [index.d.ts:283](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L283)*
___
### `Optional` linearVelocity
• **linearVelocity**? : *[Vec2](../classes/vec2.md)*
*Defined in [index.d.ts:281](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L281)*
___
### `Optional` position
• **position**? : *[Vec2](../classes/vec2.md)*
*Defined in [index.d.ts:279](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L279)*
___
### `Optional` type
• **type**? : *[BodyType](../globals.md#bodytype)*
*Defined in [index.d.ts:278](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L278)*
___
### `Optional` userData
• **userData**? : *any*
*Defined in [index.d.ts:291](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L291)*

View File

@ -0,0 +1,48 @@
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [ContactFeature](contactfeature.md)
# Interface: ContactFeature
## Hierarchy
* **ContactFeature**
## Index
### Properties
* [indexA](contactfeature.md#indexa)
* [indexB](contactfeature.md#indexb)
* [typeA](contactfeature.md#typea)
* [typeB](contactfeature.md#typeb)
## Properties
### indexA
• **indexA**: *number*
*Defined in [index.d.ts:24](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L24)*
___
### indexB
• **indexB**: *number*
*Defined in [index.d.ts:25](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L25)*
___
### typeA
• **typeA**: *[ContactFeatureType](../enums/contactfeaturetype.md)*
*Defined in [index.d.ts:26](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L26)*
___
### typeB
• **typeB**: *[ContactFeatureType](../enums/contactfeaturetype.md)*
*Defined in [index.d.ts:27](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L27)*

View File

@ -0,0 +1,30 @@
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [ContactID](contactid.md)
# Interface: ContactID
## Hierarchy
* **ContactID**
## Index
### Properties
* [cf](contactid.md#cf)
* [key](contactid.md#readonly-key)
## Properties
### cf
• **cf**: *[ContactFeature](contactfeature.md)*
*Defined in [index.d.ts:31](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L31)*
___
### `Readonly` key
• **key**: *number*
*Defined in [index.d.ts:32](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L32)*

View File

@ -0,0 +1,115 @@
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [DistanceJointDef](distancejointdef.md)
# Interface: DistanceJointDef
## Hierarchy
↳ [JointDef](jointdef.md)
↳ [DistanceJointOpt](distancejointopt.md)
↳ **DistanceJointDef**
## Index
### Properties
* [bodyA](distancejointdef.md#bodya)
* [bodyB](distancejointdef.md#bodyb)
* [collideConnected](distancejointdef.md#optional-collideconnected)
* [dampingRatio](distancejointdef.md#dampingratio)
* [frequencyHz](distancejointdef.md#frequencyhz)
* [length](distancejointdef.md#length)
* [localAnchorA](distancejointdef.md#localanchora)
* [localAnchorB](distancejointdef.md#localanchorb)
* [userData](distancejointdef.md#optional-userdata)
## Properties
### bodyA
• **bodyA**: *[Body](../classes/body.md)*
*Inherited from [JointDef](jointdef.md).[bodyA](jointdef.md#bodya)*
*Defined in [joint/index.d.ts:56](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L56)*
___
### bodyB
• **bodyB**: *[Body](../classes/body.md)*
*Inherited from [JointDef](jointdef.md).[bodyB](jointdef.md#bodyb)*
*Defined in [joint/index.d.ts:57](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L57)*
___
### `Optional` collideConnected
• **collideConnected**? : *boolean*
*Inherited from [JointOpt](jointopt.md).[collideConnected](jointopt.md#optional-collideconnected)*
*Overrides [JointOpt](jointopt.md).[collideConnected](jointopt.md#optional-collideconnected)*
*Defined in [joint/index.d.ts:52](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L52)*
___
### dampingRatio
• **dampingRatio**: *number*
*Inherited from [DistanceJointOpt](distancejointopt.md).[dampingRatio](distancejointopt.md#dampingratio)*
*Defined in [joint/index.d.ts:102](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L102)*
___
### frequencyHz
• **frequencyHz**: *number*
*Inherited from [DistanceJointOpt](distancejointopt.md).[frequencyHz](distancejointopt.md#frequencyhz)*
*Defined in [joint/index.d.ts:101](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L101)*
___
### length
• **length**: *number*
*Inherited from [DistanceJointOpt](distancejointopt.md).[length](distancejointopt.md#length)*
*Defined in [joint/index.d.ts:103](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L103)*
___
### localAnchorA
• **localAnchorA**: *[Vec2](../classes/vec2.md)*
*Defined in [joint/index.d.ts:107](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L107)*
___
### localAnchorB
• **localAnchorB**: *[Vec2](../classes/vec2.md)*
*Defined in [joint/index.d.ts:108](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L108)*
___
### `Optional` userData
• **userData**? : *any*
*Inherited from [JointOpt](jointopt.md).[userData](jointopt.md#optional-userdata)*
*Overrides [JointOpt](jointopt.md).[userData](jointopt.md#optional-userdata)*
*Defined in [joint/index.d.ts:51](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L51)*

View File

@ -0,0 +1,65 @@
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [DistanceJointOpt](distancejointopt.md)
# Interface: DistanceJointOpt
## Hierarchy
* [JointOpt](jointopt.md)
↳ **DistanceJointOpt**
↳ [DistanceJointDef](distancejointdef.md)
## Index
### Properties
* [collideConnected](distancejointopt.md#optional-collideconnected)
* [dampingRatio](distancejointopt.md#dampingratio)
* [frequencyHz](distancejointopt.md#frequencyhz)
* [length](distancejointopt.md#length)
* [userData](distancejointopt.md#optional-userdata)
## Properties
### `Optional` collideConnected
• **collideConnected**? : *boolean*
*Inherited from [JointOpt](jointopt.md).[collideConnected](jointopt.md#optional-collideconnected)*
*Defined in [joint/index.d.ts:52](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L52)*
___
### dampingRatio
• **dampingRatio**: *number*
*Defined in [joint/index.d.ts:102](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L102)*
___
### frequencyHz
• **frequencyHz**: *number*
*Defined in [joint/index.d.ts:101](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L101)*
___
### length
• **length**: *number*
*Defined in [joint/index.d.ts:103](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L103)*
___
### `Optional` userData
• **userData**? : *any*
*Inherited from [JointOpt](jointopt.md).[userData](jointopt.md#optional-userdata)*
*Defined in [joint/index.d.ts:51](https://github.com/shakiba/planck.js/blob/038d425/lib/joint/index.d.ts#L51)*

View File

@ -0,0 +1,111 @@
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [FixtureDef](fixturedef.md)
# Interface: FixtureDef
## Hierarchy
* [FixtureOpt](fixtureopt.md)
↳ **FixtureDef**
## Index
### Properties
* [density](fixturedef.md#density)
* [filterCategoryBits](fixturedef.md#filtercategorybits)
* [filterGroupIndex](fixturedef.md#filtergroupindex)
* [filterMaskBits](fixturedef.md#filtermaskbits)
* [friction](fixturedef.md#friction)
* [isSensor](fixturedef.md#issensor)
* [restitution](fixturedef.md#restitution)
* [shape](fixturedef.md#shape)
* [userData](fixturedef.md#userdata)
## Properties
### density
• **density**: *number*
*Inherited from [FixtureOpt](fixtureopt.md).[density](fixtureopt.md#density)*
*Defined in [index.d.ts:137](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L137)*
___
### filterCategoryBits
• **filterCategoryBits**: *number*
*Inherited from [FixtureOpt](fixtureopt.md).[filterCategoryBits](fixtureopt.md#filtercategorybits)*
*Defined in [index.d.ts:140](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L140)*
___
### filterGroupIndex
• **filterGroupIndex**: *number*
*Inherited from [FixtureOpt](fixtureopt.md).[filterGroupIndex](fixtureopt.md#filtergroupindex)*
*Defined in [index.d.ts:139](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L139)*
___
### filterMaskBits
• **filterMaskBits**: *number*
*Inherited from [FixtureOpt](fixtureopt.md).[filterMaskBits](fixtureopt.md#filtermaskbits)*
*Defined in [index.d.ts:141](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L141)*
___
### friction
• **friction**: *number*
*Inherited from [FixtureOpt](fixtureopt.md).[friction](fixtureopt.md#friction)*
*Defined in [index.d.ts:135](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L135)*
___
### isSensor
• **isSensor**: *boolean*
*Inherited from [FixtureOpt](fixtureopt.md).[isSensor](fixtureopt.md#issensor)*
*Defined in [index.d.ts:138](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L138)*
___
### restitution
• **restitution**: *number*
*Inherited from [FixtureOpt](fixtureopt.md).[restitution](fixtureopt.md#restitution)*
*Defined in [index.d.ts:136](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L136)*
___
### shape
• **shape**: *[Shape](../classes/shape.md)*
*Defined in [index.d.ts:145](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L145)*
___
### userData
• **userData**: *any*
*Inherited from [FixtureOpt](fixtureopt.md).[userData](fixtureopt.md#userdata)*
*Defined in [index.d.ts:134](https://github.com/shakiba/planck.js/blob/038d425/lib/index.d.ts#L134)*

Some files were not shown because too many files have changed in this diff Show More