Showing preview only (1,110K chars total). Download the full file or copy to clipboard to get everything.
Repository: liabru/matter-js
Branch: master
Commit: acb99b6f8784
Files: 105
Total size: 1.0 MB
Directory structure:
gitextract_6pk11ypt/
├── .eslintignore
├── .eslintrc
├── .github/
│ └── workflows/
│ └── ci.yml
├── .gitignore
├── CHANGELOG.md
├── CONTRIBUTING.md
├── LICENSE
├── README.md
├── RELEASE.md
├── build/
│ └── matter.js
├── demo/
│ ├── index.html
│ └── src/
│ ├── Compare.js
│ ├── Demo.js
│ ├── Multi.js
│ ├── index.ejs
│ └── index.js
├── examples/
│ ├── airFriction.js
│ ├── avalanche.js
│ ├── ballPool.js
│ ├── bridge.js
│ ├── car.js
│ ├── catapult.js
│ ├── chains.js
│ ├── circleStack.js
│ ├── cloth.js
│ ├── collisionFiltering.js
│ ├── compositeManipulation.js
│ ├── compound.js
│ ├── compoundStack.js
│ ├── concave.js
│ ├── constraints.js
│ ├── doublePendulum.js
│ ├── events.js
│ ├── friction.js
│ ├── gravity.js
│ ├── gyro.js
│ ├── index.js
│ ├── manipulation.js
│ ├── mixed.js
│ ├── newtonsCradle.js
│ ├── pyramid.js
│ ├── ragdoll.js
│ ├── raycasting.js
│ ├── remove.js
│ ├── renderResize.js
│ ├── restitution.js
│ ├── rounded.js
│ ├── sensors.js
│ ├── sleeping.js
│ ├── slingshot.js
│ ├── softBody.js
│ ├── sprites.js
│ ├── stack.js
│ ├── staticFriction.js
│ ├── stats.js
│ ├── stress.js
│ ├── stress2.js
│ ├── stress3.js
│ ├── stress4.js
│ ├── substep.js
│ ├── svg.js
│ ├── terrain.js
│ ├── timescale.js
│ ├── views.js
│ └── wreckingBall.js
├── package.json
├── src/
│ ├── body/
│ │ ├── Body.js
│ │ ├── Composite.js
│ │ └── World.js
│ ├── collision/
│ │ ├── Collision.js
│ │ ├── Contact.js
│ │ ├── Detector.js
│ │ ├── Grid.js
│ │ ├── Pair.js
│ │ ├── Pairs.js
│ │ ├── Query.js
│ │ ├── Resolver.js
│ │ └── SAT.js
│ ├── constraint/
│ │ ├── Constraint.js
│ │ └── MouseConstraint.js
│ ├── core/
│ │ ├── Common.js
│ │ ├── Engine.js
│ │ ├── Events.js
│ │ ├── Matter.js
│ │ ├── Mouse.js
│ │ ├── Plugin.js
│ │ ├── Runner.js
│ │ └── Sleeping.js
│ ├── factory/
│ │ ├── Bodies.js
│ │ └── Composites.js
│ ├── geometry/
│ │ ├── Axes.js
│ │ ├── Bounds.js
│ │ ├── Svg.js
│ │ ├── Vector.js
│ │ └── Vertices.js
│ ├── module/
│ │ ├── license.js
│ │ └── main.js
│ └── render/
│ └── Render.js
├── test/
│ ├── Browser.spec.js
│ ├── ExampleWorker.js
│ ├── Examples.spec.js
│ └── TestTools.js
├── webpack.config.js
├── webpack.demo.config.js
└── yuidoc.json
================================================
FILE CONTENTS
================================================
================================================
FILE: .eslintignore
================================================
demo/js/Examples.js
================================================
FILE: .eslintrc
================================================
{
"rules": {
"no-fallthrough": 2,
"no-console": 0,
"no-unused-vars": 0,
"no-redeclare": 0,
"indent": [
2,
4
],
"semi": [
2,
"always"
]
},
"env": {
"node": true,
"browser": true,
"jquery": true,
"amd": true
},
"globals": {
"Matter": false,
"window": true,
"document": false,
"Element": false,
"MatterTools": false,
"phantom": false,
"process": false,
"HTMLElement": false,
"require": false,
"$": false,
"Image": false,
"navigator": false,
"setTimeout": false,
"decomp": false,
"module": false,
"Body": false,
"Composite": false,
"World": false,
"Contact": false,
"Detector": false,
"Grid": false,
"Pairs": false,
"Pair": false,
"Resolver": false,
"SAT": false,
"Constraint": false,
"MouseConstraint": false,
"Common": false,
"Engine": false,
"Mouse": false,
"Sleeping": false,
"Bodies": false,
"Composites": false,
"Axes": false,
"Bounds": false,
"Vector": false,
"Vertices": false,
"Render": false,
"Events": false,
"Query": false,
"Runner": false,
"Svg": false,
"Example": false,
"__MATTER_VERSION__": false,
"__MATTER_IS_DEV__": false,
"jest": false,
"test": false,
"expect": false,
"describe": false
},
"extends": "eslint:recommended"
}
================================================
FILE: .github/workflows/ci.yml
================================================
name: CI
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- run: npm ci
- run: npm run lint
- run: npm run build
- run: npm run build-demo
- run: npm run test
================================================
FILE: .gitignore
================================================
.idea
*.map
node_modules
npm-debug.log
docs
matter-doc-theme
build/matter-dev.js
build/matter-dev.min.js
build/matter.dev.js
build/matter.dev.min.js
demo/js/lib/matter-dev.js
demo/js/Examples.min.js
examples/build
test/browser/diffs
test/browser/refs
test/node/diffs
test/node/refs
__snapshots__
__compare__
================================================
FILE: CHANGELOG.md
================================================
## 0.20.0 (2024-06-23)
* added event passive options to Matter.Mouse, closes #930, closes #976 ([e888f3c](https://github.com/liabru/matter-js/commit/e888f3c)), closes [#930](https://github.com/liabru/matter-js/issues/930) [#976](https://github.com/liabru/matter-js/issues/976)
* added arrow key navigation of examples in development demo ([45cad77](https://github.com/liabru/matter-js/commit/45cad77))
* added body removal to Example.remove ([1209e88](https://github.com/liabru/matter-js/commit/1209e88))
* added Constraint.currentLength, closes #1184 ([812f8af](https://github.com/liabru/matter-js/commit/812f8af)), closes [#1184](https://github.com/liabru/matter-js/issues/1184)
* added doc and warning for `Bodies.trapezioid` slope parameter range, closes #1075 ([7ea5bc1](https://github.com/liabru/matter-js/commit/7ea5bc1)), closes [#1075](https://github.com/liabru/matter-js/issues/1075)
* added docs for `body.chamfer` property, closes #1059 ([5ed985d](https://github.com/liabru/matter-js/commit/5ed985d)), closes [#1059](https://github.com/liabru/matter-js/issues/1059)
* added engine beforeSolve event, closes #1173 ([8dd0e99](https://github.com/liabru/matter-js/commit/8dd0e99)), closes [#1173](https://github.com/liabru/matter-js/issues/1173)
* added event.timestamp and event.delta to collision events, closes #368 ([2af54d5](https://github.com/liabru/matter-js/commit/2af54d5)), closes [#368](https://github.com/liabru/matter-js/issues/368)
* added Example.renderResize ([b88c82f](https://github.com/liabru/matter-js/commit/b88c82f))
* added Example.stress4 ([0f0ac93](https://github.com/liabru/matter-js/commit/0f0ac93))
* added Example.substep ([205aaa5](https://github.com/liabru/matter-js/commit/205aaa5))
* added high delta warning to Matter.Engine ([72e6e89](https://github.com/liabru/matter-js/commit/72e6e89))
* added local pairs functions in Pairs.update ([e9da32c](https://github.com/liabru/matter-js/commit/e9da32c))
* added new Matter.Runner with default fixed timestep ([3e61951](https://github.com/liabru/matter-js/commit/3e61951))
* added pixel ratio scaling to render debug stats ([7ec38a1](https://github.com/liabru/matter-js/commit/7ec38a1))
* added render.options.wireframeStrokeStyle, closes #406 ([401553d](https://github.com/liabru/matter-js/commit/401553d)), closes [#406](https://github.com/liabru/matter-js/issues/406)
* added Render.setSize, closes #955, closes #595 ([fc05839](https://github.com/liabru/matter-js/commit/fc05839)), closes [#955](https://github.com/liabru/matter-js/issues/955) [#595](https://github.com/liabru/matter-js/issues/595)
* added repeats and updates options to test tools ([6142991](https://github.com/liabru/matter-js/commit/6142991))
* added updates per frame to Matter.Render debug ([a5b5767](https://github.com/liabru/matter-js/commit/a5b5767))
* changed Composte.removeComposite and Composte.removeBody to reset body.sleepCounter ([6d10c3d](https://github.com/liabru/matter-js/commit/6d10c3d))
* changed Pair.id format to use shorter ids ([5b6f30b](https://github.com/liabru/matter-js/commit/5b6f30b))
* fixed collision events for sleeping pairs, closes #1077 ([51f49ce](https://github.com/liabru/matter-js/commit/51f49ce)), closes [#1077](https://github.com/liabru/matter-js/issues/1077)
* fixed missing `mouse.sourceEvents.mousewheel`, closes #1146 ([272049a](https://github.com/liabru/matter-js/commit/272049a)), closes [#1146](https://github.com/liabru/matter-js/issues/1146)
* fixed Body.setStatic when applied multiple times, closes #641 ([9655785](https://github.com/liabru/matter-js/commit/9655785)), closes [#641](https://github.com/liabru/matter-js/issues/641)
* fixed compare tool layer order in demo testbed ([a3e801a](https://github.com/liabru/matter-js/commit/a3e801a)) ([0cc4d96](https://github.com/liabru/matter-js/commit/0cc4d96))
* fixed Runner.stop docs re. runner.enabled, closes #586, closes #1054 ([2ecc563](https://github.com/liabru/matter-js/commit/2ecc563)), closes [#586](https://github.com/liabru/matter-js/issues/586) [#1054](https://github.com/liabru/matter-js/issues/1054)
* improved Example.substep comments ([8046341](https://github.com/liabru/matter-js/commit/8046341))
* improved Matter.Runner ([b8a1563](https://github.com/liabru/matter-js/commit/b8a1563)) ([7206600](https://github.com/liabru/matter-js/commit/7206600))
* improved Matter.Runner docs ([283cd96](https://github.com/liabru/matter-js/commit/283cd96)) ([dc693e7](https://github.com/liabru/matter-js/commit/dc693e7)) ([6e302a8](https://github.com/liabru/matter-js/commit/6e302a8))
* improved test comparison report ([962fba5](https://github.com/liabru/matter-js/commit/962fba5)) ([2cc1c1c](https://github.com/liabru/matter-js/commit/2cc1c1c))
* improved `body.parts` docs ([013698b](https://github.com/liabru/matter-js/commit/013698b)) ([411af06](https://github.com/liabru/matter-js/commit/411af06)), closes #600 ([c1f9584](https://github.com/liabru/matter-js/commit/c1f9584)), closes [#600](https://github.com/liabru/matter-js/issues/600)
* optimised Collision._findSupports ([653a110](https://github.com/liabru/matter-js/commit/653a110))
* optimised Collision.collides ([6f8a54b](https://github.com/liabru/matter-js/commit/6f8a54b))
* optimised contacts and supports memory and gc use ([97d502e](https://github.com/liabru/matter-js/commit/97d502e))
* optimised pairs and collisions memory and gc use ([f9208df](https://github.com/liabru/matter-js/commit/f9208df))
* optimised Resolver.solvePosition ([89963f7](https://github.com/liabru/matter-js/commit/89963f7))
* optimised Resolver.solveVelocity ([182ba90](https://github.com/liabru/matter-js/commit/182ba90))
* preserve pair.contacts order ([e891d37](https://github.com/liabru/matter-js/commit/e891d37))
* reduced canvas hit testing in demo when using matter-tools ([da99acb](https://github.com/liabru/matter-js/commit/da99acb))
* removed redundant runner.isFixed from examples ([aba0e9e](https://github.com/liabru/matter-js/commit/aba0e9e))
* removed Collision._projectToAxis ([4c56e5b](https://github.com/liabru/matter-js/commit/4c56e5b))
* removed pair.confirmedActive ([72bc203](https://github.com/liabru/matter-js/commit/72bc203))
* renamed Composites function xx and yy params, closes #1095 ([6bda7e8](https://github.com/liabru/matter-js/commit/6bda7e8)), closes [#1095](https://github.com/liabru/matter-js/issues/1095)
* updated development demo render options ([0b131a4](https://github.com/liabru/matter-js/commit/0b131a4))
* updated benchmark tests ([e668c02](https://github.com/liabru/matter-js/commit/e668c02))
## 0.19.0 (2023-02-16)
See the release [readme](https://github.com/liabru/matter-js/blob/0.19.0/README.md) for further information.
* added readme note about vue watchers ([035481c](https://github.com/liabru/matter-js/commit/035481c))
* added readonly body.deltaTime ([0784a5b](https://github.com/liabru/matter-js/commit/0784a5b))
* added speed setters to Body.set ([3ff6ff4](https://github.com/liabru/matter-js/commit/3ff6ff4))
* added support for Matter.Runner and Matter.Render in tests ([7d7bad0](https://github.com/liabru/matter-js/commit/7d7bad0))
* added updateVelocity argument to Body.setPosition, Body.setAngle, Body.translate, Body.rotate ([db8b73f](https://github.com/liabru/matter-js/commit/db8b73f))
* changed engine collisionStart event to trigger after resolving and after updating body velocities ([70600a8](https://github.com/liabru/matter-js/commit/70600a8))
* changed examples to be delta independent ([d7e4f58](https://github.com/liabru/matter-js/commit/d7e4f58))
* deprecated render.controller property ([04d229e](https://github.com/liabru/matter-js/commit/04d229e))
* derived velocity from position in setters ([b6de9ed](https://github.com/liabru/matter-js/commit/b6de9ed))
* fixed issues with engine event.delta ([6f5af77](https://github.com/liabru/matter-js/commit/6f5af77))
* handle null constraint points in Constraint.pointAWorld and Constraint.pointBWorld ([e414464](https://github.com/liabru/matter-js/commit/e414464))
* improved Body.applyForce docs ([3a8264c](https://github.com/liabru/matter-js/commit/3a8264c))
* improved delta factors in resolver and constraint stiffness ([9dc6be7](https://github.com/liabru/matter-js/commit/9dc6be7))
* improved Matter.Body docs for functions and properties including readonly ([85a9eb2](https://github.com/liabru/matter-js/commit/85a9eb2))
* improved Matter.Engine docs ([50fc8f2](https://github.com/liabru/matter-js/commit/50fc8f2))
* improved slingshot example constraint ([c6a1a6d](https://github.com/liabru/matter-js/commit/c6a1a6d))
* improved delta consistency ([87af8a1](https://github.com/liabru/matter-js/commit/87af8a1))
* improved Example.newtonsCradle ([b2bd492](https://github.com/liabru/matter-js/commit/b2bd492))
* removed render element warning ([459425b](https://github.com/liabru/matter-js/commit/459425b))
* removed unused delta params ([a572968](https://github.com/liabru/matter-js/commit/a572968))
* updated body docs ([6bb2855](https://github.com/liabru/matter-js/commit/6bb2855))
* updated body velocity properties after resolving ([d52f7e6](https://github.com/liabru/matter-js/commit/d52f7e6))
* updated Example.manipulation ([5ddac71](https://github.com/liabru/matter-js/commit/5ddac71))
* updated Example.ragdoll ([ec38638](https://github.com/liabru/matter-js/commit/ec38638))
* updated Example.staticFriction and Example.timeScale ([11d5e73](https://github.com/liabru/matter-js/commit/11d5e73))
* updated Matter.Body docs ([db780c3](https://github.com/liabru/matter-js/commit/db780c3))
* updated timing improvements ([10a2a07](https://github.com/liabru/matter-js/commit/10a2a07))
* used Body.getVelocity in Matter.Render ([bf90bdd](https://github.com/liabru/matter-js/commit/bf90bdd))
* used speed getter in Matter.Sleeping and Matter.Render ([6579dfd](https://github.com/liabru/matter-js/commit/6579dfd))
## 0.18.0 (2021-12-15)
* added test capture sort to improve comparison ([ea3c11b](https://github.com/liabru/matter-js/commit/ea3c11b))
* added triangles to mixed bodies example ([b116f64](https://github.com/liabru/matter-js/commit/b116f64))
* added behaviour metric to tests and refactor tests ([8125966](https://github.com/liabru/matter-js/commit/8125966))
* added benchmark test command ([7f34c45](https://github.com/liabru/matter-js/commit/7f34c45))
* added broadphase to Matter.Detector ([a6b5e7d](https://github.com/liabru/matter-js/commit/a6b5e7d))
* added cache checks to Matter.Composite ([32fd285](https://github.com/liabru/matter-js/commit/32fd285))
* added example for Composite.remove ([bc07f56](https://github.com/liabru/matter-js/commit/bc07f56))
* added example stress 3 ([d0ee246](https://github.com/liabru/matter-js/commit/d0ee246))
* added filesize to test comparison report ([b3a8aa3](https://github.com/liabru/matter-js/commit/b3a8aa3))
* added Matter.Collision ([9037f36](https://github.com/liabru/matter-js/commit/9037f36))
* added memory comparison to tests ([bedf84c](https://github.com/liabru/matter-js/commit/bedf84c))
* added note about webpack performance to readme ([80cf76b](https://github.com/liabru/matter-js/commit/80cf76b))
* added stable sorting to test worker and refactor ([81dd2fb](https://github.com/liabru/matter-js/commit/81dd2fb))
* added support for build metadata in Plugin.versionParse ([8bfaff0](https://github.com/liabru/matter-js/commit/8bfaff0))
* changed raycasting example events to enable use in tests ([10afaea](https://github.com/liabru/matter-js/commit/10afaea))
* changed build config to 'source-map' devtool ([e909b04](https://github.com/liabru/matter-js/commit/e909b04))
* changed tests to use a production build rather than source ([55feb89](https://github.com/liabru/matter-js/commit/55feb89))
* deprecated Matter.Grid ([e366d0e](https://github.com/liabru/matter-js/commit/e366d0e))
* fixed sync issues on demo compare tool ([826ed46](https://github.com/liabru/matter-js/commit/826ed46))
* improved performance measurement accuracy in tests ([cd289ec](https://github.com/liabru/matter-js/commit/cd289ec))
* improved test comparison report ([de04c00](https://github.com/liabru/matter-js/commit/de04c00))
* optimised Matter.Detector ([c7cec16](https://github.com/liabru/matter-js/commit/c7cec16)), ([fd1a70e](https://github.com/liabru/matter-js/commit/fd1a70e)), ([caeb07e](https://github.com/liabru/matter-js/commit/caeb07e)), ([efede6e](https://github.com/liabru/matter-js/commit/efede6e))
* optimised Matter.Composite ([52e7977](https://github.com/liabru/matter-js/commit/52e7977))
* optimised Matter.Pair ([d8a6380](https://github.com/liabru/matter-js/commit/d8a6380)), ([48673db](https://github.com/liabru/matter-js/commit/48673db)), ([1073dde](https://github.com/liabru/matter-js/commit/1073dde))
* optimised Matter.Pairs ([a30707f](https://github.com/liabru/matter-js/commit/a30707f)), ([a882a74](https://github.com/liabru/matter-js/commit/a882a74))
* optimised Matter.Resolver ([fceb0ca](https://github.com/liabru/matter-js/commit/fceb0ca)), ([49fbfba](https://github.com/liabru/matter-js/commit/49fbfba)), ([0b07a31](https://github.com/liabru/matter-js/commit/0b07a31)), ([f847f4c](https://github.com/liabru/matter-js/commit/f847f4c)), ([3cf65e8](https://github.com/liabru/matter-js/commit/3cf65e8)), ([30b899c](https://github.com/liabru/matter-js/commit/30b899c)), ([e4b35d3](https://github.com/liabru/matter-js/commit/e4b35d3))
* optimised Matter.SAT ([0d90a17](https://github.com/liabru/matter-js/commit/0d90a17)), ([2096961](https://github.com/liabru/matter-js/commit/2096961)), ([0af144c](https://github.com/liabru/matter-js/commit/0af144c))
* optimised Matter.Vertices ([c198878](https://github.com/liabru/matter-js/commit/c198878)), ([6883d0d](https://github.com/liabru/matter-js/commit/6883d0d)), ([792ae2e](https://github.com/liabru/matter-js/commit/792ae2e))
* refactor test worker and prevent test cache ([ca2fe75](https://github.com/liabru/matter-js/commit/ca2fe75)), ([bcc3168](https://github.com/liabru/matter-js/commit/bcc3168))
* replaced Matter.SAT with Matter.Collision ([b9e7d9d](https://github.com/liabru/matter-js/commit/b9e7d9d))
* show debug stats in dev demo ([2f14ec5](https://github.com/liabru/matter-js/commit/2f14ec5))
* updated dev dependencies ([c5028d5](https://github.com/liabru/matter-js/commit/c5028d5))
* updated examples ([c80ed5c](https://github.com/liabru/matter-js/commit/c80ed5c))
* updated test scripts ([afa467a](https://github.com/liabru/matter-js/commit/afa467a))
* use force exit in tests ([8adf810](https://github.com/liabru/matter-js/commit/8adf810))
* use Matter.Runner in test worker ([2581595](https://github.com/liabru/matter-js/commit/2581595))
## <small>0.17.1 (2021-04-14)</small>
* deprecate Engine.run alias replaced by Runner.run ([5817046](https://github.com/liabru/matter-js/commit/5817046))
## 0.17.0 (2021-04-11)
* add Common.setDecomp and Common.getDecomp ([313c150](https://github.com/liabru/matter-js/commit/313c150))
* add demo build config and refactor demo ([653a647](https://github.com/liabru/matter-js/commit/653a647))
* add docs for all Matter.Render options ([ec3eecc](https://github.com/liabru/matter-js/commit/ec3eecc))
* add title to all examples ([f4d72ba](https://github.com/liabru/matter-js/commit/f4d72ba))
* added Common.deprecated ([ffa3193](https://github.com/liabru/matter-js/commit/ffa3193))
* added Common.warnOnce ([6957dbf](https://github.com/liabru/matter-js/commit/6957dbf))
* added Date.now fallback to Common.now, closes #739 ([c06c107](https://github.com/liabru/matter-js/commit/c06c107)), closes [#739](https://github.com/liabru/matter-js/issues/739)
* added debug stats and performance monitoring to Matter.Render ([119881b](https://github.com/liabru/matter-js/commit/119881b))
* added doc watch script ([164456b](https://github.com/liabru/matter-js/commit/164456b))
* added docs for additional engine timing and render properties ([8017bdb](https://github.com/liabru/matter-js/commit/8017bdb))
* added Example.stats ([9915007](https://github.com/liabru/matter-js/commit/9915007))
* added lastDelta and lastElapsed to engine.timing ([6dc703f](https://github.com/liabru/matter-js/commit/6dc703f))
* build demo ([0816454](https://github.com/liabru/matter-js/commit/0816454))
* change all examples to use Composite.add instead of the alias World.add ([a3f298f](https://github.com/liabru/matter-js/commit/a3f298f))
* changed engine.broadphase to engine.grid ([b74e400](https://github.com/liabru/matter-js/commit/b74e400))
* changed Example.views to use render events ([3ac3498](https://github.com/liabru/matter-js/commit/3ac3498))
* changed world.gravity to engine.gravity ([6abb3b7](https://github.com/liabru/matter-js/commit/6abb3b7))
* deprecated Composites.car and added to car example ([cd9c5d4](https://github.com/liabru/matter-js/commit/cd9c5d4))
* deprecated Composites.newtonsCradle and added to newtonsCradle example ([9ad980b](https://github.com/liabru/matter-js/commit/9ad980b))
* deprecated Composites.softBody and added to softBody and cloth examples ([818f354](https://github.com/liabru/matter-js/commit/818f354))
* improve Render.debug ([1753bf0](https://github.com/liabru/matter-js/commit/1753bf0))
* migrate Matter.World to the equivalent Matter.Composite ([5dbec9b](https://github.com/liabru/matter-js/commit/5dbec9b))
* remove deprecated backwards compatibility engine events from Matter.Runner ([76bf80e](https://github.com/liabru/matter-js/commit/76bf80e))
* remove deprecated backwards compatibility render integration from Matter.Engine ([1aa8ed0](https://github.com/liabru/matter-js/commit/1aa8ed0))
* remove deprecated backwards compatibility render integration from Matter.Runner ([6805f85](https://github.com/liabru/matter-js/commit/6805f85))
* remove deprecated Matter.Metrics ([63a9e98](https://github.com/liabru/matter-js/commit/63a9e98))
* remove deprecated Matter.RenderPixi ([08a515b](https://github.com/liabru/matter-js/commit/08a515b))
* remove unused render shadow function ([e49834d](https://github.com/liabru/matter-js/commit/e49834d))
* run all examples in browser tests ([5734bfd](https://github.com/liabru/matter-js/commit/5734bfd))
* set render showDebug option on examples stress and stress2 ([f2ef3aa](https://github.com/liabru/matter-js/commit/f2ef3aa))
* update matter-tools ([f8d366a](https://github.com/liabru/matter-js/commit/f8d366a))
## <small>0.16.1 (2021-01-31)</small>
* add log capture and reporting in tests ([7bfd3c2](https://github.com/liabru/matter-js/commit/7bfd3c2))
* add matter-wrap as dev dependency ([ef7c4c6](https://github.com/liabru/matter-js/commit/ef7c4c6))
* catch missing plugin require in examples ([1ba1255](https://github.com/liabru/matter-js/commit/1ba1255))
* change example matter-wrap require precedence ([aa1e4e7](https://github.com/liabru/matter-js/commit/aa1e4e7))
* change perf threshold in test ([7b00354](https://github.com/liabru/matter-js/commit/7b00354))
* change test worker decomp require ([5e746b0](https://github.com/liabru/matter-js/commit/5e746b0))
* disable jest cache ([8ee0ebb](https://github.com/liabru/matter-js/commit/8ee0ebb))
* enable useful dev server features ([839f7d9](https://github.com/liabru/matter-js/commit/839f7d9))
* fix decomp require and improve warning message ([e87f64a](https://github.com/liabru/matter-js/commit/e87f64a))
* fix dev server externals ([1f2f9fe](https://github.com/liabru/matter-js/commit/1f2f9fe))
* fix named require in test ([92080ff](https://github.com/liabru/matter-js/commit/92080ff))
* improve CI speed ([1af64eb](https://github.com/liabru/matter-js/commit/1af64eb))
* improve docs for Bodies.fromVertices ([2ade78f](https://github.com/liabru/matter-js/commit/2ade78f))
* improve stack examples with exact contact ([522f4e8](https://github.com/liabru/matter-js/commit/522f4e8))
* improve test report log ([b5326f8](https://github.com/liabru/matter-js/commit/b5326f8))
## 0.16.0 (2021-01-17)
* added removeDuplicatePoints option from poly-decomp 0.3.0 to Bodies.fromVertices ([#639](https://github.com/liabru/matter-js/issues/639), [947cb97](https://github.com/liabru/matter-js/commit/947cb97), [a9694e6](https://github.com/liabru/matter-js/commit/a9694e6))
* added support for > and >= operators in plugin version ranges ([0792716](https://github.com/liabru/matter-js/commit/0792716))
* added support for example versioning in tests ([31d0ace](https://github.com/liabru/matter-js/commit/31d0ace))
* added version targets for examples ([142b7de](https://github.com/liabru/matter-js/commit/142b7de))
* added warning check on browser tests ([12377cc](https://github.com/liabru/matter-js/commit/12377cc))
* changed svg and terrain example to use fetch ([5551cd5](https://github.com/liabru/matter-js/commit/5551cd5))
* changed deprecated comments to avoid confusion ([1e73cab](https://github.com/liabru/matter-js/commit/1e73cab))
* fixed poly-decomp external require ([882e07c](https://github.com/liabru/matter-js/commit/882e07c))
* removed bower.json ([f71d4c0](https://github.com/liabru/matter-js/commit/f71d4c0))
* removed unused dev dependency run-sequence ([be592fd](https://github.com/liabru/matter-js/commit/be592fd))
* updated dev dependencies ([151eb30](https://github.com/liabru/matter-js/commit/151eb30))
* updated matter-tools ([5c66458](https://github.com/liabru/matter-js/commit/5c66458))
* updated matter-tools ([33e8fe8](https://github.com/liabru/matter-js/commit/33e8fe8))
* updated demo matter-tools ([a694ae5](https://github.com/liabru/matter-js/commit/a694ae5))
* updated demo pathseg ([9c5325b](https://github.com/liabru/matter-js/commit/9c5325b))
* updated readme ([3089b41](https://github.com/liabru/matter-js/commit/3089b41))
## 0.15.0 (2020-12-24)
* add window global, stub require and handle bad values in test tools ([497ac80](https://github.com/liabru/matter-js/commit/497ac80))
* added Body.setCentre, closes #684, closes #461, closes #679 ([2ec247b](https://github.com/liabru/matter-js/commit/2ec247b)), closes [#684](https://github.com/liabru/matter-js/issues/684) [#461](https://github.com/liabru/matter-js/issues/461) [#679](https://github.com/liabru/matter-js/issues/679)
* added browser tests ([ceb7cd5](https://github.com/liabru/matter-js/commit/ceb7cd5))
* Added build comparison tools and tests ([b7c938a](https://github.com/liabru/matter-js/commit/b7c938a))
* added check for window in Common.now ([9ef9d02](https://github.com/liabru/matter-js/commit/9ef9d02))
* added comparison output file option to test tools ([45aae25](https://github.com/liabru/matter-js/commit/45aae25))
* Added config and test files to lint ([21e4ea6](https://github.com/liabru/matter-js/commit/21e4ea6))
* added Constraint.pointAWorld and Constraint.pointBWorld ([3c32969](https://github.com/liabru/matter-js/commit/3c32969))
* added examples to dev server bundle and commit built examples ([fe80478](https://github.com/liabru/matter-js/commit/fe80478))
* added module export to examples ([f9ea799](https://github.com/liabru/matter-js/commit/f9ea799))
* added overlap metric to test tools ([3fd674d](https://github.com/liabru/matter-js/commit/3fd674d))
* added release scripts ([341c247](https://github.com/liabru/matter-js/commit/341c247))
* added tag push to release task ([060283b](https://github.com/liabru/matter-js/commit/060283b))
* added timing to engine snapshot ([e0cdbb8](https://github.com/liabru/matter-js/commit/e0cdbb8))
* Added watch content base to dev server ([f471d4e](https://github.com/liabru/matter-js/commit/f471d4e))
* added webpack build script ([046013e](https://github.com/liabru/matter-js/commit/046013e))
* changed alpha build configuration ([182c84a](https://github.com/liabru/matter-js/commit/182c84a))
* changed demo to auto populate examples with sourceLink and init ([5b0d34b](https://github.com/liabru/matter-js/commit/5b0d34b))
* changed demo to serve without sub-directory ([823bbc0](https://github.com/liabru/matter-js/commit/823bbc0))
* changed docs build config ([864452d](https://github.com/liabru/matter-js/commit/864452d))
* changed example tests to use jest ([104d319](https://github.com/liabru/matter-js/commit/104d319))
* fix decomp import in Bodies.fromVertices ([94e9614](https://github.com/liabru/matter-js/commit/94e9614))
* fix decomp require ([0af1645](https://github.com/liabru/matter-js/commit/0af1645))
* fix issues with render pixel ratio, closes #686, closes #687 ([d577477](https://github.com/liabru/matter-js/commit/d577477)), closes [#686](https://github.com/liabru/matter-js/issues/686) [#687](https://github.com/liabru/matter-js/issues/687)
* fix lint ([5a0079d](https://github.com/liabru/matter-js/commit/5a0079d))
* fix lint issues ([9ca21c1](https://github.com/liabru/matter-js/commit/9ca21c1))
* fix path to build in test worker ([fcdb4fa](https://github.com/liabru/matter-js/commit/fcdb4fa))
* fix preversion script ([c368c14](https://github.com/liabru/matter-js/commit/c368c14))
* fix terrain example module export ([4a967ec](https://github.com/liabru/matter-js/commit/4a967ec))
* Fix typo in docs ([c486635](https://github.com/liabru/matter-js/commit/c486635))
* fixed plugins in compare ([82bb415](https://github.com/liabru/matter-js/commit/82bb415))
* implemented threaded comparison testing ([285d70d](https://github.com/liabru/matter-js/commit/285d70d))
* Optimized Body's hidden class ([b3220cf](https://github.com/liabru/matter-js/commit/b3220cf))
* Optimized Events.trigger method when no event is emitted ([b17cb48](https://github.com/liabru/matter-js/commit/b17cb48))
* remove gulp ([6a28090](https://github.com/liabru/matter-js/commit/6a28090))
* remove old demo libs ([13c7eb5](https://github.com/liabru/matter-js/commit/13c7eb5))
* removed unused gulp release tasks ([e5a7311](https://github.com/liabru/matter-js/commit/e5a7311))
* removed yuidocjs dev dependency ([ee848d2](https://github.com/liabru/matter-js/commit/ee848d2))
* Set loose build version on dev server ([1fcf292](https://github.com/liabru/matter-js/commit/1fcf292))
* update build script ([90abab6](https://github.com/liabru/matter-js/commit/90abab6))
* update default render theme ([d258411](https://github.com/liabru/matter-js/commit/d258411))
* update demo and example render styles ([6dd5ec5](https://github.com/liabru/matter-js/commit/6dd5ec5))
* update dependencies ([e1e058c](https://github.com/liabru/matter-js/commit/e1e058c)) ([5f5b8a1](https://github.com/liabru/matter-js/commit/5f5b8a1))
* update examples build config and scripts ([69afb11](https://github.com/liabru/matter-js/commit/69afb11))
* update package lock ([ac3da07](https://github.com/liabru/matter-js/commit/ac3da07))
* updated build scripts ([6b698ea](https://github.com/liabru/matter-js/commit/6b698ea))
* updated ci ([288b9cd](https://github.com/liabru/matter-js/commit/288b9cd))
* updated docs ([50cf171](https://github.com/liabru/matter-js/commit/50cf171))
* updated readme ([ea5c012](https://github.com/liabru/matter-js/commit/ea5c012)) ([61b1963](https://github.com/liabru/matter-js/commit/61b1963))
<a name="0.14.2"></a>
## <small>0.14.2 (2018-06-11)</small>
* added missing polyfill warning to Svg.pathToVertices ([511de5b](https://github.com/liabru/matter-js/commit/511de5b))
* fix Composite.bounds global issue, closes #627, closes #544 ([f7f77b4](https://github.com/liabru/matter-js/commit/f7f77b4)), closes [#627](https://github.com/liabru/matter-js/issues/627) [#544](https://github.com/liabru/matter-js/issues/544)
* fix docs for Vector.angle, closes #471 ([db30d79](https://github.com/liabru/matter-js/commit/db30d79)), closes [#471](https://github.com/liabru/matter-js/issues/471)
* Fixed constraint pointB documentation ([0b5ce1d](https://github.com/liabru/matter-js/commit/0b5ce1d))
* fixed require for external libraries, closes #629, closes #559, closes #593, closes #365, closes #62 ([0cf97f5](https://github.com/liabru/matter-js/commit/0cf97f5)), closes [#629](https://github.com/liabru/matter-js/issues/629) [#559](https://github.com/liabru/matter-js/issues/559) [#593](https://github.com/liabru/matter-js/issues/593) [#365](https://github.com/liabru/matter-js/issues/365) [#629](https://github.com/liabru/matter-js/issues/629)
* remove browserify-shim ([e3c176e](https://github.com/liabru/matter-js/commit/e3c176e))
* updated pathseg library, closes #548, closes #602, closes #424 ([1e5758f](https://github.com/liabru/matter-js/commit/1e5758f)), closes [#548](https://github.com/liabru/matter-js/issues/548) [#602](https://github.com/liabru/matter-js/issues/602) [#424](https://github.com/liabru/matter-js/issues/424)
<a name="0.14.1"></a>
## 0.14.1 (2018-01-10)
* fix Common.isElement on node, closes #535 ([ec38eeb](https://github.com/liabru/matter-js/commit/ec38eeb)), closes [#535](https://github.com/liabru/matter-js/issues/535)
<a name="0.14.0"></a>
# 0.14.0 (2017-11-30)
* added .eslintignore ([2279e15](https://github.com/liabru/matter-js/commit/2279e15))
* added examples build task ([6108a31](https://github.com/liabru/matter-js/commit/6108a31))
* added missing docs for Matter.World aliases ([841bf97](https://github.com/liabru/matter-js/commit/841bf97))
* added Query.collides, closes #478 ([6593a72](https://github.com/liabru/matter-js/commit/6593a72)), closes [#478](https://github.com/liabru/matter-js/issues/478)
* change examples to render using a fixed resolution ([0895d81](https://github.com/liabru/matter-js/commit/0895d81))
* Do not warn on missing render.element if the canvas is already parented (because it was passed in at ([a529ec9](https://github.com/liabru/matter-js/commit/a529ec9))
* fix `point` argument of Body.scale, closes #428 ([894c1ef](https://github.com/liabru/matter-js/commit/894c1ef)), closes [#428](https://github.com/liabru/matter-js/issues/428)
* fix Body.scale for compound bodies ([50a89d0](https://github.com/liabru/matter-js/commit/50a89d0))
* fix centroid for static compound bodies, closes #483 ([ece66e6](https://github.com/liabru/matter-js/commit/ece66e6)), closes [#483](https://github.com/liabru/matter-js/issues/483)
* fix Common.isElement, closes #501, closes #507, closes #459, closes #468, closes #517 ([18a0845](https://github.com/liabru/matter-js/commit/18a0845)), closes [#501](https://github.com/liabru/matter-js/issues/501) [#507](https://github.com/liabru/matter-js/issues/507) [#459](https://github.com/liabru/matter-js/issues/459) [#468](https://github.com/liabru/matter-js/issues/468) [#517](https://github.com/liabru/matter-js/issues/517)
* fix inertia change in Body.setMass, closes #378 ([f7d1877](https://github.com/liabru/matter-js/commit/f7d1877)), closes [#378](https://github.com/liabru/matter-js/issues/378)
* fix Vertices.chamfer radius argument, closes #467 ([3bceef4](https://github.com/liabru/matter-js/commit/3bceef4)), closes [#467](https://github.com/liabru/matter-js/issues/467)
* improved docs for constraints on compound bodies, closes #442 ([3307760](https://github.com/liabru/matter-js/commit/3307760)), closes [#442](https://github.com/liabru/matter-js/issues/442)
* moved all private functions to module namespaces ([64be5a5](https://github.com/liabru/matter-js/commit/64be5a5))
* moved private Matter.Engine functions on to namespace, closes #523 ([9eae36f](https://github.com/liabru/matter-js/commit/9eae36f)), closes [#523](https://github.com/liabru/matter-js/issues/523)
* remove spelling mistake ([e5c4b47](https://github.com/liabru/matter-js/commit/e5c4b47))
<a name="0.13.0"></a>
# 0.13.0 (2017-07-06)
* added Composite.bounds ([79ffcf8](https://github.com/liabru/matter-js/commit/79ffcf8))
* added constraint damping ([44c4d1f](https://github.com/liabru/matter-js/commit/44c4d1f))
* added constraint.render.type and constraint.render.anchor ([0952516](https://github.com/liabru/matter-js/commit/0952516))
* added Example.constraints ([b93c08f](https://github.com/liabru/matter-js/commit/b93c08f))
* added Example.doublePendulum ([a7aa47d](https://github.com/liabru/matter-js/commit/a7aa47d))
* added Examples.ragdoll ([48611c5](https://github.com/liabru/matter-js/commit/48611c5))
* added optional output argument to Vector.rotate ([59d62be](https://github.com/liabru/matter-js/commit/59d62be))
* added rotation point parameter to Body.rotate, closes #410 ([749ed50](https://github.com/liabru/matter-js/commit/749ed50)), closes [#410](https://github.com/liabru/matter-js/issues/410)
* added second pass for constraint solving ([f49d053](https://github.com/liabru/matter-js/commit/f49d053))
* change constraint solve order ([a5bd6b2](https://github.com/liabru/matter-js/commit/a5bd6b2))
* changed lint rules ([d1fbe95](https://github.com/liabru/matter-js/commit/d1fbe95))
* fix constraint.angularStiffness ([ab0283b](https://github.com/liabru/matter-js/commit/ab0283b))
* fix Example.collisionFiltering rendering ([74a7cfc](https://github.com/liabru/matter-js/commit/74a7cfc))
* fix lint errors ([774d8bc](https://github.com/liabru/matter-js/commit/774d8bc))
* fix soft body stiffness ([1bae2de](https://github.com/liabru/matter-js/commit/1bae2de))
* fixed Common.now ([2b76c4c](https://github.com/liabru/matter-js/commit/2b76c4c))
* fixed constraint torque calculation ([a8d1950](https://github.com/liabru/matter-js/commit/a8d1950))
* fixed constraint torque calculation ([068fdc0](https://github.com/liabru/matter-js/commit/068fdc0))
* fixed Examples.compound constraint offset ([e6babf0](https://github.com/liabru/matter-js/commit/e6babf0))
* fixed various constraints in examples ([ac67ef8](https://github.com/liabru/matter-js/commit/ac67ef8))
* fixed various problems with constraints ([26a60e4](https://github.com/liabru/matter-js/commit/26a60e4))
* implemented constraint warming ([daf26af](https://github.com/liabru/matter-js/commit/daf26af))
* improved Example.car using pin constraint ([130e6b3](https://github.com/liabru/matter-js/commit/130e6b3))
* improved Example.catapult using pin constraint ([0e15099](https://github.com/liabru/matter-js/commit/0e15099))
* improved Example.chains using pin constraint ([9d2f0ff](https://github.com/liabru/matter-js/commit/9d2f0ff))
* improved Examples.bridge ([b277b39](https://github.com/liabru/matter-js/commit/b277b39))
* improved Examples.bridge ([b6e5973](https://github.com/liabru/matter-js/commit/b6e5973))
* improved position resolver ([71998a0](https://github.com/liabru/matter-js/commit/71998a0))
* improved spring and pin rendering ([837c43b](https://github.com/liabru/matter-js/commit/837c43b))
* refactored Common.isElement ([295cffe](https://github.com/liabru/matter-js/commit/295cffe))
* removed Common.shadeColor ([d63b0c2](https://github.com/liabru/matter-js/commit/d63b0c2))
* tweaked Example.doublePendulum ([4894008](https://github.com/liabru/matter-js/commit/4894008))
* update alpha build ([fe9b05d](https://github.com/liabru/matter-js/commit/fe9b05d))
* update alpha build ([b874f4d](https://github.com/liabru/matter-js/commit/b874f4d))
* update alpha build ([08aa3f2](https://github.com/liabru/matter-js/commit/08aa3f2))
* update readme and remove redundant plugins ([2560a68](https://github.com/liabru/matter-js/commit/2560a68))
* Update README.md ([4168d3c](https://github.com/liabru/matter-js/commit/4168d3c))
* updated license and contributing ([d2af721](https://github.com/liabru/matter-js/commit/d2af721))
* updated readme ([26c1200](https://github.com/liabru/matter-js/commit/26c1200))
* upgraded matter-tools ([477f2d7](https://github.com/liabru/matter-js/commit/477f2d7))
* upgraded matter-wrap ([c9294eb](https://github.com/liabru/matter-js/commit/c9294eb))
<a name="0.12.0"></a>
# 0.12.0 (2017-02-02)
* add poly-decamp require shim ([c72a9d0](https://github.com/liabru/matter-js/commit/c72a9d0))
* added body.plugin, composite.plugin, constraint.plugin, engine.plugin properties ([b353393](https://github.com/liabru/matter-js/commit/b353393))
* added Render.lookAt ([47443b3](https://github.com/liabru/matter-js/commit/47443b3))
* added Render.startViewTransform and Render.endViewTransform ([c8e5d5c](https://github.com/liabru/matter-js/commit/c8e5d5c))
* change Matter.MouseConstraint to use engine beforeUpdate event, closes #73 ([ffb128c](https://github.com/liabru/matter-js/commit/ffb128c)), closes [#73](https://github.com/liabru/matter-js/issues/73)
* changed default render styles ([719ad64](https://github.com/liabru/matter-js/commit/719ad64))
* changed plugins to use body.plugin ([3fdf343](https://github.com/liabru/matter-js/commit/3fdf343))
* fix Body.setStatic(body, false), closes #187 ([a815ce4](https://github.com/liabru/matter-js/commit/a815ce4)), closes [#187](https://github.com/liabru/matter-js/issues/187)
* fix build temporarily ([805ff2a](https://github.com/liabru/matter-js/commit/805ff2a))
* fix lint ([0ce686d](https://github.com/liabru/matter-js/commit/0ce686d))
* fix lint ([714b8ae](https://github.com/liabru/matter-js/commit/714b8ae))
* fix Render.grid ([dd83386](https://github.com/liabru/matter-js/commit/dd83386))
* fix test npm script ([6285df9](https://github.com/liabru/matter-js/commit/6285df9))
* fix v8 optimisation issues ([86c4a61](https://github.com/liabru/matter-js/commit/86c4a61))
* Fixes #220 ([74de894](https://github.com/liabru/matter-js/commit/74de894)), closes [#220](https://github.com/liabru/matter-js/issues/220)
* improved demo and examples ([1a40f27](https://github.com/liabru/matter-js/commit/1a40f27))
* improved demo and examples ([ace1a9f](https://github.com/liabru/matter-js/commit/ace1a9f))
* improved demo and examples ([8cdbb38](https://github.com/liabru/matter-js/commit/8cdbb38))
* Update to latest poly-decomp.js API ([3d8f88e](https://github.com/liabru/matter-js/commit/3d8f88e))
* updated alpha build ([6c19f0b](https://github.com/liabru/matter-js/commit/6c19f0b))
* updated dependencies ([8c140bd](https://github.com/liabru/matter-js/commit/8c140bd))
* updated matter-tools ([def8d22](https://github.com/liabru/matter-js/commit/def8d22))
<a name="0.11.1"></a>
## 0.11.1 (2016-11-09)
* added derequire to build ([ded796c](https://github.com/liabru/matter-js/commit/ded796c))
<a name="0.11.0"></a>
# 0.11.0 (2016-11-04)
* add logo to readme ([d54dec3](https://github.com/liabru/matter-js/commit/d54dec3))
* added docs for Matter.Plugin with tweaks ([3883981](https://github.com/liabru/matter-js/commit/3883981))
* added Example.attractors ([758bbe8](https://github.com/liabru/matter-js/commit/758bbe8))
* added Matter.before, Matter.after, Common.chainPathBefore, Common.chainPathAfter, Common.get, Common ([50ad7ca](https://github.com/liabru/matter-js/commit/50ad7ca))
* added Matter.Plugin initial implementation ([e84c537](https://github.com/liabru/matter-js/commit/e84c537))
* added note in docs about vertices order ([ad033f5](https://github.com/liabru/matter-js/commit/ad033f5))
* added plugin status logging ([51b7b1d](https://github.com/liabru/matter-js/commit/51b7b1d))
* added plugins matter-attractors, matter-gravity, matter-world-wrap, removed test plugins ([59bfa0b](https://github.com/liabru/matter-js/commit/59bfa0b))
* change plugins to use best practices ([37d4258](https://github.com/liabru/matter-js/commit/37d4258))
* change travis node version to latest stable ([ee33686](https://github.com/liabru/matter-js/commit/ee33686))
* changed naming approach for prerelease versions ([83ae546](https://github.com/liabru/matter-js/commit/83ae546))
* fix build flags ([29d182c](https://github.com/liabru/matter-js/commit/29d182c))
* fix build task for travis ([6aa3661](https://github.com/liabru/matter-js/commit/6aa3661))
* fix gravity reset in demo ([c00df81](https://github.com/liabru/matter-js/commit/c00df81))
* fix gulp build version replacement ([faf6bec](https://github.com/liabru/matter-js/commit/faf6bec))
* fix Matter.Mouse when element does not have fixed dimensions, closes #73 ([1340159](https://github.com/liabru/matter-js/commit/1340159)), closes [#73](https://github.com/liabru/matter-js/issues/73)
* fix release tasks ([549983d](https://github.com/liabru/matter-js/commit/549983d))
* fix requestAnimationFrame polyfill for Matter.Runner, closes #252 ([7c8f6ce](https://github.com/liabru/matter-js/commit/7c8f6ce)), closes [#252](https://github.com/liabru/matter-js/issues/252)
* fix tests ([54e7d9c](https://github.com/liabru/matter-js/commit/54e7d9c))
* fixed Body.create with no options ([0e5a457](https://github.com/liabru/matter-js/commit/0e5a457))
* fixed issue with Matter.RenderPixi not being cleared when bodies removed, closes #218 ([4972af8](https://github.com/liabru/matter-js/commit/4972af8)), closes [#218](https://github.com/liabru/matter-js/issues/218)
* fixed various Matter.Plugin issues ([05d0961](https://github.com/liabru/matter-js/commit/05d0961))
* improve docs ([9856e3c](https://github.com/liabru/matter-js/commit/9856e3c))
* improved logging ([d4d64ed](https://github.com/liabru/matter-js/commit/d4d64ed))
* Limit packaging extraneous files ([3accec6](https://github.com/liabru/matter-js/commit/3accec6))
* Merge branch 'jackismissing-master' ([3452465](https://github.com/liabru/matter-js/commit/3452465))
* Merge branch 'master' of https://github.com/jackismissing/matter-js into jackismissing-master ([ba19130](https://github.com/liabru/matter-js/commit/ba19130))
* Merge branch 'plugins' ([60d0839](https://github.com/liabru/matter-js/commit/60d0839))
* Merge pull request #1 from jackismissing/jackismissing-patch-1 ([46a2bf6](https://github.com/liabru/matter-js/commit/46a2bf6))
* Merge pull request #244 from MarkHerhold/master ([3449ca5](https://github.com/liabru/matter-js/commit/3449ca5))
* refactor plugin system ([8da170f](https://github.com/liabru/matter-js/commit/8da170f))
* refactored plugins ([b4a3453](https://github.com/liabru/matter-js/commit/b4a3453))
* remove and ignore all test refs ([7a7187a](https://github.com/liabru/matter-js/commit/7a7187a))
* RenderPixi.js - added missing dependencies ([aec19ae](https://github.com/liabru/matter-js/commit/aec19ae))
* update Matter.Plugin docs ([6f8b705](https://github.com/liabru/matter-js/commit/6f8b705))
* updated edge build ([1d05499](https://github.com/liabru/matter-js/commit/1d05499))
* updated edge build ([0bdaece](https://github.com/liabru/matter-js/commit/0bdaece))
* updated readme ([a408854](https://github.com/liabru/matter-js/commit/a408854))
* updated readme ([4da2e25](https://github.com/liabru/matter-js/commit/4da2e25))
* updated readme ([9ccc028](https://github.com/liabru/matter-js/commit/9ccc028))
* updated readme ([faf534a](https://github.com/liabru/matter-js/commit/faf534a))
* updated readme ([5ca9aca](https://github.com/liabru/matter-js/commit/5ca9aca))
* updated readme ([e3e9080](https://github.com/liabru/matter-js/commit/e3e9080))
* updated readme ([c4cce9e](https://github.com/liabru/matter-js/commit/c4cce9e))
* updated readme ([4b5837e](https://github.com/liabru/matter-js/commit/4b5837e))
* updated readme ([098f224](https://github.com/liabru/matter-js/commit/098f224))
<a name="0.10.0"></a>
# 0.10.0 (2016-05-01)
* added release:push:docs task ([04cbd1d](https://github.com/liabru/matter-js/commit/04cbd1d))
* decouple Matter.Render from Matter.Engine ([de823eb](https://github.com/liabru/matter-js/commit/de823eb))
* decouple Matter.RenderPixi ([72f90b9](https://github.com/liabru/matter-js/commit/72f90b9))
* deprecated Matter.RenderPixi ([e8c899a](https://github.com/liabru/matter-js/commit/e8c899a))
* deprecated Matter.RenderPixi ([a6b97cd](https://github.com/liabru/matter-js/commit/a6b97cd))
* fix tests ([f59e220](https://github.com/liabru/matter-js/commit/f59e220))
* fix tests ([c26684e](https://github.com/liabru/matter-js/commit/c26684e))
* Merge branch 'decouple-renderer' ([31067c9](https://github.com/liabru/matter-js/commit/31067c9))
<a name="0.9.3"></a>
## 0.9.3 (2016-04-19)
* added readonly to docs for type property, closes #235 ([afd7531](https://github.com/liabru/matter-js/commit/afd7531)), closes [#235](https://github.com/liabru/matter-js/issues/235)
* Engine uses provided world; fixes issue #230 ([158c404](https://github.com/liabru/matter-js/commit/158c404)), closes [#230](https://github.com/liabru/matter-js/issues/230)
* fix issue with removed bodies causing collisions ([23a773a](https://github.com/liabru/matter-js/commit/23a773a))
* fix Matter.Engine.create docs to show element param is optional ([e2e7c0b](https://github.com/liabru/matter-js/commit/e2e7c0b))
* handle missing options in Engine.create ([f36fe2c](https://github.com/liabru/matter-js/commit/f36fe2c))
* improved release tasks ([e13d2d2](https://github.com/liabru/matter-js/commit/e13d2d2))
* Merge branch 'master' of github.com:liabru/matter-js ([d373172](https://github.com/liabru/matter-js/commit/d373172))
* Merge pull request #237 from iamjoshua/master ([b724959](https://github.com/liabru/matter-js/commit/b724959)), closes [#230](https://github.com/liabru/matter-js/issues/230)
* set release task to default to patch ([9d396fe](https://github.com/liabru/matter-js/commit/9d396fe))
* updated edge build ([7eb9ac7](https://github.com/liabru/matter-js/commit/7eb9ac7))
<a name="0.9.2"></a>
## 0.9.2 (2016-04-07)
* Add permeability example and doc entry ([6e7add1](https://github.com/liabru/matter-js/commit/6e7add1))
* Add permeable objects ([1573359](https://github.com/liabru/matter-js/commit/1573359))
* Change permeable name to sensors, add isSensor to Pair ([28084b0](https://github.com/liabru/matter-js/commit/28084b0))
* Document World bounds and Grid bucket size. ([5054c97](https://github.com/liabru/matter-js/commit/5054c97))
* fix Body.scale for circles, closes #234 ([f428d6b](https://github.com/liabru/matter-js/commit/f428d6b)), closes [#234](https://github.com/liabru/matter-js/issues/234)
* Fix the out-of-bounds check in grid broadphase ([a20a9fb](https://github.com/liabru/matter-js/commit/a20a9fb))
* Merge pull request #224 from brollb/223-bounds-ignored-in-renderer ([1944f6a](https://github.com/liabru/matter-js/commit/1944f6a)), closes [#223](https://github.com/liabru/matter-js/issues/223)
* Merge pull request #231 from Rantanen/patch-1 ([b6f6a03](https://github.com/liabru/matter-js/commit/b6f6a03))
* Merge pull request #232 from Rantanen/docs ([79fa57e](https://github.com/liabru/matter-js/commit/79fa57e))
* Merged sensors from Misiur-master ([e1a52d5](https://github.com/liabru/matter-js/commit/e1a52d5))
* Update README.md ([a5b535d](https://github.com/liabru/matter-js/commit/a5b535d))
* Update README.md ([a31ab39](https://github.com/liabru/matter-js/commit/a31ab39))
* Updated `hasBounds` default value. Fixes #223 ([053ea76](https://github.com/liabru/matter-js/commit/053ea76)), closes [#223](https://github.com/liabru/matter-js/issues/223)
* updated test refs ([93ba111](https://github.com/liabru/matter-js/commit/93ba111))
<a name="0.9.1"></a>
## 0.9.1 (2016-02-15)
* added default for delta parameter in Engine.update, closes #200 ([490d232](https://github.com/liabru/matter-js/commit/490d232)), closes [#200](https://github.com/liabru/matter-js/issues/200)
* added docs for body.render.opacity ([adcb610](https://github.com/liabru/matter-js/commit/adcb610))
* added SVGPathSeg polyfill, closes #196 ([8fcb893](https://github.com/liabru/matter-js/commit/8fcb893)), closes [#196](https://github.com/liabru/matter-js/issues/196)
* Adding the opacity attribute to be able to draw semi-transarent sprites ([5b755a1](https://github.com/liabru/matter-js/commit/5b755a1))
* allow passing of pixi objects to Matter.RenderPixi at creation, closes #193 ([dbdabcc](https://github.com/liabru/matter-js/commit/dbdabcc)), closes [#193](https://github.com/liabru/matter-js/issues/193)
* change main reference in package.json ([633c305](https://github.com/liabru/matter-js/commit/633c305))
* Changed bounds checking MIN_VALUE to -MAX_VALUE. Fixes #202 ([dd5e260](https://github.com/liabru/matter-js/commit/dd5e260)), closes [#202](https://github.com/liabru/matter-js/issues/202)
* fix issue with Bodies.circle label option, closes #195 ([e7e8c26](https://github.com/liabru/matter-js/commit/e7e8c26)), closes [#195](https://github.com/liabru/matter-js/issues/195)
* fix lint issue ([b4e875b](https://github.com/liabru/matter-js/commit/b4e875b))
* fixed build issue ([bb3d43f](https://github.com/liabru/matter-js/commit/bb3d43f))
* fixed rendering of angle indicators ([aaffee3](https://github.com/liabru/matter-js/commit/aaffee3))
* fixed rendering of compound bodies ([99dd6c5](https://github.com/liabru/matter-js/commit/99dd6c5))
* fixes to body opacity rendering ([8ac06b2](https://github.com/liabru/matter-js/commit/8ac06b2))
* Merge branch 'master' of https://github.com/ma1069/matter-js into ma1069-master ([c99e6af](https://github.com/liabru/matter-js/commit/c99e6af))
* Merge pull request #199 from kevinboudot/master ([34fa27a](https://github.com/liabru/matter-js/commit/34fa27a))
* remove redundant console.log from gulpfile ([b5006e3](https://github.com/liabru/matter-js/commit/b5006e3))
* Update README.md ([1bfb758](https://github.com/liabru/matter-js/commit/1bfb758))
* updated edge build ([cc80837](https://github.com/liabru/matter-js/commit/cc80837))
* updated test refs ([cfdc0b3](https://github.com/liabru/matter-js/commit/cfdc0b3))
* updated test refs ([4d65dd1](https://github.com/liabru/matter-js/commit/4d65dd1))
<a name="0.9.0"></a>
# 0.9.0 (2016-01-16)
### release summary
* improved documentation
* improved performance
* improved stability
* improved accuracy
* improved friction
* improved sleeping
* improved constraints
* improved examples
* added concave body support
* added compound body support
* added collision filters
* added Matter.Body property setters
* added Matter.Sleeping events
* added Matter.Composite events
* added Matter.Composite transforms
* added Matter.MouseConstraint events
* added Matter.Render events
* added Matter.Runner
* added support for nodejs
* added support for high dpi rendering
* added multiple examples
* added automated tests
* migrated from grunt to gulp
* migrated to browserify
* migrated to pixi.js v3
* fixed multiple issues (see commit log)
### commit log
* Add Pixi DisplayObjectContainer to allow view bounds in webGL ([97f0f8d](https://github.com/liabru/matter-js/commit/97f0f8d))
* added beforeRender and afterRender events to Matter.Render ([aa48322](https://github.com/liabru/matter-js/commit/aa48322))
* added body sleepStart and sleepEnd events, closes #91 ([bc26469](https://github.com/liabru/matter-js/commit/bc26469)), closes [#91](https://github.com/liabru/matter-js/issues/91)
* added Body.nextCategory ([d249165](https://github.com/liabru/matter-js/commit/d249165))
* added Body.set ([235b6c8](https://github.com/liabru/matter-js/commit/235b6c8))
* added Body.setMass, Body.setDensity, Body.setInertia ([ca978fa](https://github.com/liabru/matter-js/commit/ca978fa))
* added Body.setPosition, Body.setAngle, Body.setVelocity, Body.setAngularVelocity ([7ed28f7](https://github.com/liabru/matter-js/commit/7ed28f7))
* added Body.setVertices and Vector.clone ([b6dbb25](https://github.com/liabru/matter-js/commit/b6dbb25))
* added building and contributing to readme ([9a59e34](https://github.com/liabru/matter-js/commit/9a59e34))
* added collisionFilter support to MouseConstraint ([cee8d55](https://github.com/liabru/matter-js/commit/cee8d55))
* added composite events ([2841522](https://github.com/liabru/matter-js/commit/2841522))
* added composite events example to Demo.events ([296d47e](https://github.com/liabru/matter-js/commit/296d47e))
* added Composite.translate, Composite.rotate, Composite.scale ([4c4962f](https://github.com/liabru/matter-js/commit/4c4962f))
* added compound support to Query.ray ([10e5d0f](https://github.com/liabru/matter-js/commit/10e5d0f))
* added constraint to Demo.compound ([87fbf51](https://github.com/liabru/matter-js/commit/87fbf51))
* added CONTRIBUTING.md ([7c936d5](https://github.com/liabru/matter-js/commit/7c936d5))
* added CONTRIBUTING.md ([261c794](https://github.com/liabru/matter-js/commit/261c794))
* added Demo.compositeManipulation ([4051823](https://github.com/liabru/matter-js/commit/4051823))
* added Demo.compound ([b7bf5d6](https://github.com/liabru/matter-js/commit/b7bf5d6))
* added Demo.concave, added Bodies.fromVertices, added Vertices.isConvex, fixed compound properties ([0b8efa5](https://github.com/liabru/matter-js/commit/0b8efa5))
* added Demo.manipulation ([0a453a2](https://github.com/liabru/matter-js/commit/0a453a2))
* added Demo.setManualControl ([203252a](https://github.com/liabru/matter-js/commit/203252a))
* added Demo.slingshot ([3043baa](https://github.com/liabru/matter-js/commit/3043baa))
* added Demo.staticFriction ([4491dfd](https://github.com/liabru/matter-js/commit/4491dfd))
* added Demo.svg, Demo.compoundStack, Demo.concave ([17589bc](https://github.com/liabru/matter-js/commit/17589bc))
* added Demo.terrain ([3132d70](https://github.com/liabru/matter-js/commit/3132d70))
* added docs ([200fcbe](https://github.com/liabru/matter-js/commit/200fcbe))
* added docs for engine.timing.isFixed ([e22ceeb](https://github.com/liabru/matter-js/commit/e22ceeb))
* added drag events to MouseConstraint, closes #45 ([c254c8d](https://github.com/liabru/matter-js/commit/c254c8d)), closes [#45](https://github.com/liabru/matter-js/issues/45)
* added early out in Constraint.postSolveAll, pass body.velocity when updating bounds ([8210dbe](https://github.com/liabru/matter-js/commit/8210dbe))
* added internal edge flagging to Bodies.fromVertices ([ca75fde](https://github.com/liabru/matter-js/commit/ca75fde))
* added Matter.Svg.pathToPoints ([7822ead](https://github.com/liabru/matter-js/commit/7822ead))
* added Matter.version ([e0a6de0](https://github.com/liabru/matter-js/commit/e0a6de0))
* added Matter.World extends Matter.Composite to docs ([b3921fb](https://github.com/liabru/matter-js/commit/b3921fb))
* added minimum area check to Bodies.fromVertices ([bf11ee5](https://github.com/liabru/matter-js/commit/bf11ee5))
* added missing dependency to Render.js ([df5f16c](https://github.com/liabru/matter-js/commit/df5f16c))
* added mouse constraint collision mask example to demo ([440e9d2](https://github.com/liabru/matter-js/commit/440e9d2))
* added Mouse.create warning for omitted element ([af83e27](https://github.com/liabru/matter-js/commit/af83e27))
* added MouseConstraint.create warning for omitted element ([b6603ca](https://github.com/liabru/matter-js/commit/b6603ca))
* added node demo tests ([71c1ae8](https://github.com/liabru/matter-js/commit/71c1ae8))
* added options to Metrics.create ([1b7e27d](https://github.com/liabru/matter-js/commit/1b7e27d))
* added Query.point ([98ea7c7](https://github.com/liabru/matter-js/commit/98ea7c7))
* added release tasks ([5479fbc](https://github.com/liabru/matter-js/commit/5479fbc))
* added Render.create warning for omitted element ([0583cdb](https://github.com/liabru/matter-js/commit/0583cdb))
* added render.options.showMousePosition ([e191d44](https://github.com/liabru/matter-js/commit/e191d44))
* added Render.showInternalEdges, added rendering bounds + axes + positions for compounds, fixed rende ([5ab2bf3](https://github.com/liabru/matter-js/commit/5ab2bf3))
* added Render.vertexNumbers, Render.bodyConvexHulls ([9c139ed](https://github.com/liabru/matter-js/commit/9c139ed))
* added Runner.create and Runner.tick ([5c69f2e](https://github.com/liabru/matter-js/commit/5c69f2e))
* added source link to demo ([1e756d3](https://github.com/liabru/matter-js/commit/1e756d3))
* added sprite offsets relative to centre of mass, closes #153 ([3de9d00](https://github.com/liabru/matter-js/commit/3de9d00)), closes [#153](https://github.com/liabru/matter-js/issues/153)
* added startdrag and enddrag events to Demo.events ([7c75614](https://github.com/liabru/matter-js/commit/7c75614))
* added support for compound bodies in MouseConstraint ([d6829bf](https://github.com/liabru/matter-js/commit/d6829bf))
* added support for hidpi rendering ([4746eb9](https://github.com/liabru/matter-js/commit/4746eb9))
* added support for multiple vertices input in Bodies.fromVertices ([e8205f8](https://github.com/liabru/matter-js/commit/e8205f8))
* added support for sprite scale in RenderPixi, closes #54 ([8dea166](https://github.com/liabru/matter-js/commit/8dea166)), closes [#54](https://github.com/liabru/matter-js/issues/54)
* added testDemo to grunt test ([08c5648](https://github.com/liabru/matter-js/commit/08c5648))
* added time scaling to Sleeping ([0ae2d02](https://github.com/liabru/matter-js/commit/0ae2d02))
* added Vector.create ([b327a40](https://github.com/liabru/matter-js/commit/b327a40))
* Allow for negative force to bring a body out of sleeping state. ([d585e80](https://github.com/liabru/matter-js/commit/d585e80))
* appease jshint ([89140ae](https://github.com/liabru/matter-js/commit/89140ae))
* appease jshint ([18a2627](https://github.com/liabru/matter-js/commit/18a2627))
* change browser tests to use JSON.stringify ([75af920](https://github.com/liabru/matter-js/commit/75af920))
* change gravity scale to variable rather than a constant ([a38b227](https://github.com/liabru/matter-js/commit/a38b227))
* change main to edge build ([9d0e82b](https://github.com/liabru/matter-js/commit/9d0e82b))
* change travis to only lint rather than full test (until tests are finished and documented) ([ce478cb](https://github.com/liabru/matter-js/commit/ce478cb))
* change world.bounds to Infinity, remove world bounds check from Engine, closes #67 ([8b5192d](https://github.com/liabru/matter-js/commit/8b5192d)), closes [#67](https://github.com/liabru/matter-js/issues/67)
* changed Body._initProperties to use Body.setVertices ([2d04389](https://github.com/liabru/matter-js/commit/2d04389))
* changed bower main to build/matter.js ([7412335](https://github.com/liabru/matter-js/commit/7412335))
* changed certain Matter.Composite methods to private in docs ([8aa148d](https://github.com/liabru/matter-js/commit/8aa148d))
* changed Common.log to use console.warn ([c220f41](https://github.com/liabru/matter-js/commit/c220f41))
* changed default minimum area in Bodies.fromVertices ([998ab33](https://github.com/liabru/matter-js/commit/998ab33))
* changed demo to use Matter.Runner and Matter.Render events ([a1d4748](https://github.com/liabru/matter-js/commit/a1d4748))
* changed friction impulse limiting approach ([de4784c](https://github.com/liabru/matter-js/commit/de4784c))
* changed Grid.create to accept an options object ([eedd1f2](https://github.com/liabru/matter-js/commit/eedd1f2))
* changed jquery reference (matter-tools) to local copy ([0849773](https://github.com/liabru/matter-js/commit/0849773))
* changed Math.random to Common.random and use a seeded RNG ([0a46cb2](https://github.com/liabru/matter-js/commit/0a46cb2))
* changed Mouse.create to return as a plain object ([eaa9767](https://github.com/liabru/matter-js/commit/eaa9767))
* changed Render.bodyIds to show all parts ([3ed8034](https://github.com/liabru/matter-js/commit/3ed8034))
* changed Sleeping constants to be public (module level) ([7eadea9](https://github.com/liabru/matter-js/commit/7eadea9))
* changed vertex number render fillstyle ([bc88406](https://github.com/liabru/matter-js/commit/bc88406))
* changed Vertices.create and Vertices.fromPath to create and return a new array rather than apply in- ([e3e462e](https://github.com/liabru/matter-js/commit/e3e462e))
* cleanup ([5888ffc](https://github.com/liabru/matter-js/commit/5888ffc))
* cleanup Svg.pathToPoints ([8bf3278](https://github.com/liabru/matter-js/commit/8bf3278))
* cleanup Svg.pathToVertices ([7db3d28](https://github.com/liabru/matter-js/commit/7db3d28))
* demo tweaks ([d55c700](https://github.com/liabru/matter-js/commit/d55c700))
* demo tweaks ([22445c7](https://github.com/liabru/matter-js/commit/22445c7))
* disabled angle indicators on some demos ([74bc8ae](https://github.com/liabru/matter-js/commit/74bc8ae))
* don't calculate gravity force if there is no actual gravity ([e54802c](https://github.com/liabru/matter-js/commit/e54802c))
* dont draw offscreen constraints. Set visible flag on offscreen sprites ([e263ecb](https://github.com/liabru/matter-js/commit/e263ecb))
* Ensure passed canvas abides by render options ([0b51dd6](https://github.com/liabru/matter-js/commit/0b51dd6))
* expose demo instance externally ([a9122ed](https://github.com/liabru/matter-js/commit/a9122ed))
* fix angle indicators for compound bodies ([8031090](https://github.com/liabru/matter-js/commit/8031090))
* fix bug in Composites.stack when skipping bodies ([b34669e](https://github.com/liabru/matter-js/commit/b34669e))
* fix bug when using timing.isFixed, closes #44 ([0933620](https://github.com/liabru/matter-js/commit/0933620)), closes [#44](https://github.com/liabru/matter-js/issues/44)
* fix concat dependency ([84a22ba](https://github.com/liabru/matter-js/commit/84a22ba))
* fix demo for tests ([5e6b22b](https://github.com/liabru/matter-js/commit/5e6b22b))
* fix Demo.reset to fully reset ids ([500d566](https://github.com/liabru/matter-js/commit/500d566))
* fix Demo.stress stability ([d0fdd29](https://github.com/liabru/matter-js/commit/d0fdd29))
* Fix for travis ([05f1c46](https://github.com/liabru/matter-js/commit/05f1c46))
* fix grunt for travis ([d405910](https://github.com/liabru/matter-js/commit/d405910))
* fix grunt for travis ([f55d806](https://github.com/liabru/matter-js/commit/f55d806))
* fix gulp issues ([4173e70](https://github.com/liabru/matter-js/commit/4173e70))
* fix gulp issues ([3bd556d](https://github.com/liabru/matter-js/commit/3bd556d))
* fix handling of engine.render ([c46e915](https://github.com/liabru/matter-js/commit/c46e915))
* fix issue in Render.inspector on Chrome ([86fcfcd](https://github.com/liabru/matter-js/commit/86fcfcd))
* fix issue of undefined body.parts in constructor ([9d3755a](https://github.com/liabru/matter-js/commit/9d3755a))
* fix issue when Bodies.trapezoid slope === 1, closes #138 ([449774c](https://github.com/liabru/matter-js/commit/449774c)), closes [#138](https://github.com/liabru/matter-js/issues/138)
* fix issue with mouse when changing renderers, closes #96 ([796faeb](https://github.com/liabru/matter-js/commit/796faeb)), closes [#96](https://github.com/liabru/matter-js/issues/96)
* fix issue with Render.debug when no timing passed, closes #171 and #176 ([087fab2](https://github.com/liabru/matter-js/commit/087fab2)), closes [#171](https://github.com/liabru/matter-js/issues/171) [#176](https://github.com/liabru/matter-js/issues/176)
* fix jshint ([b0f72ab](https://github.com/liabru/matter-js/commit/b0f72ab))
* fix lint issue ([9a599f1](https://github.com/liabru/matter-js/commit/9a599f1))
* fix Matter.Demo for node ([2de1161](https://github.com/liabru/matter-js/commit/2de1161))
* fix Matter.Demo for node ([06eea3e](https://github.com/liabru/matter-js/commit/06eea3e))
* fix Matter.Runner for node ([ad55b85](https://github.com/liabru/matter-js/commit/ad55b85))
* fix mobile demo, remove dev.html, fix debug info rendering ([9d5c27a](https://github.com/liabru/matter-js/commit/9d5c27a))
* fix orientation event bug in DemoMobile ([f770a7c](https://github.com/liabru/matter-js/commit/f770a7c))
* fix pair properties for compounds ([b8f3784](https://github.com/liabru/matter-js/commit/b8f3784))
* fix runner for tests, limit precision of refs ([352bfd6](https://github.com/liabru/matter-js/commit/352bfd6))
* fix standalone option ([de16529](https://github.com/liabru/matter-js/commit/de16529))
* fix support for nodejs ([b669ea0](https://github.com/liabru/matter-js/commit/b669ea0))
* fix tests ([eccf0a7](https://github.com/liabru/matter-js/commit/eccf0a7))
* fix travis ([3ce6c3a](https://github.com/liabru/matter-js/commit/3ce6c3a))
* fix travis issue ([131ed5e](https://github.com/liabru/matter-js/commit/131ed5e))
* fix undefined variables, added jshint checks, closes #102 ([536e55f](https://github.com/liabru/matter-js/commit/536e55f)), closes [#102](https://github.com/liabru/matter-js/issues/102)
* fixed Body.rotate ([c5212e1](https://github.com/liabru/matter-js/commit/c5212e1))
* fixed Body.setVertices ([73ded98](https://github.com/liabru/matter-js/commit/73ded98))
* fixed bug in constraints for compounds ([13fcb4b](https://github.com/liabru/matter-js/commit/13fcb4b))
* fixed bug in Demo.reset that was creating multiple MouseConstraint ([8204d97](https://github.com/liabru/matter-js/commit/8204d97))
* fixed build tasks ([69ff33f](https://github.com/liabru/matter-js/commit/69ff33f))
* fixed build tasks, closes #161 ([d1b8705](https://github.com/liabru/matter-js/commit/d1b8705)), closes [#161](https://github.com/liabru/matter-js/issues/161)
* fixed chaining for some Matter.Vertices methods ([8746185](https://github.com/liabru/matter-js/commit/8746185))
* fixed collision detection issue, closes #12 ([3e48825](https://github.com/liabru/matter-js/commit/3e48825)), closes [#12](https://github.com/liabru/matter-js/issues/12)
* fixed collision incident and reference body mapping ([757fffa](https://github.com/liabru/matter-js/commit/757fffa))
* fixed collision rendering ([bc9a051](https://github.com/liabru/matter-js/commit/bc9a051))
* fixed Common.now, closes #55 ([8555c0c](https://github.com/liabru/matter-js/commit/8555c0c)), closes [#55](https://github.com/liabru/matter-js/issues/55)
* fixed compound body stability, improved position resolver ([e01dd22](https://github.com/liabru/matter-js/commit/e01dd22))
* fixed critical inertia calculation issue, a potential breaking change, so Body._inertiaScale added t ([9a55b0c](https://github.com/liabru/matter-js/commit/9a55b0c))
* fixed Example.timescale ([19656cd](https://github.com/liabru/matter-js/commit/19656cd))
* fixed friction in Demo.manipulation ([95ae911](https://github.com/liabru/matter-js/commit/95ae911))
* fixed gulp shell task args ([c2b0f30](https://github.com/liabru/matter-js/commit/c2b0f30))
* fixed incorrect bounds issue when passing angle in Body.create ([810bd26](https://github.com/liabru/matter-js/commit/810bd26))
* fixed issue with Body.applyForce torque, closes #64 ([3f9364c](https://github.com/liabru/matter-js/commit/3f9364c)), closes [#64](https://github.com/liabru/matter-js/issues/64)
* fixed issue with docs ([3a16f90](https://github.com/liabru/matter-js/commit/3a16f90))
* fixed issue with MouseConstraint.create, closes #185 ([dff0e30](https://github.com/liabru/matter-js/commit/dff0e30)), closes [#185](https://github.com/liabru/matter-js/issues/185)
* fixed issues with friction stability ([1db98a3](https://github.com/liabru/matter-js/commit/1db98a3))
* Fixed missed variable declaration. ([a940d96](https://github.com/liabru/matter-js/commit/a940d96))
* fixed options pass through on Bodies.fromVertices ([eb29367](https://github.com/liabru/matter-js/commit/eb29367))
* fixed Query.ray, Number.MIN_VALUE seems to cause SAT.collides to fail ([ccbb98b](https://github.com/liabru/matter-js/commit/ccbb98b))
* fixed RenderPixi for compound bodies ([6679b9c](https://github.com/liabru/matter-js/commit/6679b9c))
* fixed SAT overlap calculation for containment case ([685f2bd](https://github.com/liabru/matter-js/commit/685f2bd))
* fixed scaling on RenderPixi view bounds ([c1964e2](https://github.com/liabru/matter-js/commit/c1964e2))
* fixed support finding logic ([bc7dfc7](https://github.com/liabru/matter-js/commit/bc7dfc7))
* fixed Vertices.fromPath when parsing scientific notation ([dae684d](https://github.com/liabru/matter-js/commit/dae684d))
* fixes for compound bodies ([87f9065](https://github.com/liabru/matter-js/commit/87f9065))
* formatting merge ([d4cbdbb](https://github.com/liabru/matter-js/commit/d4cbdbb))
* further work on compound implementation ([d2f79b4](https://github.com/liabru/matter-js/commit/d2f79b4))
* hide axis indicator on compound bodies ([6a26696](https://github.com/liabru/matter-js/commit/6a26696))
* ignoring .idea ([066a416](https://github.com/liabru/matter-js/commit/066a416))
* implemented automated browser tests ([a88b3ba](https://github.com/liabru/matter-js/commit/a88b3ba))
* implemented compound bodies, added Body.setParts ([f554d6c](https://github.com/liabru/matter-js/commit/f554d6c))
* implemented static compound bodies ([90adf14](https://github.com/liabru/matter-js/commit/90adf14))
* implemented temporary vector pool ([7a477f2](https://github.com/liabru/matter-js/commit/7a477f2))
* improve Composite.car ([5ff2182](https://github.com/liabru/matter-js/commit/5ff2182))
* improved collision detection for compounds ([84d9f59](https://github.com/liabru/matter-js/commit/84d9f59))
* improved Demo.manipulation ([e186ccd](https://github.com/liabru/matter-js/commit/e186ccd))
* improved docs ([2317f02](https://github.com/liabru/matter-js/commit/2317f02))
* improved docs ([2e6afd4](https://github.com/liabru/matter-js/commit/2e6afd4))
* improved examples ([6e1f8e9](https://github.com/liabru/matter-js/commit/6e1f8e9))
* improved friction, added body.frictionStatic ([937c7bf](https://github.com/liabru/matter-js/commit/937c7bf))
* improved traction for Composites.car ([95eddb0](https://github.com/liabru/matter-js/commit/95eddb0))
* increased tollerance on internal edge finding ([40905e8](https://github.com/liabru/matter-js/commit/40905e8))
* initial work on browser tests ([6a88256](https://github.com/liabru/matter-js/commit/6a88256))
* initial work on compound bodies ([243fce4](https://github.com/liabru/matter-js/commit/243fce4))
* Make background:'transparent' work like canvas renderer ([f9123f9](https://github.com/liabru/matter-js/commit/f9123f9))
* Merge branch 'browser-tests' ([a6b82c1](https://github.com/liabru/matter-js/commit/a6b82c1))
* Merge branch 'collision-filters' of https://github.com/GustavCarlson/matter-js into GustavCarlson-co ([3a32bda](https://github.com/liabru/matter-js/commit/3a32bda))
* Merge branch 'GustavCarlson-collision-filters' ([a58fe2a](https://github.com/liabru/matter-js/commit/a58fe2a))
* Merge branch 'master' into runner-improve ([a48d219](https://github.com/liabru/matter-js/commit/a48d219))
* Merge branch 'master' into topic/addBounds ([a461fc7](https://github.com/liabru/matter-js/commit/a461fc7))
* Merge branch 'master' of github.com:liabru/matter-js ([4067108](https://github.com/liabru/matter-js/commit/4067108))
* Merge branch 'master' of https://github.com/rfoligno/matter-js into rfoligno-master ([41b4b7f](https://github.com/liabru/matter-js/commit/41b4b7f))
* Merge branch 'master' of https://github.com/schahriar/matter-js into schahriar-master ([2510cdf](https://github.com/liabru/matter-js/commit/2510cdf))
* Merge branch 'no-gravity-optim' of https://github.com/BlackDice/matter-js into BlackDice-no-gravity- ([1b8574a](https://github.com/liabru/matter-js/commit/1b8574a))
* Merge branch 'node-tests' into browserify ([6e0e7e4](https://github.com/liabru/matter-js/commit/6e0e7e4))
* Merge branch 'pr/60' ([42dc72d](https://github.com/liabru/matter-js/commit/42dc72d))
* Merge branch 'pr/95' ([eed9167](https://github.com/liabru/matter-js/commit/eed9167))
* Merge branch 'runner-improve' into browserify ([9e3438f](https://github.com/liabru/matter-js/commit/9e3438f))
* Merge pull request #30 from mrspeaker/master ([e95e328](https://github.com/liabru/matter-js/commit/e95e328))
* Merge pull request #31 from mrspeaker/topic/addBounds ([6652bb4](https://github.com/liabru/matter-js/commit/6652bb4))
* Merge pull request #51 from tumult/pair_refreshes_from_body_values ([7c1efb6](https://github.com/liabru/matter-js/commit/7c1efb6))
* Merge remote-tracking branch 'origin/pr/33' ([c6a9414](https://github.com/liabru/matter-js/commit/c6a9414))
* merge tumult:old_ie_fixes + tweaks ([6e1ab9a](https://github.com/liabru/matter-js/commit/6e1ab9a))
* migrated from grunt to gulp, jshint to eslint ([19bb655](https://github.com/liabru/matter-js/commit/19bb655))
* Missing argument whose default is 1. ([61855ab](https://github.com/liabru/matter-js/commit/61855ab))
* More fine-grained collision filtering in the style of Box2D ([dd4fc65](https://github.com/liabru/matter-js/commit/dd4fc65))
* move /tests to /test ([ad403ae](https://github.com/liabru/matter-js/commit/ad403ae))
* move Demo.* to Example.* ([b722012](https://github.com/liabru/matter-js/commit/b722012))
* move license in build ([9ba8a2a](https://github.com/liabru/matter-js/commit/9ba8a2a))
* move require statements below module export ([99c3bb3](https://github.com/liabru/matter-js/commit/99c3bb3))
* moved collision events into Engine.update, changed collisionStart to trigger before collisions resol ([69b1d05](https://github.com/liabru/matter-js/commit/69b1d05))
* moved Engine.run to Matter.Runner ([6911395](https://github.com/liabru/matter-js/commit/6911395))
* moved engine.timing properties, tick events and Engine.render into Matter.Runner module ([dcdc43d](https://github.com/liabru/matter-js/commit/dcdc43d))
* pass width and height options to Pixi webGL renderer ([a9278fc](https://github.com/liabru/matter-js/commit/a9278fc))
* publish to npm ([a12fbcb](https://github.com/liabru/matter-js/commit/a12fbcb))
* refactor Bodies.fromVertices ([4a2c6e7](https://github.com/liabru/matter-js/commit/4a2c6e7))
* refactor Demo.create ([c0b24da](https://github.com/liabru/matter-js/commit/c0b24da))
* refactor Demo.init ([fb76605](https://github.com/liabru/matter-js/commit/fb76605))
* remove constraint torque clamp ([6f89250](https://github.com/liabru/matter-js/commit/6f89250))
* removed Body.resetForcesAll, removed Body.applyGravityAll, removed Body.updateAll ([9aa0945](https://github.com/liabru/matter-js/commit/9aa0945))
* removed collision.supportCorrected instead using bodyB.position, added render.options.showSeparation ([2b6a8d3](https://github.com/liabru/matter-js/commit/2b6a8d3))
* removed complexity check in Bodies.fromVertices, enforce clockwise sort ([2d1ef0d](https://github.com/liabru/matter-js/commit/2d1ef0d))
* removed Detector.bruteForce ([e04de5f](https://github.com/liabru/matter-js/commit/e04de5f))
* removed engine.broadphase.current, removed engine.broadphase.instance, changed engine.broadphase to ([6dd0c05](https://github.com/liabru/matter-js/commit/6dd0c05))
* removed engine.input, removed Engine mouse events, added MouseConstraint mouse events ([fb5d899](https://github.com/liabru/matter-js/commit/fb5d899))
* removed line width change from Body.setStatic ([04955bb](https://github.com/liabru/matter-js/commit/04955bb))
* removed Matter.Metrics from release builds (now dev only) ([968bba2](https://github.com/liabru/matter-js/commit/968bba2))
* removed old build ([a068bec](https://github.com/liabru/matter-js/commit/a068bec))
* removed redundant property ([14392b4](https://github.com/liabru/matter-js/commit/14392b4))
* removed Render.clear (redundant) ([0a15d7d](https://github.com/liabru/matter-js/commit/0a15d7d))
* removed Render.setBackground (now use render.options) ([01bc813](https://github.com/liabru/matter-js/commit/01bc813))
* removed unused vars from examples ([0bff037](https://github.com/liabru/matter-js/commit/0bff037))
* removed version number from edge build name ([e6b998e](https://github.com/liabru/matter-js/commit/e6b998e))
* render normals pointing out of static bodies ([d082b3a](https://github.com/liabru/matter-js/commit/d082b3a))
* skip presolve when impulse 0 ([296059c](https://github.com/liabru/matter-js/commit/296059c))
* skip unnecessary loops in Composites.mesh, closes #85 ([0a73a64](https://github.com/liabru/matter-js/commit/0a73a64)), closes [#85](https://github.com/liabru/matter-js/issues/85)
* Some fixes in pixi.js v3 update ([96735dd](https://github.com/liabru/matter-js/commit/96735dd))
* Spellchecking ([940976a](https://github.com/liabru/matter-js/commit/940976a))
* Spellchecking ([c2e0c23](https://github.com/liabru/matter-js/commit/c2e0c23))
* Spellchecking ([cd5d401](https://github.com/liabru/matter-js/commit/cd5d401))
* Spellchecking ([611a429](https://github.com/liabru/matter-js/commit/611a429))
* Spellchecking ([723ddcf](https://github.com/liabru/matter-js/commit/723ddcf))
* Spellchecking ([65d5d93](https://github.com/liabru/matter-js/commit/65d5d93))
* Spellchecking ([3127654](https://github.com/liabru/matter-js/commit/3127654))
* tweak jshint ([71df1b9](https://github.com/liabru/matter-js/commit/71df1b9))
* tweaks to collision filtering ([5060c76](https://github.com/liabru/matter-js/commit/5060c76))
* tweaks to Matter.Runner ([ce474da](https://github.com/liabru/matter-js/commit/ce474da))
* Update JSDoc ([25ab2a3](https://github.com/liabru/matter-js/commit/25ab2a3))
* Update JSDoc ([18e0642](https://github.com/liabru/matter-js/commit/18e0642))
* Update JSDoc ([71ef6c2](https://github.com/liabru/matter-js/commit/71ef6c2))
* Update JSDoc ([10a46b7](https://github.com/liabru/matter-js/commit/10a46b7))
* Update JSDoc ([5b87f47](https://github.com/liabru/matter-js/commit/5b87f47))
* Update JSDoc ([d17eb6c](https://github.com/liabru/matter-js/commit/d17eb6c))
* Update JSDoc ([aa3eabc](https://github.com/liabru/matter-js/commit/aa3eabc))
* update node version for travis ([e698b6b](https://github.com/liabru/matter-js/commit/e698b6b))
* updated browser test refs ([1810f93](https://github.com/liabru/matter-js/commit/1810f93))
* updated browser test refs ([ae32d63](https://github.com/liabru/matter-js/commit/ae32d63))
* updated browser test refs ([31fb748](https://github.com/liabru/matter-js/commit/31fb748))
* updated contributing notes ([8b89e87](https://github.com/liabru/matter-js/commit/8b89e87))
* updated docs for collisionFilter ([9f10f88](https://github.com/liabru/matter-js/commit/9f10f88))
* updated edge build ([2fa1570](https://github.com/liabru/matter-js/commit/2fa1570))
* updated edge build ([02ab198](https://github.com/liabru/matter-js/commit/02ab198))
* updated edge build ([37a86cd](https://github.com/liabru/matter-js/commit/37a86cd))
* updated edge build ([cd00353](https://github.com/liabru/matter-js/commit/cd00353))
* updated edge build ([37ccc84](https://github.com/liabru/matter-js/commit/37ccc84))
* updated edge build ([bf3f986](https://github.com/liabru/matter-js/commit/bf3f986))
* updated edge build ([16733ad](https://github.com/liabru/matter-js/commit/16733ad))
* updated edge build ([2f2d416](https://github.com/liabru/matter-js/commit/2f2d416))
* updated edge build ([5770013](https://github.com/liabru/matter-js/commit/5770013))
* updated edge build ([43fd2e3](https://github.com/liabru/matter-js/commit/43fd2e3))
* updated edge build ([fbb7c1a](https://github.com/liabru/matter-js/commit/fbb7c1a))
* updated edge build ([d6cbd07](https://github.com/liabru/matter-js/commit/d6cbd07))
* updated edge build ([9561d5d](https://github.com/liabru/matter-js/commit/9561d5d))
* updated edge build ([a80fbc1](https://github.com/liabru/matter-js/commit/a80fbc1))
* updated edge build ([5b2b060](https://github.com/liabru/matter-js/commit/5b2b060))
* updated edge build ([d22b1b4](https://github.com/liabru/matter-js/commit/d22b1b4))
* updated edge build ([2ab20b0](https://github.com/liabru/matter-js/commit/2ab20b0))
* updated edge build ([f2635ab](https://github.com/liabru/matter-js/commit/f2635ab))
* updated matter-tools ([c969767](https://github.com/liabru/matter-js/commit/c969767))
* updated matter-tools ([4ecad0f](https://github.com/liabru/matter-js/commit/4ecad0f))
* updated node test refs ([b1e6a45](https://github.com/liabru/matter-js/commit/b1e6a45))
* Updated pixi.js to v3 ([419d2ad](https://github.com/liabru/matter-js/commit/419d2ad))
* updated readme ([137580c](https://github.com/liabru/matter-js/commit/137580c))
* updated readme ([f4f3bf7](https://github.com/liabru/matter-js/commit/f4f3bf7))
* updated readme ([d2dcc77](https://github.com/liabru/matter-js/commit/d2dcc77))
* updated readme ([2806fd3](https://github.com/liabru/matter-js/commit/2806fd3))
* updated readme ([3e5abab](https://github.com/liabru/matter-js/commit/3e5abab))
* updated readme ([8f2f8ee](https://github.com/liabru/matter-js/commit/8f2f8ee))
* updated readme ([6cd00b1](https://github.com/liabru/matter-js/commit/6cd00b1))
* updated test refs ([b79ece2](https://github.com/liabru/matter-js/commit/b79ece2))
* updated test refs ([1a55259](https://github.com/liabru/matter-js/commit/1a55259))
* updated test refs ([110aea8](https://github.com/liabru/matter-js/commit/110aea8))
* updated test refs ([729e2bf](https://github.com/liabru/matter-js/commit/729e2bf))
* upgraded pixi.js to v3.0.6 ([d03145e](https://github.com/liabru/matter-js/commit/d03145e))
* use actual canvas size for default render bounds ([c3129b8](https://github.com/liabru/matter-js/commit/c3129b8))
* use browserify ([00251e5](https://github.com/liabru/matter-js/commit/00251e5))
* use build folder for demo ([fa47d5c](https://github.com/liabru/matter-js/commit/fa47d5c))
* use different port for test server, fix test precision limiter ([c1f71b9](https://github.com/liabru/matter-js/commit/c1f71b9))
* Use own Common.indexOf method for IE 6-8 compatibility ([b91af36](https://github.com/liabru/matter-js/commit/b91af36))
* When updating pairs use current values from bodies as they may have changed ([f0e7491](https://github.com/liabru/matter-js/commit/f0e7491))
# Matter.js Changelog
[brm.io/matter-js](http://brm.io/matter-js)
----------
## 0.8.0-alpha - 2014-05-05
#### Release Highlights
- added [Views](http://brm.io/matter-js-demo/#views) demo
- added [Time Scaling](http://brm.io/matter-js-demo/#timescale) demo
- added [Rounded Corners (Chamfering)](http://brm.io/matter-js-demo#rounded) demo
- added [Raycasting](http://brm.io/matter-js-demo/#raycasting) demo
- added Query module, including raycasting
- added 3 useful new Composite methods
- added support for mouse wheel, mouse scaling and offsets
- added Body.scale for scaling bodies on the fly
- added Body.timeScale for slowing down bodies per-body
- added Body.setStatic for correctly setting static
- added Vertices.chamfer for rounding corners of any set of vertices
- added integration of chamfer to body factories
- added engine.timing.isFixed option to disable dynamic timing
- added render.bounds for translating and scaling views
- easier use of Engine.update and Engine.render for those using custom game loops
- fixed issues with time scaling
- fixed error in calculation of centre of mass
- removed Matter.Gui in preparation for the [MatterTools](https://github.com/liabru/matter-tools) project launch
#### Added
- added Demo.views
- added Demo.timescale
- added Demo.rounded
- added Demo.raycasting
- added demo support for hash + '-inspect' to start the [MatterTools](https://github.com/liabru/matter-tools) inspector
- added Composite.rebase
- added Composite.move
- added Composite.get
- added Matter.Query
- added Query.ray
- added Query.region
- added Bounds.translate
- added Bounds.shift
- added Mouse.setScale
- added Mouse.setPosition
- added mouse.absolute
- added mouse.wheelDelta
- added mouse.offset
- added Body.setStatic
- added Body.scale
- added body.timeScale
- added Vector.angle
- added Vertices.chamfer for rounding corners
- added Engine.render
- added engine.timing.isFixed option
- added render.bounds for translating and scaling views
- added Common.nextId
- added body.label
- added constraint.label
- added composite.label
#### Changed
- changed engine.timing.timestamp to be simulation based rather than wall-clock based
- changed correction to now be optional in Engine.update (defaults to 1)
- changed Events.on to return callback
- changed Events.off to accept callbacks for removal
- changed vertices in Bounds.create to optional
- changed engine.timeScale to engine.timing.timeScale
- moved Matter.Inspector and Matter.Gui to the [MatterTools](https://github.com/liabru/matter-tools) project
- moved event documentation to end of file for clarity
- moved respective engine event triggers into Engine.update and Engine.render
#### Removed
- removed body.render.path (redundant)
- removed Body.nextId
- removed Constraint.nextId
- removed Composite.nextId
- removed Body.updateProperties (now a private method)
#### Fixed
- fixed issues with timing.timeScale
- fixed constraints now account for timeScale
- fixed Vertices.centre calculation to get correct centre of mass
## 0.7.0-alpha - 2014-04-01
#### Release Highlights
- added six new demos
- all demos are now mobile friendly
- added new event system
- engine, mouse and collision events
- added sprite texture rendering support
- added WebGL renderer (pixi.js)
- improved `Composite` (and `World`)
- batch adding
- type agnostic adding
- body removal
- major performance increases all round
- collision detection caching
- batched rendering
- improved pair management
- memory leaks fixed
- stability improvements
- bodies rest better due to collision caching
- bodies sleep better
- constraints are much less volatile
- fixes for a number of issues (see fixes)
#### Added
- added demos
- sprites
- events
- catapult
- cloth
- soft body
- bridge
- added collision caching and reuse for improved performance
- added metrics for collision reuse
- added `Events` module ([Issue #8](https://github.com/liabru/matter-js/issues/8))
- engine events
- mouse events
- collision events
- added composite functions, including
- batch adding (`Composite.add` / `World.add`)
- type agnostic adding (`Composite.add` / `World.add`)
- body removal (`Composite.remove` / `World.remove`)
- added factory functions
- constraint meshing (`Composites.mesh`)
- soft body factory (`Composites.softBody`)
- added `RenderPixi`, a pixi.js WebGL renderer
- added `Gui` option to switch renderer
- added `Mouse.setElement`
- added `render.visible` flag to `Body` and `Constraint` ([Issue #10](https://github.com/liabru/matter-js/issues/10))
- added `id` to `Constraint` and `Composite`
- added `type` names to `Body`, `Constraint`, `Composite`
- added `Common` functions
- `Common.colorToNumber`
- `Common.log`
- `Common.clone`
- added jsdoc annotations
- added travis-ci integration
- added yuidoc build tasks
- added multiple build modes to `Gruntfile` (dev, release, edge)
- added repository to `package.json`, so Browserify may be used
- added `CHANGELOG.md`
#### Changed
- renamed module `Manager` to `Pairs`
- changed `Composite` to be tree-based
- changed timestep to be smoothed over 1s for stability
- changed default `constraintIterations` to 2 for stability
- changed demo to use the new composite functions
- changed right click to now remove bodies in the demos
- changed `Common.now` to use high-resolution timing
- changed `MouseConstraint` to reference a single constraint rather than a list
- changed `Constraint` to now use a `render` property
- changed `Metrics` to only track FPS by default, use the `extended` flag for full metrics
#### Removed
- removed the default in `MouseConstraint`, you must now instantiate one manually
#### Fixed
- fixed a memory leak in `Grid`
- fixed a memory leak in `Manager`
- fixed debug text now uses `Metrics` correctly
- fixed issues regarding passing custom `Render` modules ([Issue #7](https://github.com/liabru/matter-js/issues/7))
- fixed issue in `Common.extend` with `null` properties
- fixed issue with sleeping, now ignores inactive pairs
- fixed issues with `Body.applyForce` ([Issue #7](https://github.com/liabru/matter-js/issues/7))
## 0.5.0-alpha - 2014-02-28
- initial release
================================================
FILE: CONTRIBUTING.md
================================================
# Contributing
## License Agreement
By providing any kind of contribution to this project, **you must agree and be legally entitled** to provide them for use and distribution as a part of this project **wholly under the same terms as in the original included [license](https://github.com/liabru/matter-js/blob/master/LICENSE)**.
## Contributions
Contributions by pull request or issues are welcome. Please ensure they follow the same style and architecture as the rest of the code. Use `npm run lint` and see [Testing](#Testing) below before submitting. Please **do not include** any changes to the files in the `build` directory.
Before contributing please read the license agreement described at the beginning of this document.
## Building
To build you must first install [node.js](http://nodejs.org), then run
npm install
which will install the required build dependencies, then run
npm start
which will run the development server and opens `http://localhost:8000/` in your browser. Any changes you make to the source will automatically rebuild and reload the page.
## Testing
All contributions should pass when running the commands
- `npm run lint`
- `npm run test`
- `npm run test-browser`
The output of `npm run test` also includes a [comparison report](https://github.com/liabru/matter-js/pull/794), which highlights changes in results, performance and accuracy against the last release build.
## Commands
The following development commands can be run at the terminal
- **npm start**
runs development server and opens demo page
- **npm run build**
creates a release build
- **npm run build-demo**
builds the demo
- **npm run lint**
runs the linter
- **npm run test**
runs the tests and compares results
- **npm run test-browser**
runs the browser tests
- **npm run doc**
builds the documentation
================================================
FILE: LICENSE
================================================
The MIT License (MIT)
Copyright (c) Liam Brummitt and contributors.
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.
================================================
FILE: README.md
================================================
<img alt="Matter.js" src="https://brm.io/matter-js/img/matter-js.svg" width="300">
> *Matter.js* is a JavaScript 2D rigid body physics engine for the web
[brm.io/matter-js](https://brm.io/matter-js/)
[Demos](#demos) ・ [Gallery](#gallery) ・ [Features](#features) ・ [Plugins](#plugins) ・ [Install](#install) ・ [Usage](#usage) ・ [Examples](#examples) ・ [Docs](#documentation) ・ [Wiki](https://github.com/liabru/matter-js/wiki) ・ [References](#references) ・ [License](#license)
### Demos
<table>
<tr>
<td>
<ul>
<li><a href="https://brm.io/matter-js/demo/#mixed">Mixed Shapes</a></li>
<li><a href="https://brm.io/matter-js/demo/#mixedSolid">Solid Shapes</a></li>
<li><a href="https://brm.io/matter-js/demo/#svg">Concave SVG Paths</a></li>
<li><a href="https://brm.io/matter-js/demo/#terrain">Concave Terrain</a></li>
<li><a href="https://brm.io/matter-js/demo/#concave">Concave Bodies</a></li>
<li><a href="https://brm.io/matter-js/demo/#compound">Compound Bodies</a></li>
<li><a href="https://brm.io/matter-js/demo/#newtonsCradle">Newton's Cradle</a></li>
<li><a href="https://brm.io/matter-js/demo/#wreckingBall">Wrecking Ball</a></li>
<li><a href="https://brm.io/matter-js/demo/#slingshot">Slingshot Game</a></li>
<li><a href="https://brm.io/matter-js/demo/#rounded">Rounded Corners</a></li>
<li><a href="https://brm.io/matter-js/demo/#views">Views</a></li>
<li><a href="https://brm.io/matter-js/demo/#timescale">Time Scaling</a></li>
<li><a href="https://brm.io/matter-js/demo/#manipulation">Body Manipulation</a></li>
<li><a href="https://brm.io/matter-js/demo/#compositeManipulation">Composite Manipulation</a></li>
</ul>
</td>
<td>
<ul>
<li><a href="https://brm.io/matter-js/demo/#raycasting">Raycasting</a></li>
<li><a href="https://brm.io/matter-js/demo/#sprites">Sprites</a></li>
<li><a href="https://brm.io/matter-js/demo/#pyramid">Pyramid</a></li>
<li><a href="https://brm.io/matter-js/demo/#car">Car</a></li>
<li><a href="https://brm.io/matter-js/demo/#catapult">Catapult</a></li>
<li><a href="https://brm.io/matter-js/demo/#gravity">Reverse Gravity</a></li>
<li><a href="https://brm.io/matter-js/demo/#bridge">Bridge</a></li>
<li><a href="https://brm.io/matter-js/demo/#avalanche">Avalanche</a></li>
<li><a href="https://brm.io/matter-js/demo/#softBody">Basic Soft Bodies</a></li>
<li><a href="https://brm.io/matter-js/demo/#cloth">Cloth</a></li>
<li><a href="https://brm.io/matter-js/demo/#events">Events</a></li>
<li><a href="https://brm.io/matter-js/demo/#collisionFiltering">Collision Filtering</a></li>
<li><a href="https://brm.io/matter-js/demo/#chains">Chains</a></li>
<li><a href="https://brm.io/matter-js/demo/#ballPool">Ball Pool</a></li>
</ul>
</td>
<td>
<ul>
<li><a href="https://brm.io/matter-js/demo/#stack">Stack</a></li>
<li><a href="https://brm.io/matter-js/demo/#circleStack">Circle Stack</a></li>
<li><a href="https://brm.io/matter-js/demo/#compoundStack">Compound Stack</a></li>
<li><a href="https://brm.io/matter-js/demo/#restitution">Restitution</a></li>
<li><a href="https://brm.io/matter-js/demo/#friction">Friction</a></li>
<li><a href="https://brm.io/matter-js/demo/#airFriction">Air Friction</a></li>
<li><a href="https://brm.io/matter-js/demo/#staticFriction">Static Friction</a></li>
<li><a href="https://brm.io/matter-js/demo/#sleeping">Sleeping</a></li>
<li><a href="https://brm.io/matter-js/demo/#beachBalls">Beach Balls</a></li>
<li><a href="https://brm.io/matter-js/demo/#stress">Stress 1</a></li>
<li><a href="https://brm.io/matter-js/demo/#stress2">Stress 2</a></li>
<li><a href="https://brm.io/matter-js/demo/#sensors">Sensors</a></li>
</ul>
<br>
</td>
</tr>
</table>
### Gallery
See how others are using matter.js physics
- [Patrick Heng](https://patrickheng.com/) by Patrick Heng
- [USELESS](https://useless.london/) by Nice and Serious
- [Secret 7](https://secret-7.com/) by Goodness
- [New Company](https://www.new.company/) by New Company
- [Game of The Year](https://gameoftheyear.withgoogle.com/) by Google
- [Pablo The Flamingo](https://pablotheflamingo.com/) by Nathan Gordon
- [Les métamorphoses de Mr. Kalia](https://lab212.org/oeuvres/2:art/18/Les-metamorphoses-de-Mr-Kalia) by Lab212
- [Phaser](https://phaser.io/) by Photon Storm
- [Sorry I Have No Filter](https://sorryihavenofilter.com/pages/about/) by Jessica Walsh
- [Fuse](https://fuse.blog/) by Fuse
- [Glyphfinder](https://www.glyphfinder.com/) by überdosis
- [Isolation](https://isolation.is/postcards/my-week) by sabato studio
- [more...](https://github.com/liabru/matter-js/wiki/Gallery)
### Features
- Rigid bodies
- Compound bodies
- Composite bodies
- Concave and convex hulls
- Physical properties (mass, area, density etc.)
- Restitution (elastic and inelastic collisions)
- Collisions (broad-phase, mid-phase and narrow-phase)
- Stable stacking and resting
- Conservation of momentum
- Friction and resistance
- Events
- Constraints
- Gravity
- Sleeping and static bodies
- Plugins
- Rounded corners (chamfering)
- Views (translate, zoom)
- Collision queries (raycasting, region tests)
- Time scaling (slow-mo, speed-up)
- Canvas renderer (supports vectors and textures)
- [MatterTools](https://github.com/liabru/matter-tools) for creating, testing and debugging worlds
- World state serialisation (requires [resurrect.js](https://github.com/skeeto/resurrect-js))
- Cross-browser and Node.js support (Chrome, Firefox, Safari, IE8+)
- Mobile-compatible (touch, responsive)
- An original JavaScript physics implementation (not a port)
### Install
You can install using package managers [npm](https://www.npmjs.org/package/matter-js) and [Yarn](https://yarnpkg.com/) using:
npm install matter-js
Alternatively you can download a [stable release](https://github.com/liabru/matter-js/tags) or try the latest experimental [alpha build](https://github.com/liabru/matter-js/tree/master/build) (master) and include the script in your web page:
<script src="matter.js" type="text/javascript"></script>
### Performance with other tools (e.g. Webpack, Vue etc.)
Bundlers and frameworks may reduce real-time performance when using their default configs, especially in development modes.
When using [Webpack](https://webpack.js.org/), the default sourcemap config can have a large impact, for a solution see [issue](https://github.com/liabru/matter-js/issues/1001).
When using [Vue.js](https://vuejs.org/), watchers can have a large impact, for a solution see [issue](https://github.com/liabru/matter-js/issues/1001#issuecomment-998911435).
### Usage
Visit the [Getting started](https://github.com/liabru/matter-js/wiki/Getting-started) wiki page for a minimal usage example which should work in both browsers and Node.js.
Also see the [Running](https://github.com/liabru/matter-js/wiki/Running) and [Rendering](https://github.com/liabru/matter-js/wiki/Rendering) wiki pages, which show how to use your own game and rendering loops.
### Tutorials
See the list of [tutorials](https://github.com/liabru/matter-js/wiki/Tutorials).
### Examples
See the [examples](https://github.com/liabru/matter-js/tree/master/examples) directory which contains the source for all [demos](#demos).
There are even more examples on [codepen](https://codepen.io/collection/Fuagy/).
### Plugins
The engine can be extended through plugins, see these resources:
- [Using plugins](https://github.com/liabru/matter-js/wiki/Using-plugins)
- [Creating plugins](https://github.com/liabru/matter-js/wiki/Creating-plugins)
- [List of plugins](https://github.com/liabru/matter-js/wiki/List-of-plugins)
- [matter-plugin-boilerplate](https://github.com/liabru/matter-plugin-boilerplate)
### Documentation
See the [API Documentation](https://brm.io/matter-js/docs/) and the [wiki](https://github.com/liabru/matter-js/wiki)
### Building and Contributing
To build you must first install [node.js](https://nodejs.org/), then run
npm install
This will install the required build dependencies, then run
npm run dev
to spawn a development server. For information on contributing see [CONTRIBUTING.md](https://github.com/liabru/matter-js/blob/master/CONTRIBUTING.md).
### Changelog
To see what's new or changed in the latest version, see the [changelog](https://github.com/liabru/matter-js/blob/master/CHANGELOG.md).
### References
See the wiki page on [References](https://github.com/liabru/matter-js/wiki/References).
### License
Matter.js is licensed under [The MIT License (MIT)](https://opensource.org/licenses/MIT)
Copyright (c) 2014 Liam Brummitt
This license is also supplied with the release and source code.
As stated in the license, absolutely no warranty is provided.
================================================
FILE: RELEASE.md
================================================
## ▲.● matter.js `0.20.0`
Release notes for `0.20.0`. See the release [readme](https://github.com/liabru/matter-js/blob/0.20.0/README.md) for further information.
### Highlights ✺
- added support for high refresh rate displays with fixed timestep in `Matter.Runner`
- added support for sub-stepping for higher quality simulations in `Matter.Runner`
- changed to a fixed timestep by default in `Matter.Runner`
- improved frame pacing and average performance up to ~6% (see [#1238](https://github.com/liabru/matter-js/pull/1238))
- reduced average memory usage up to ~30% (see [#1238](https://github.com/liabru/matter-js/pull/1238))
- reduced memory garbage collection
- bug fixes and improvements see [changelog](https://github.com/liabru/matter-js/blob/0.20.0/CHANGELOG.md)
### Changes ✲
See the release [compare page](https://github.com/liabru/matter-js/compare/0.19.0...0.20.0) and the [changelog](https://github.com/liabru/matter-js/blob/0.20.0/CHANGELOG.md) for a detailed list of changes.
### Migration ⌲
`Matter.Runner` related changes [#1254](https://github.com/liabru/matter-js/pull/1254):
- `Matter.Runner` now defaults to a fixed deterministic timestep and support for non-fixed timestep is removed
- optionally set your performance budgets `runner.maxFrameTime` (see docs)
- note that `Matter.Runner` can now call zero, one, or multiple engine updates and events per display frame (see docs)
- if needed set up your polyfill for `window.requestAnimationFrame`
- see `Matter.Runner` updated docs throughout
Performance related changes [#1238](https://github.com/liabru/matter-js/pull/1238):
- `Matter.Collision` use `collision.supportCount` instead of `collision.supports.length` for active support count
- `Matter.Pair` use `pair.contacts` instead of `pair.activeContacts`
- `Matter.Pair` use `pair.contactCount` instead of `pair.contacts.length` for active contact count
- `Pair.id` format has changed
### Comparison ⎄
For more information see [comparison method](https://github.com/liabru/matter-js/pull/794).
```ocaml
Output sample comparison estimates of 44 examples against previous release matter-js@0.19.0:
Similarity 99.80% Overlap -1.92% Filesize +3.38% 81.58 KB
airFriction · · avalanche ● · ballPool ● · bridge ● · car ● · catapult ● ·
chains ● · circleStack · · cloth ● · collisionFiltering ● · compositeManipulation ● ·
compound · · compoundStack ● · concave ● · constraints ● · doublePendulum · ·
events ● · friction · · gravity ● · gyro ● · manipulation ● ◆
mixed ● · newtonsCradle · · pyramid ● · ragdoll ● · raycasting ● ·
remove ● ◆ restitution · · rounded ● · sensors · · sleeping ● ◆
slingshot ● · softBody ● · sprites ● · stack · · staticFriction ● ·
stats ● · stress ● · stress2 ● · stress3 ● · stress4 ● ·
timescale ● · views ● · wreckingBall ● ·
where for the sample · no change detected ● extrinsics changed ◆ intrinsics changed
```
### Contributors ♥︎
Many thanks to the [contributors](https://github.com/liabru/matter-js/compare/0.19.0...0.20.0) of this release, [past contributors](https://github.com/liabru/matter-js/graphs/contributors) as well those involved in the [community](https://github.com/liabru/matter-js/issues) for your input and support.
---
## ▲.● matter.js `0.19.0`
Release notes for `0.19.0`. See the release [readme](https://github.com/liabru/matter-js/blob/0.19.0/README.md) for further information.
### Highlights ✺
- Changed `Body.setAngularVelocity` and `Body.setVelocity` to be timestep independent
- Improved similarity of results between different timesteps based on `60hz` as a baseline
- Added timestep independent `Body.setSpeed`, `Body.setAngularSpeed`, `Body.getSpeed`, `Body.getVelocity`, `Body.getAngularVelocity`
- Added optional `updateVelocity` argument to `Body.setPosition`, `Body.setAngle`, `Body.translate`, `Body.rotate`
- Added extended documentation for `Body.applyForce`
- Moved time correction feature from `Engine.update` to be built-in to `Matter.Body`
- Improved [documentation](https://brm.io/matter-js/docs/) pages
### Changes ✲
See the release [compare page](https://github.com/liabru/matter-js/compare/0.18.0...0.19.0) and the [changelog](https://github.com/liabru/matter-js/blob/0.19.0/CHANGELOG.md) for a more detailed list of changes.
### Migration ⌲
See [PR #777](https://github.com/liabru/matter-js/pull/777#issue-487893963) for related changes and notes useful for migration.
### Comparison ⎄
For more information see [comparison method](https://github.com/liabru/matter-js/pull/794).
```ocaml
Output comparison of 43 examples at 60hz against previous release matter-js@0.18.0
Behaviour 100.00% Similarity 100.00% Overlap +0.00%
Performance -0.80% Memory +0.05% Filesize +1.67% 78.97 KB
airFriction · · avalanche · · ballPool · · bridge · · car · · catapult · ·
chains · · circleStack · · cloth · · collisionFiltering · · compositeManipulation · ·
compound · · compoundStack · · concave · · constraints · · doublePendulum · ·
events · · friction · · gravity · · gyro · · manipulation · ·
mixed · · newtonsCradle · · pyramid · · ragdoll · · raycasting · ·
remove · · restitution · · rounded · · sensors · · sleeping · ◆
slingshot · · softBody · · sprites · · stack · · staticFriction · ·
stats · · stress · · stress2 · · stress3 · · timescale · ·
views · · wreckingBall · ·
where · no change ● extrinsics changed ◆ intrinsics changed
▶ code -n -d test/__compare__/examples-build.json test/__compare__/examples-dev.json
```
### Contributors ♥︎
Many thanks to the [contributors](https://github.com/liabru/matter-js/compare/0.18.0...0.19.0) of this release, [past contributors](https://github.com/liabru/matter-js/graphs/contributors) as well those involved in the [community](https://github.com/liabru/matter-js/issues) for your input and support.
---
## ▲.● matter.js `0.18.0`
Release notes for `0.18.0`. See the release [readme](https://github.com/liabru/matter-js/blob/0.18.0/README.md) for further information.
### Highlights ✺
- **Up to ~40% performance improvement (on average measured over all examples, in Node on a Mac Air M1)**
- Replaces `Matter.Grid` with a faster and more efficient broadphase in `Matter.Detector`
- Reduced memory usage and garbage collection
- Resolves issues in `Matter.SAT` related to collision reuse
- Removes performance issues from `Matter.Grid`
- Improved collision accuracy
- Improved API and docs for collision modules
- Improved [documentation](https://brm.io/matter-js/docs/) pages
- Added note about avoiding Webpack [performance problems](https://github.com/liabru/matter-js/blob/master/README.md#install)
### Changes ✲
See the release [compare page](https://github.com/liabru/matter-js/compare/0.17.1...0.18.0) and the [changelog](https://github.com/liabru/matter-js/blob/0.18.0/CHANGELOG.md) for a detailed list of changes.
### Migration ⌲
- Behaviour and similarity is in practice the same (a fractional difference from improved accuracy)
- API is the same other than:
- [Matter.Detector](https://brm.io/matter-js/docs/classes/Detector.html) replaces [Matter.Grid](https://brm.io/matter-js/docs/classes/Grid.html) (which is now deprecated but will remain for a short term)
- [render.options.showBroadphase](https://brm.io/matter-js/docs/classes/Render.html#property_options.showBroadphase) is deprecated (no longer implemented)
- [Matter.SAT](https://brm.io/matter-js/docs/classes/SAT.html) is renamed [Matter.Collision](https://brm.io/matter-js/docs/classes/Collision.html)
- [Matter.SAT.collides](https://brm.io/matter-js/docs/classes/SAT.html#method_collides) is now [Matter.Collision.collides](https://brm.io/matter-js/docs/classes/Collision.html#method_collides) with a slightly different set of arguments
### Comparison ⎄
Differences in behaviour, quality and performance against the previous release `0.17.1`. For more information see [comparison method](https://github.com/liabru/matter-js/pull/794).
```ocaml
Output comparison of 43 examples against previous release matter-js@0.17.1
Behaviour 99.99% Similarity 99.98% Overlap -0.00%
Performance +40.62% Memory -6.18% Filesize -0.16% 77.73 KB
airFriction · · avalanche ● · ballPool · · bridge · · car · · catapult · ·
chains · · circleStack · · cloth · · collisionFiltering · · compositeManipulation ● ·
compound · · compoundStack · · concave · · constraints ● · doublePendulum · ·
events · · friction · · gravity · · gyro · · manipulation · ◆
mixed · · newtonsCradle · · pyramid · · ragdoll · · raycasting · ·
remove · · restitution · · rounded · · sensors · · sleeping · ◆
slingshot · · softBody · · sprites · · stack · · staticFriction · ·
stats · · stress · · stress2 · · stress3 · · timescale · ·
views · · wreckingBall · ·
where · no change ● extrinsics changed ◆ intrinsics changed
```
### Contributors ♥︎
Many thanks to the [contributors](https://github.com/liabru/matter-js/compare/0.17.1...0.18.0) of this release, [past contributors](https://github.com/liabru/matter-js/graphs/contributors) as well those involved in the [community](https://github.com/liabru/matter-js/issues) for your input and support.
---
## ▲.● matter.js `0.17.0`
Release notes for `0.17.0`. See the release [readme](https://github.com/liabru/matter-js/blob/0.17.0/README.md) for further information.
### Highlights ✺
- Added performance and stats monitoring overlays to `Matter.Render`
- See the [stats demo](https://brm.io/matter-js/demo/#stats) or enable [render.options.showPerformance](https://brm.io/matter-js/docs/classes/Render.html#property_options.showPerformance) and [render.options.showStats](https://brm.io/matter-js/docs/classes/Render.html#property_options.showStats)
- Stats shown include
- render frequency (e.g. `60 fps`)
- engine delta time (e.g. `16.66ms`)
- engine execution duration (e.g. `5.00ms`)
- render execution duration (e.g.` 0.40ms`)
- effective play speed (e.g. `1.00x` is real-time)
- various other engine internal stats for debugging
- Improved [documentation](https://brm.io/matter-js/docs/) pages
- Added [Common.setDecomp](https://brm.io/matter-js/docs/classes/Common.html#method_setDecomp) and [Common.getDecomp](https://brm.io/matter-js/docs/classes/Common.html#method_getDecomp) to fix [bundler issues](https://github.com/liabru/matter-js/issues/981)
- Added docs for all [Matter.Render options](https://brm.io/matter-js/docs/classes/Render.html#properties)
- Migrated usage of `Matter.World` over to `Matter.Composite` (more info in [docs](https://brm.io/matter-js/docs/classes/World.html))
- Migrated, deprecated and removed various old functionality (see the [changelog](https://github.com/liabru/matter-js/blob/0.17.0/CHANGELOG.md) for details)
### Changes ✲
See the release [compare page](https://github.com/liabru/matter-js/compare/0.16.1...0.17.0) and the [changelog](https://github.com/liabru/matter-js/blob/0.17.0/CHANGELOG.md) for a detailed list of changes.
### Comparison ⎄
Differences in behaviour, quality and performance against the previous release `0.16.1`. For more information see [comparison method](https://github.com/liabru/matter-js/pull/794).
```ocaml
Output comparison of 37 examples against previous release matter-js@0.16.1
Similarity 100% Performance +0.00% Overlap +0.00%
airFriction · · avalanche · · ballPool · · bridge · · broadphase · · car · ·
catapult · · chains · · circleStack · · cloth · · collisionFiltering · ·
compound · · compoundStack · · constraints · · events · · friction · ·
gyro · · manipulation · · mixed · · newtonsCradle · · pyramid · ·
ragdoll · · restitution · · rounded · · sensors · · sleeping · ·
slingshot · · softBody · · sprites · · stack · · staticFriction · ·
stats · · stress · · stress2 · · timescale · · views · ·
wreckingBall · ·
where · no change ● extrinsics changed ◆ intrinsics changed
```
### Contributors ♥︎
Many thanks to the [contributors](https://github.com/liabru/matter-js/compare/0.16.1...0.17.0) of this release, [past contributors](https://github.com/liabru/matter-js/graphs/contributors) as well those involved in the [community](https://github.com/liabru/matter-js/issues) for your input and support.
---
## ▲.● matter.js `0.16.0`
Release notes for `0.16.0`. See the release [readme](https://github.com/liabru/matter-js/blob/0.16.0/README.md) for further information.
### Highlights ✺
- Changed external require method for `poly-decomp` ([882e07c](https://github.com/liabru/matter-js/commit/882e07c))
- Improved `Bodies.fromVertices` decomposition quality using `removeDuplicatePoints` ([#639](https://github.com/liabru/matter-js/pull/639))
- Added support for `>x.x.x` and `>=x.x.x` semver ranges in plugins ([0792716](https://github.com/liabru/matter-js/commit/0792716))
- Changed demo example select background colour for Windows ([matter-tools #5](https://github.com/liabru/matter-tools/pull/5))
- Updated demo to use latest [matter-tools](https://github.com/liabru/matter-tools) ([#33e8fe8](https://github.com/liabru/matter-js/commit/33e8fe8))
- Updated SVG and terrain examples to use `fetch` ([5551cd5](https://github.com/liabru/matter-js/commit/5551cd5))
### Changes ✲
See the release [compare page](https://github.com/liabru/matter-js/compare/0.15.0...0.16.0) and the [changelog](https://github.com/liabru/matter-js/blob/0.16.0/CHANGELOG.md) for a detailed list of changes.
### Comparison ⎄
Differences in behaviour, quality and performance against the previous release `0.15.0`. For more information see [comparison method](https://github.com/liabru/matter-js/pull/794).
```ocaml
Output comparison of 41 examples against matter-js@0.15.0 build on last run
Similarity 100% Performance +0.00% Overlap +0.00%
airFriction · · avalanche · · ballPool · · bridge · · broadphase · · car · ·
catapult · · chains · · circleStack · · cloth · · collisionFiltering · ·
compositeManipulation · · compound · · compoundStack · · concave · · constraints · ·
doublePendulum · · events · · friction · · gravity · · gyro · ·
manipulation · · mixed · · newtonsCradle · · pyramid · · ragdoll · ·
raycasting · · restitution · · rounded · · sensors · · sleeping · ·
slingshot · · softBody · · sprites · · stack · · staticFriction · ·
stress · · stress2 · · timescale · · views · · wreckingBall · ·
where · no change ● extrinsics changed ◆ intrinsics changed
```
### Contributors ♥︎
Many thanks to the [contributors](https://github.com/liabru/matter-js/compare/0.15.0...0.16.0) of this release, [past contributors](https://github.com/liabru/matter-js/graphs/contributors) as well those involved in the [community](https://github.com/liabru/matter-js/issues) for your input and support.
---
## ▲.● matter.js `0.15.0`
Release notes for `0.15.0`. See the release [readme](https://github.com/liabru/matter-js/blob/0.15.0/README.md) for further information.
### Highlights ✺
- __Optimised performance up to ~30% boost vs. `0.14.2`__ ([#528](https://github.com/liabru/matter-js/pull/528)) ([#522](https://github.com/liabru/matter-js/pull/522)) ([#553](https://github.com/liabru/matter-js/pull/553))
- Added `Body.setCentre` ([2ec247b](https://github.com/liabru/matter-js/commit/2ec247b))
- Added `Constraint.pointAWorld` and `Constraint.pointBWorld` ([3c32969](https://github.com/liabru/matter-js/commit/3c32969))
- Changed default colour scheme ([d258411](https://github.com/liabru/matter-js/commit/d258411)) ([6dd5ec5](https://github.com/liabru/matter-js/commit/6dd5ec5))
- Fixed issues with decomp require ([0af1645](https://github.com/liabru/matter-js/commit/0af1645))
- Fixed issues with render pixel ratio ([d577477](https://github.com/liabru/matter-js/commit/d577477))
### Changes ✲
See the release [compare page](https://github.com/liabru/matter-js/compare/0.14.2...0.15.0) and the [changelog](https://github.com/liabru/matter-js/blob/0.15.0/CHANGELOG.md) for a detailed list of all changes.
### Comparison ⎄
Differences in behaviour, quality and performance against the previous release `0.14.2`. For more information see [comparison method](https://github.com/liabru/matter-js/pull/794).
```ocaml
Output comparison of 41 examples against matter-js@0.14.2 build on last run
Similarity 100% Performance +33.6% Overlap +0.00%
airFriction · · avalanche · · ballPool · · bridge · · broadphase · · car · ·
catapult · · chains · · circleStack · · cloth · · collisionFiltering · ·
compositeManipulation · · compound · · compoundStack · · concave · · constraints · ·
doublePendulum · · events · · friction · · gravity · · gyro · ·
manipulation · · mixed · · newtonsCradle · · pyramid · · ragdoll · ·
raycasting · · restitution · · rounded · · sensors · · sleeping · ·
slingshot · · softBody · · sprites · · stack · · staticFriction · ·
stress · · stress2 · · timescale · · views · · wreckingBall · ·
where · no change ● extrinsics changed ◆ intrinsics changed
```
### Contributors ♥︎
Many thanks to the [contributors](https://github.com/liabru/matter-js/compare/0.14.2...0.15.0) of this release, [past contributors](https://github.com/liabru/matter-js/graphs/contributors) as well those involved in the [community](https://github.com/liabru/matter-js/issues) for your input and support.
================================================
FILE: build/matter.js
================================================
/*!
* matter-js 0.20.0 by @liabru
* http://brm.io/matter-js/
* License MIT
*
* The MIT License (MIT)
*
* Copyright (c) Liam Brummitt and contributors.
*
* 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.
*/
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory();
else if(typeof define === 'function' && define.amd)
define("Matter", [], factory);
else if(typeof exports === 'object')
exports["Matter"] = factory();
else
root["Matter"] = factory();
})(this, function() {
return /******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function(value, mode) {
/******/ if(mode & 1) value = __webpack_require__(value);
/******/ if(mode & 8) return value;
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ var ns = Object.create(null);
/******/ __webpack_require__.r(ns);
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ return ns;
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 20);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, exports) {
/**
* The `Matter.Common` module contains utility functions that are common to all modules.
*
* @class Common
*/
var Common = {};
module.exports = Common;
(function() {
Common._baseDelta = 1000 / 60;
Common._nextId = 0;
Common._seed = 0;
Common._nowStartTime = +(new Date());
Common._warnedOnce = {};
Common._decomp = null;
/**
* Extends the object in the first argument using the object in the second argument.
* @method extend
* @param {} obj
* @param {boolean} deep
* @return {} obj extended
*/
Common.extend = function(obj, deep) {
var argsStart,
args,
deepClone;
if (typeof deep === 'boolean') {
argsStart = 2;
deepClone = deep;
} else {
argsStart = 1;
deepClone = true;
}
for (var i = argsStart; i < arguments.length; i++) {
var source = arguments[i];
if (source) {
for (var prop in source) {
if (deepClone && source[prop] && source[prop].constructor === Object) {
if (!obj[prop] || obj[prop].constructor === Object) {
obj[prop] = obj[prop] || {};
Common.extend(obj[prop], deepClone, source[prop]);
} else {
obj[prop] = source[prop];
}
} else {
obj[prop] = source[prop];
}
}
}
}
return obj;
};
/**
* Creates a new clone of the object, if deep is true references will also be cloned.
* @method clone
* @param {} obj
* @param {bool} deep
* @return {} obj cloned
*/
Common.clone = function(obj, deep) {
return Common.extend({}, deep, obj);
};
/**
* Returns the list of keys for the given object.
* @method keys
* @param {} obj
* @return {string[]} keys
*/
Common.keys = function(obj) {
if (Object.keys)
return Object.keys(obj);
// avoid hasOwnProperty for performance
var keys = [];
for (var key in obj)
keys.push(key);
return keys;
};
/**
* Returns the list of values for the given object.
* @method values
* @param {} obj
* @return {array} Array of the objects property values
*/
Common.values = function(obj) {
var values = [];
if (Object.keys) {
var keys = Object.keys(obj);
for (var i = 0; i < keys.length; i++) {
values.push(obj[keys[i]]);
}
return values;
}
// avoid hasOwnProperty for performance
for (var key in obj)
values.push(obj[key]);
return values;
};
/**
* Gets a value from `base` relative to the `path` string.
* @method get
* @param {} obj The base object
* @param {string} path The path relative to `base`, e.g. 'Foo.Bar.baz'
* @param {number} [begin] Path slice begin
* @param {number} [end] Path slice end
* @return {} The object at the given path
*/
Common.get = function(obj, path, begin, end) {
path = path.split('.').slice(begin, end);
for (var i = 0; i < path.length; i += 1) {
obj = obj[path[i]];
}
return obj;
};
/**
* Sets a value on `base` relative to the given `path` string.
* @method set
* @param {} obj The base object
* @param {string} path The path relative to `base`, e.g. 'Foo.Bar.baz'
* @param {} val The value to set
* @param {number} [begin] Path slice begin
* @param {number} [end] Path slice end
* @return {} Pass through `val` for chaining
*/
Common.set = function(obj, path, val, begin, end) {
var parts = path.split('.').slice(begin, end);
Common.get(obj, path, 0, -1)[parts[parts.length - 1]] = val;
return val;
};
/**
* Shuffles the given array in-place.
* The function uses a seeded random generator.
* @method shuffle
* @param {array} array
* @return {array} array shuffled randomly
*/
Common.shuffle = function(array) {
for (var i = array.length - 1; i > 0; i--) {
var j = Math.floor(Common.random() * (i + 1));
var temp = array[i];
array[i] = array[j];
array[j] = temp;
}
return array;
};
/**
* Randomly chooses a value from a list with equal probability.
* The function uses a seeded random generator.
* @method choose
* @param {array} choices
* @return {object} A random choice object from the array
*/
Common.choose = function(choices) {
return choices[Math.floor(Common.random() * choices.length)];
};
/**
* Returns true if the object is a HTMLElement, otherwise false.
* @method isElement
* @param {object} obj
* @return {boolean} True if the object is a HTMLElement, otherwise false
*/
Common.isElement = function(obj) {
if (typeof HTMLElement !== 'undefined') {
return obj instanceof HTMLElement;
}
return !!(obj && obj.nodeType && obj.nodeName);
};
/**
* Returns true if the object is an array.
* @method isArray
* @param {object} obj
* @return {boolean} True if the object is an array, otherwise false
*/
Common.isArray = function(obj) {
return Object.prototype.toString.call(obj) === '[object Array]';
};
/**
* Returns true if the object is a function.
* @method isFunction
* @param {object} obj
* @return {boolean} True if the object is a function, otherwise false
*/
Common.isFunction = function(obj) {
return typeof obj === "function";
};
/**
* Returns true if the object is a plain object.
* @method isPlainObject
* @param {object} obj
* @return {boolean} True if the object is a plain object, otherwise false
*/
Common.isPlainObject = function(obj) {
return typeof obj === 'object' && obj.constructor === Object;
};
/**
* Returns true if the object is a string.
* @method isString
* @param {object} obj
* @return {boolean} True if the object is a string, otherwise false
*/
Common.isString = function(obj) {
return toString.call(obj) === '[object String]';
};
/**
* Returns the given value clamped between a minimum and maximum value.
* @method clamp
* @param {number} value
* @param {number} min
* @param {number} max
* @return {number} The value clamped between min and max inclusive
*/
Common.clamp = function(value, min, max) {
if (value < min)
return min;
if (value > max)
return max;
return value;
};
/**
* Returns the sign of the given value.
* @method sign
* @param {number} value
* @return {number} -1 if negative, +1 if 0 or positive
*/
Common.sign = function(value) {
return value < 0 ? -1 : 1;
};
/**
* Returns the current timestamp since the time origin (e.g. from page load).
* The result is in milliseconds and will use high-resolution timing if available.
* @method now
* @return {number} the current timestamp in milliseconds
*/
Common.now = function() {
if (typeof window !== 'undefined' && window.performance) {
if (window.performance.now) {
return window.performance.now();
} else if (window.performance.webkitNow) {
return window.performance.webkitNow();
}
}
if (Date.now) {
return Date.now();
}
return (new Date()) - Common._nowStartTime;
};
/**
* Returns a random value between a minimum and a maximum value inclusive.
* The function uses a seeded random generator.
* @method random
* @param {number} min
* @param {number} max
* @return {number} A random number between min and max inclusive
*/
Common.random = function(min, max) {
min = (typeof min !== "undefined") ? min : 0;
max = (typeof max !== "undefined") ? max : 1;
return min + _seededRandom() * (max - min);
};
var _seededRandom = function() {
// https://en.wikipedia.org/wiki/Linear_congruential_generator
Common._seed = (Common._seed * 9301 + 49297) % 233280;
return Common._seed / 233280;
};
/**
* Converts a CSS hex colour string into an integer.
* @method colorToNumber
* @param {string} colorString
* @return {number} An integer representing the CSS hex string
*/
Common.colorToNumber = function(colorString) {
colorString = colorString.replace('#','');
if (colorString.length == 3) {
colorString = colorString.charAt(0) + colorString.charAt(0)
+ colorString.charAt(1) + colorString.charAt(1)
+ colorString.charAt(2) + colorString.charAt(2);
}
return parseInt(colorString, 16);
};
/**
* The console logging level to use, where each level includes all levels above and excludes the levels below.
* The default level is 'debug' which shows all console messages.
*
* Possible level values are:
* - 0 = None
* - 1 = Debug
* - 2 = Info
* - 3 = Warn
* - 4 = Error
* @static
* @property logLevel
* @type {Number}
* @default 1
*/
Common.logLevel = 1;
/**
* Shows a `console.log` message only if the current `Common.logLevel` allows it.
* The message will be prefixed with 'matter-js' to make it easily identifiable.
* @method log
* @param ...objs {} The objects to log.
*/
Common.log = function() {
if (console && Common.logLevel > 0 && Common.logLevel <= 3) {
console.log.apply(console, ['matter-js:'].concat(Array.prototype.slice.call(arguments)));
}
};
/**
* Shows a `console.info` message only if the current `Common.logLevel` allows it.
* The message will be prefixed with 'matter-js' to make it easily identifiable.
* @method info
* @param ...objs {} The objects to log.
*/
Common.info = function() {
if (console && Common.logLevel > 0 && Common.logLevel <= 2) {
console.info.apply(console, ['matter-js:'].concat(Array.prototype.slice.call(arguments)));
}
};
/**
* Shows a `console.warn` message only if the current `Common.logLevel` allows it.
* The message will be prefixed with 'matter-js' to make it easily identifiable.
* @method warn
* @param ...objs {} The objects to log.
*/
Common.warn = function() {
if (console && Common.logLevel > 0 && Common.logLevel <= 3) {
console.warn.apply(console, ['matter-js:'].concat(Array.prototype.slice.call(arguments)));
}
};
/**
* Uses `Common.warn` to log the given message one time only.
* @method warnOnce
* @param ...objs {} The objects to log.
*/
Common.warnOnce = function() {
var message = Array.prototype.slice.call(arguments).join(' ');
if (!Common._warnedOnce[message]) {
Common.warn(message);
Common._warnedOnce[message] = true;
}
};
/**
* Shows a deprecated console warning when the function on the given object is called.
* The target function will be replaced with a new function that first shows the warning
* and then calls the original function.
* @method deprecated
* @param {object} obj The object or module
* @param {string} name The property name of the function on obj
* @param {string} warning The one-time message to show if the function is called
*/
Common.deprecated = function(obj, prop, warning) {
obj[prop] = Common.chain(function() {
Common.warnOnce('🔅 deprecated 🔅', warning);
}, obj[prop]);
};
/**
* Returns the next unique sequential ID.
* @method nextId
* @return {Number} Unique sequential ID
*/
Common.nextId = function() {
return Common._nextId++;
};
/**
* A cross browser compatible indexOf implementation.
* @method indexOf
* @param {array} haystack
* @param {object} needle
* @return {number} The position of needle in haystack, otherwise -1.
*/
Common.indexOf = function(haystack, needle) {
if (haystack.indexOf)
return haystack.indexOf(needle);
for (var i = 0; i < haystack.length; i++) {
if (haystack[i] === needle)
return i;
}
return -1;
};
/**
* A cross browser compatible array map implementation.
* @method map
* @param {array} list
* @param {function} func
* @return {array} Values from list transformed by func.
*/
Common.map = function(list, func) {
if (list.map) {
return list.map(func);
}
var mapped = [];
for (var i = 0; i < list.length; i += 1) {
mapped.push(func(list[i]));
}
return mapped;
};
/**
* Takes a directed graph and returns the partially ordered set of vertices in topological order.
* Circular dependencies are allowed.
* @method topologicalSort
* @param {object} graph
* @return {array} Partially ordered set of vertices in topological order.
*/
Common.topologicalSort = function(graph) {
// https://github.com/mgechev/javascript-algorithms
// Copyright (c) Minko Gechev (MIT license)
// Modifications: tidy formatting and naming
var result = [],
visited = [],
temp = [];
for (var node in graph) {
if (!visited[node] && !temp[node]) {
Common._topologicalSort(node, visited, temp, graph, result);
}
}
return result;
};
Common._topologicalSort = function(node, visited, temp, graph, result) {
var neighbors = graph[node] || [];
temp[node] = true;
for (var i = 0; i < neighbors.length; i += 1) {
var neighbor = neighbors[i];
if (temp[neighbor]) {
// skip circular dependencies
continue;
}
if (!visited[neighbor]) {
Common._topologicalSort(neighbor, visited, temp, graph, result);
}
}
temp[node] = false;
visited[node] = true;
result.push(node);
};
/**
* Takes _n_ functions as arguments and returns a new function that calls them in order.
* The arguments applied when calling the new function will also be applied to every function passed.
* The value of `this` refers to the last value returned in the chain that was not `undefined`.
* Therefore if a passed function does not return a value, the previously returned value is maintained.
* After all passed functions have been called the new function returns the last returned value (if any).
* If any of the passed functions are a chain, then the chain will be flattened.
* @method chain
* @param ...funcs {function} The functions to chain.
* @return {function} A new function that calls the passed functions in order.
*/
Common.chain = function() {
var funcs = [];
for (var i = 0; i < arguments.length; i += 1) {
var func = arguments[i];
if (func._chained) {
// flatten already chained functions
funcs.push.apply(funcs, func._chained);
} else {
funcs.push(func);
}
}
var chain = function() {
// https://github.com/GoogleChrome/devtools-docs/issues/53#issuecomment-51941358
var lastResult,
args = new Array(arguments.length);
for (var i = 0, l = arguments.length; i < l; i++) {
args[i] = arguments[i];
}
for (i = 0; i < funcs.length; i += 1) {
var result = funcs[i].apply(lastResult, args);
if (typeof result !== 'undefined') {
lastResult = result;
}
}
return lastResult;
};
chain._chained = funcs;
return chain;
};
/**
* Chains a function to excute before the original function on the given `path` relative to `base`.
* See also docs for `Common.chain`.
* @method chainPathBefore
* @param {} base The base object
* @param {string} path The path relative to `base`
* @param {function} func The function to chain before the original
* @return {function} The chained function that replaced the original
*/
Common.chainPathBefore = function(base, path, func) {
return Common.set(base, path, Common.chain(
func,
Common.get(base, path)
));
};
/**
* Chains a function to excute after the original function on the given `path` relative to `base`.
* See also docs for `Common.chain`.
* @method chainPathAfter
* @param {} base The base object
* @param {string} path The path relative to `base`
* @param {function} func The function to chain after the original
* @return {function} The chained function that replaced the original
*/
Common.chainPathAfter = function(base, path, func) {
return Common.set(base, path, Common.chain(
Common.get(base, path),
func
));
};
/**
* Provide the [poly-decomp](https://github.com/schteppe/poly-decomp.js) library module to enable
* concave vertex decomposition support when using `Bodies.fromVertices` e.g. `Common.setDecomp(require('poly-decomp'))`.
* @method setDecomp
* @param {} decomp The [poly-decomp](https://github.com/schteppe/poly-decomp.js) library module.
*/
Common.setDecomp = function(decomp) {
Common._decomp = decomp;
};
/**
* Returns the [poly-decomp](https://github.com/schteppe/poly-decomp.js) library module provided through `Common.setDecomp`,
* otherwise returns the global `decomp` if set.
* @method getDecomp
* @return {} The [poly-decomp](https://github.com/schteppe/poly-decomp.js) library module if provided.
*/
Common.getDecomp = function() {
// get user provided decomp if set
var decomp = Common._decomp;
try {
// otherwise from window global
if (!decomp && typeof window !== 'undefined') {
decomp = window.decomp;
}
// otherwise from node global
if (!decomp && typeof global !== 'undefined') {
decomp = global.decomp;
}
} catch (e) {
// decomp not available
decomp = null;
}
return decomp;
};
})();
/***/ }),
/* 1 */
/***/ (function(module, exports) {
/**
* The `Matter.Bounds` module contains methods for creating and manipulating axis-aligned bounding boxes (AABB).
*
* @class Bounds
*/
var Bounds = {};
module.exports = Bounds;
(function() {
/**
* Creates a new axis-aligned bounding box (AABB) for the given vertices.
* @method create
* @param {vertices} vertices
* @return {bounds} A new bounds object
*/
Bounds.create = function(vertices) {
var bounds = {
min: { x: 0, y: 0 },
max: { x: 0, y: 0 }
};
if (vertices)
Bounds.update(bounds, vertices);
return bounds;
};
/**
* Updates bounds using the given vertices and extends the bounds given a velocity.
* @method update
* @param {bounds} bounds
* @param {vertices} vertices
* @param {vector} velocity
*/
Bounds.update = function(bounds, vertices, velocity) {
bounds.min.x = Infinity;
bounds.max.x = -Infinity;
bounds.min.y = Infinity;
bounds.max.y = -Infinity;
for (var i = 0; i < vertices.length; i++) {
var vertex = vertices[i];
if (vertex.x > bounds.max.x) bounds.max.x = vertex.x;
if (vertex.x < bounds.min.x) bounds.min.x = vertex.x;
if (vertex.y > bounds.max.y) bounds.max.y = vertex.y;
if (vertex.y < bounds.min.y) bounds.min.y = vertex.y;
}
if (velocity) {
if (velocity.x > 0) {
bounds.max.x += velocity.x;
} else {
bounds.min.x += velocity.x;
}
if (velocity.y > 0) {
bounds.max.y += velocity.y;
} else {
bounds.min.y += velocity.y;
}
}
};
/**
* Returns true if the bounds contains the given point.
* @method contains
* @param {bounds} bounds
* @param {vector} point
* @return {boolean} True if the bounds contain the point, otherwise false
*/
Bounds.contains = function(bounds, point) {
return point.x >= bounds.min.x && point.x <= bounds.max.x
&& point.y >= bounds.min.y && point.y <= bounds.max.y;
};
/**
* Returns true if the two bounds intersect.
* @method overlaps
* @param {bounds} boundsA
* @param {bounds} boundsB
* @return {boolean} True if the bounds overlap, otherwise false
*/
Bounds.overlaps = function(boundsA, boundsB) {
return (boundsA.min.x <= boundsB.max.x && boundsA.max.x >= boundsB.min.x
&& boundsA.max.y >= boundsB.min.y && boundsA.min.y <= boundsB.max.y);
};
/**
* Translates the bounds by the given vector.
* @method translate
* @param {bounds} bounds
* @param {vector} vector
*/
Bounds.translate = function(bounds, vector) {
bounds.min.x += vector.x;
bounds.max.x += vector.x;
bounds.min.y += vector.y;
bounds.max.y += vector.y;
};
/**
* Shifts the bounds to the given position.
* @method shift
* @param {bounds} bounds
* @param {vector} position
*/
Bounds.shift = function(bounds, position) {
var deltaX = bounds.max.x - bounds.min.x,
deltaY = bounds.max.y - bounds.min.y;
bounds.min.x = position.x;
bounds.max.x = position.x + deltaX;
bounds.min.y = position.y;
bounds.max.y = position.y + deltaY;
};
})();
/***/ }),
/* 2 */
/***/ (function(module, exports) {
/**
* The `Matter.Vector` module contains methods for creating and manipulating vectors.
* Vectors are the basis of all the geometry related operations in the engine.
* A `Matter.Vector` object is of the form `{ x: 0, y: 0 }`.
*
* See the included usage [examples](https://github.com/liabru/matter-js/tree/master/examples).
*
* @class Vector
*/
// TODO: consider params for reusing vector objects
var Vector = {};
module.exports = Vector;
(function() {
/**
* Creates a new vector.
* @method create
* @param {number} x
* @param {number} y
* @return {vector} A new vector
*/
Vector.create = function(x, y) {
return { x: x || 0, y: y || 0 };
};
/**
* Returns a new vector with `x` and `y` copied from the given `vector`.
* @method clone
* @param {vector} vector
* @return {vector} A new cloned vector
*/
Vector.clone = function(vector) {
return { x: vector.x, y: vector.y };
};
/**
* Returns the magnitude (length) of a vector.
* @method magnitude
* @param {vector} vector
* @return {number} The magnitude of the vector
*/
Vector.magnitude = function(vector) {
return Math.sqrt((vector.x * vector.x) + (vector.y * vector.y));
};
/**
* Returns the magnitude (length) of a vector (therefore saving a `sqrt` operation).
* @method magnitudeSquared
* @param {vector} vector
* @return {number} The squared magnitude of the vector
*/
Vector.magnitudeSquared = function(vector) {
return (vector.x * vector.x) + (vector.y * vector.y);
};
/**
* Rotates the vector about (0, 0) by specified angle.
* @method rotate
* @param {vector} vector
* @param {number} angle
* @param {vector} [output]
* @return {vector} The vector rotated about (0, 0)
*/
Vector.rotate = function(vector, angle, output) {
var cos = Math.cos(angle), sin = Math.sin(angle);
if (!output) output = {};
var x = vector.x * cos - vector.y * sin;
output.y = vector.x * sin + vector.y * cos;
output.x = x;
return output;
};
/**
* Rotates the vector about a specified point by specified angle.
* @method rotateAbout
* @param {vector} vector
* @param {number} angle
* @param {vector} point
* @param {vector} [output]
* @return {vector} A new vector rotated about the point
*/
Vector.rotateAbout = function(vector, angle, point, output) {
var cos = Math.cos(angle), sin = Math.sin(angle);
if (!output) output = {};
var x = point.x + ((vector.x - point.x) * cos - (vector.y - point.y) * sin);
output.y = point.y + ((vector.x - point.x) * sin + (vector.y - point.y) * cos);
output.x = x;
return output;
};
/**
* Normalises a vector (such that its magnitude is `1`).
* @method normalise
* @param {vector} vector
* @return {vector} A new vector normalised
*/
Vector.normalise = function(vector) {
var magnitude = Vector.magnitude(vector);
if (magnitude === 0)
return { x: 0, y: 0 };
return { x: vector.x / magnitude, y: vector.y / magnitude };
};
/**
* Returns the dot-product of two vectors.
* @method dot
* @param {vector} vectorA
* @param {vector} vectorB
* @return {number} The dot product of the two vectors
*/
Vector.dot = function(vectorA, vectorB) {
return (vectorA.x * vectorB.x) + (vectorA.y * vectorB.y);
};
/**
* Returns the cross-product of two vectors.
* @method cross
* @param {vector} vectorA
* @param {vector} vectorB
* @return {number} The cross product of the two vectors
*/
Vector.cross = function(vectorA, vectorB) {
return (vectorA.x * vectorB.y) - (vectorA.y * vectorB.x);
};
/**
* Returns the cross-product of three vectors.
* @method cross3
* @param {vector} vectorA
* @param {vector} vectorB
* @param {vector} vectorC
* @return {number} The cross product of the three vectors
*/
Vector.cross3 = function(vectorA, vectorB, vectorC) {
return (vectorB.x - vectorA.x) * (vectorC.y - vectorA.y) - (vectorB.y - vectorA.y) * (vectorC.x - vectorA.x);
};
/**
* Adds the two vectors.
* @method add
* @param {vector} vectorA
* @param {vector} vectorB
* @param {vector} [output]
* @return {vector} A new vector of vectorA and vectorB added
*/
Vector.add = function(vectorA, vectorB, output) {
if (!output) output = {};
output.x = vectorA.x + vectorB.x;
output.y = vectorA.y + vectorB.y;
return output;
};
/**
* Subtracts the two vectors.
* @method sub
* @param {vector} vectorA
* @param {vector} vectorB
* @param {vector} [output]
* @return {vector} A new vector of vectorA and vectorB subtracted
*/
Vector.sub = function(vectorA, vectorB, output) {
if (!output) output = {};
output.x = vectorA.x - vectorB.x;
output.y = vectorA.y - vectorB.y;
return output;
};
/**
* Multiplies a vector and a scalar.
* @method mult
* @param {vector} vector
* @param {number} scalar
* @return {vector} A new vector multiplied by scalar
*/
Vector.mult = function(vector, scalar) {
return { x: vector.x * scalar, y: vector.y * scalar };
};
/**
* Divides a vector and a scalar.
* @method div
* @param {vector} vector
* @param {number} scalar
* @return {vector} A new vector divided by scalar
*/
Vector.div = function(vector, scalar) {
return { x: vector.x / scalar, y: vector.y / scalar };
};
/**
* Returns the perpendicular vector. Set `negate` to true for the perpendicular in the opposite direction.
* @method perp
* @param {vector} vector
* @param {bool} [negate=false]
* @return {vector} The perpendicular vector
*/
Vector.perp = function(vector, negate) {
negate = negate === true ? -1 : 1;
return { x: negate * -vector.y, y: negate * vector.x };
};
/**
* Negates both components of a vector such that it points in the opposite direction.
* @method neg
* @param {vector} vector
* @return {vector} The negated vector
*/
Vector.neg = function(vector) {
return { x: -vector.x, y: -vector.y };
};
/**
* Returns the angle between the vector `vectorB - vectorA` and the x-axis in radians.
* @method angle
* @param {vector} vectorA
* @param {vector} vectorB
* @return {number} The angle in radians
*/
Vector.angle = function(vectorA, vectorB) {
return Math.atan2(vectorB.y - vectorA.y, vectorB.x - vectorA.x);
};
/**
* Temporary vector pool (not thread-safe).
* @property _temp
* @type {vector[]}
* @private
*/
Vector._temp = [
Vector.create(), Vector.create(),
Vector.create(), Vector.create(),
Vector.create(), Vector.create()
];
})();
/***/ }),
/* 3 */
/***/ (function(module, exports, __webpack_require__) {
/**
* The `Matter.Vertices` module contains methods for creating and manipulating sets of vertices.
* A set of vertices is an array of `Matter.Vector` with additional indexing properties inserted by `Vertices.create`.
* A `Matter.Body` maintains a set of vertices to represent the shape of the object (its convex hull).
*
* See the included usage [examples](https://github.com/liabru/matter-js/tree/master/examples).
*
* @class Vertices
*/
var Vertices = {};
module.exports = Vertices;
var Vector = __webpack_require__(2);
var Common = __webpack_require__(0);
(function() {
/**
* Creates a new set of `Matter.Body` compatible vertices.
* The `points` argument accepts an array of `Matter.Vector` points orientated around the origin `(0, 0)`, for example:
*
* [{ x: 0, y: 0 }, { x: 25, y: 50 }, { x: 50, y: 0 }]
*
* The `Vertices.create` method returns a new array of vertices, which are similar to Matter.Vector objects,
* but with some additional references required for efficient collision detection routines.
*
* Vertices must be specified in clockwise order.
*
* Note that the `body` argument is not optional, a `Matter.Body` reference must be provided.
*
* @method create
* @param {vector[]} points
* @param {body} body
*/
Vertices.create = function(points, body) {
var vertices = [];
for (var i = 0; i < points.length; i++) {
var point = points[i],
vertex = {
x: point.x,
y: point.y,
index: i,
body: body,
isInternal: false
};
vertices.push(vertex);
}
return vertices;
};
/**
* Parses a string containing ordered x y pairs separated by spaces (and optionally commas),
* into a `Matter.Vertices` object for the given `Matter.Body`.
* For parsing SVG paths, see `Svg.pathToVertices`.
* @method fromPath
* @param {string} path
* @param {body} body
* @return {vertices} vertices
*/
Vertices.fromPath = function(path, body) {
var pathPattern = /L?\s*([-\d.e]+)[\s,]*([-\d.e]+)*/ig,
points = [];
path.replace(pathPattern, function(match, x, y) {
points.push({ x: parseFloat(x), y: parseFloat(y) });
});
return Vertices.create(points, body);
};
/**
* Returns the centre (centroid) of the set of vertices.
* @method centre
* @param {vertices} vertices
* @return {vector} The centre point
*/
Vertices.centre = function(vertices) {
var area = Vertices.area(vertices, true),
centre = { x: 0, y: 0 },
cross,
temp,
j;
for (var i = 0; i < vertices.length; i++) {
j = (i + 1) % vertices.length;
cross = Vector.cross(vertices[i], vertices[j]);
temp = Vector.mult(Vector.add(vertices[i], vertices[j]), cross);
centre = Vector.add(centre, temp);
}
return Vector.div(centre, 6 * area);
};
/**
* Returns the average (mean) of the set of vertices.
* @method mean
* @param {vertices} vertices
* @return {vector} The average point
*/
Vertices.mean = function(vertices) {
var average = { x: 0, y: 0 };
for (var i = 0; i < vertices.length; i++) {
average.x += vertices[i].x;
average.y += vertices[i].y;
}
return Vector.div(average, vertices.length);
};
/**
* Returns the area of the set of vertices.
* @method area
* @param {vertices} vertices
* @param {bool} signed
* @return {number} The area
*/
Vertices.area = function(vertices, signed) {
var area = 0,
j = vertices.length - 1;
for (var i = 0; i < vertices.length; i++) {
area += (vertices[j].x - vertices[i].x) * (vertices[j].y + vertices[i].y);
j = i;
}
if (signed)
return area / 2;
return Math.abs(area) / 2;
};
/**
* Returns the moment of inertia (second moment of area) of the set of vertices given the total mass.
* @method inertia
* @param {vertices} vertices
* @param {number} mass
* @return {number} The polygon's moment of inertia
*/
Vertices.inertia = function(vertices, mass) {
var numerator = 0,
denominator = 0,
v = vertices,
cross,
j;
// find the polygon's moment of inertia, using second moment of area
// from equations at http://www.physicsforums.com/showthread.php?t=25293
for (var n = 0; n < v.length; n++) {
j = (n + 1) % v.length;
cross = Math.abs(Vector.cross(v[j], v[n]));
numerator += cross * (Vector.dot(v[j], v[j]) + Vector.dot(v[j], v[n]) + Vector.dot(v[n], v[n]));
denominator += cross;
}
return (mass / 6) * (numerator / denominator);
};
/**
* Translates the set of vertices in-place.
* @method translate
* @param {vertices} vertices
* @param {vector} vector
* @param {number} scalar
*/
Vertices.translate = function(vertices, vector, scalar) {
scalar = typeof scalar !== 'undefined' ? scalar : 1;
var verticesLength = vertices.length,
translateX = vector.x * scalar,
translateY = vector.y * scalar,
i;
for (i = 0; i < verticesLength; i++) {
vertices[i].x += translateX;
vertices[i].y += translateY;
}
return vertices;
};
/**
* Rotates the set of vertices in-place.
* @method rotate
* @param {vertices} vertices
* @param {number} angle
* @param {vector} point
*/
Vertices.rotate = function(vertices, angle, point) {
if (angle === 0)
return;
var cos = Math.cos(angle),
sin = Math.sin(angle),
pointX = point.x,
pointY = point.y,
verticesLength = vertices.length,
vertex,
dx,
dy,
i;
for (i = 0; i < verticesLength; i++) {
vertex = vertices[i];
dx = vertex.x - pointX;
dy = vertex.y - pointY;
vertex.x = pointX + (dx * cos - dy * sin);
vertex.y = pointY + (dx * sin + dy * cos);
}
return vertices;
};
/**
* Returns `true` if the `point` is inside the set of `vertices`.
* @method contains
* @param {vertices} vertices
* @param {vector} point
* @return {boolean} True if the vertices contains point, otherwise false
*/
Vertices.contains = function(vertices, point) {
var pointX = point.x,
pointY = point.y,
verticesLength = vertices.length,
vertex = vertices[verticesLength - 1],
nextVertex;
for (var i = 0; i < verticesLength; i++) {
nextVertex = vertices[i];
if ((pointX - vertex.x) * (nextVertex.y - vertex.y)
+ (pointY - vertex.y) * (vertex.x - nextVertex.x) > 0) {
return false;
}
vertex = nextVertex;
}
return true;
};
/**
* Scales the vertices from a point (default is centre) in-place.
* @method scale
* @param {vertices} vertices
* @param {number} scaleX
* @param {number} scaleY
* @param {vector} point
*/
Vertices.scale = function(vertices, scaleX, scaleY, point) {
if (scaleX === 1 && scaleY === 1)
return vertices;
point = point || Vertices.centre(vertices);
var vertex,
delta;
for (var i = 0; i < vertices.length; i++) {
vertex = vertices[i];
delta = Vector.sub(vertex, point);
vertices[i].x = point.x + delta.x * scaleX;
vertices[i].y = point.y + delta.y * scaleY;
}
return vertices;
};
/**
* Chamfers a set of vertices by giving them rounded corners, returns a new set of vertices.
* The radius parameter is a single number or an array to specify the radius for each vertex.
* @method chamfer
* @param {vertices} vertices
* @param {number[]} radius
* @param {number} quality
* @param {number} qualityMin
* @param {number} qualityMax
*/
Vertices.chamfer = function(vertices, radius, quality, qualityMin, qualityMax) {
if (typeof radius === 'number') {
radius = [radius];
} else {
radius = radius || [8];
}
// quality defaults to -1, which is auto
quality = (typeof quality !== 'undefined') ? quality : -1;
qualityMin = qualityMin || 2;
qualityMax = qualityMax || 14;
var newVertices = [];
for (var i = 0; i < vertices.length; i++) {
var prevVertex = vertices[i - 1 >= 0 ? i - 1 : vertices.length - 1],
vertex = vertices[i],
nextVertex = vertices[(i + 1) % vertices.length],
currentRadius = radius[i < radius.length ? i : radius.length - 1];
if (currentRadius === 0) {
newVertices.push(vertex);
continue;
}
var prevNormal = Vector.normalise({
x: vertex.y - prevVertex.y,
y: prevVertex.x - vertex.x
});
var nextNormal = Vector.normalise({
x: nextVertex.y - vertex.y,
y: vertex.x - nextVertex.x
});
var diagonalRadius = Math.sqrt(2 * Math.pow(currentRadius, 2)),
radiusVector = Vector.mult(Common.clone(prevNormal), currentRadius),
midNormal = Vector.normalise(Vector.mult(Vector.add(prevNormal, nextNormal), 0.5)),
scaledVertex = Vector.sub(vertex, Vector.mult(midNormal, diagonalRadius));
var precision = quality;
if (quality === -1) {
// automatically decide precision
precision = Math.pow(currentRadius, 0.32) * 1.75;
}
precision = Common.clamp(precision, qualityMin, qualityMax);
// use an even value for precision, more likely to reduce axes by using symmetry
if (precision % 2 === 1)
precision += 1;
var alpha = Math.acos(Vector.dot(prevNormal, nextNormal)),
theta = alpha / precision;
for (var j = 0; j < precision; j++) {
newVertices.push(Vector.add(Vector.rotate(radiusVector, theta * j), scaledVertex));
}
}
return newVertices;
};
/**
* Sorts the input vertices into clockwise order in place.
* @method clockwiseSort
* @param {vertices} vertices
* @return {vertices} vertices
*/
Vertices.clockwiseSort = function(vertices) {
var centre = Vertices.mean(vertices);
vertices.sort(function(vertexA, vertexB) {
return Vector.angle(centre, vertexA) - Vector.angle(centre, vertexB);
});
return vertices;
};
/**
* Returns true if the vertices form a convex shape (vertices must be in clockwise order).
* @method isConvex
* @param {vertices} vertices
* @return {bool} `true` if the `vertices` are convex, `false` if not (or `null` if not computable).
*/
Vertices.isConvex = function(vertices) {
// http://paulbourke.net/geometry/polygonmesh/
// Copyright (c) Paul Bourke (use permitted)
var flag = 0,
n = vertices.length,
i,
j,
k,
z;
if (n < 3)
return null;
for (i = 0; i < n; i++) {
j = (i + 1) % n;
k = (i + 2) % n;
z = (vertices[j].x - vertices[i].x) * (vertices[k].y - vertices[j].y);
z -= (vertices[j].y - vertices[i].y) * (vertices[k].x - vertices[j].x);
if (z < 0) {
flag |= 1;
} else if (z > 0) {
flag |= 2;
}
if (flag === 3) {
return false;
}
}
if (flag !== 0){
return true;
} else {
return null;
}
};
/**
* Returns the convex hull of the input vertices as a new array of points.
* @method hull
* @param {vertices} vertices
* @return [vertex] vertices
*/
Vertices.hull = function(vertices) {
// http://geomalgorithms.com/a10-_hull-1.html
var upper = [],
lower = [],
vertex,
i;
// sort vertices on x-axis (y-axis for ties)
vertices = vertices.slice(0);
vertices.sort(function(vertexA, vertexB) {
var dx = vertexA.x - vertexB.x;
return dx !== 0 ? dx : vertexA.y - vertexB.y;
});
// build lower hull
for (i = 0; i < vertices.length; i += 1) {
vertex = vertices[i];
while (lower.length >= 2
&& Vector.cross3(lower[lower.length - 2], lower[lower.length - 1], vertex) <= 0) {
lower.pop();
}
lower.push(vertex);
}
// build upper hull
for (i = vertices.length - 1; i >= 0; i -= 1) {
vertex = vertices[i];
while (upper.length >= 2
&& Vector.cross3(upper[upper.length - 2], upper[upper.length - 1], vertex) <= 0) {
upper.pop();
}
upper.push(vertex);
}
// concatenation of the lower and upper hulls gives the convex hull
// omit last points because they are repeated at the beginning of the other list
upper.pop();
lower.pop();
return upper.concat(lower);
};
})();
/***/ }),
/* 4 */
/***/ (function(module, exports, __webpack_require__) {
/**
* The `Matter.Body` module contains methods for creating and manipulating rigid bodies.
* For creating bodies with common configurations such as rectangles, circles and other polygons see the module `Matter.Bodies`.
*
* See the included usage [examples](https://github.com/liabru/matter-js/tree/master/examples).
* @class Body
*/
var Body = {};
module.exports = Body;
var Vertices = __webpack_require__(3);
var Vector = __webpack_require__(2);
var Sleeping = __webpack_require__(7);
var Common = __webpack_require__(0);
var Bounds = __webpack_require__(1);
var Axes = __webpack_require__(11);
(function() {
Body._timeCorrection = true;
Body._inertiaScale = 4;
Body._nextCollidingGroupId = 1;
Body._nextNonCollidingGroupId = -1;
Body._nextCategory = 0x0001;
Body._baseDelta = 1000 / 60;
/**
* Creates a new rigid body model. The options parameter is an object that specifies any properties you wish to override the defaults.
* All properties have default values, and many are pre-calculated automatically based on other properties.
* Vertices must be specified in clockwise order.
* See the properties section below for detailed information on what you can pass via the `options` object.
* @method create
* @param {} options
* @return {body} body
*/
Body.create = function(options) {
var defaults = {
id: Common.nextId(),
type: 'body',
label: 'Body',
parts: [],
plugin: {},
angle: 0,
vertices: Vertices.fromPath('L 0 0 L 40 0 L 40 40 L 0 40'),
position: { x: 0, y: 0 },
force: { x: 0, y: 0 },
torque: 0,
positionImpulse: { x: 0, y: 0 },
constraintImpulse: { x: 0, y: 0, angle: 0 },
totalContacts: 0,
speed: 0,
angularSpeed: 0,
velocity: { x: 0, y: 0 },
angularVelocity: 0,
isSensor: false,
isStatic: false,
isSleeping: false,
motion: 0,
sleepThreshold: 60,
density: 0.001,
restitution: 0,
friction: 0.1,
frictionStatic: 0.5,
frictionAir: 0.01,
collisionFilter: {
category: 0x0001,
mask: 0xFFFFFFFF,
group: 0
},
slop: 0.05,
timeScale: 1,
render: {
visible: true,
opacity: 1,
strokeStyle: null,
fillStyle: null,
lineWidth: null,
sprite: {
xScale: 1,
yScale: 1,
xOffset: 0,
yOffset: 0
}
},
events: null,
bounds: null,
chamfer: null,
circleRadius: 0,
positionPrev: null,
anglePrev: 0,
parent: null,
axes: null,
area: 0,
mass: 0,
inertia: 0,
deltaTime: 1000 / 60,
_original: null
};
var body = Common.extend(defaults, options);
_initProperties(body, options);
return body;
};
/**
* Returns the next unique group index for which bodies will collide.
* If `isNonColliding` is `true`, returns the next unique group index for which bodies will _not_ collide.
* See `body.collisionFilter` for more information.
* @method nextGroup
* @param {bool} [isNonColliding=false]
* @return {Number} Unique group index
*/
Body.nextGroup = function(isNonColliding) {
if (isNonColliding)
return Body._nextNonCollidingGroupId--;
return Body._nextCollidingGroupId++;
};
/**
* Returns the next unique category bitfield (starting after the initial default category `0x0001`).
* There are 32 available. See `body.collisionFilter` for more information.
* @method nextCategory
* @return {Number} Unique category bitfield
*/
Body.nextCategory = function() {
Body._nextCategory = Body._nextCategory << 1;
return Body._nextCategory;
};
/**
* Initialises body properties.
* @method _initProperties
* @private
* @param {body} body
* @param {} [options]
*/
var _initProperties = function(body, options) {
options = options || {};
// init required properties (order is important)
Body.set(body, {
bounds: body.bounds || Bounds.create(body.vertices),
positionPrev: body.positionPrev || Vector.clone(body.position),
anglePrev: body.anglePrev || body.angle,
vertices: body.vertices,
parts: body.parts || [body],
isStatic: body.isStatic,
isSleeping: body.isSleeping,
parent: body.parent || body
});
Vertices.rotate(body.vertices, body.angle, body.position);
Axes.rotate(body.axes, body.angle);
Bounds.update(body.bounds, body.vertices, body.velocity);
// allow options to override the automatically calculated properties
Body.set(body, {
axes: options.axes || body.axes,
area: options.area || body.area,
mass: options.mass || body.mass,
inertia: options.inertia || body.inertia
});
// render properties
var defaultFillStyle = (body.isStatic ? '#14151f' : Common.choose(['#f19648', '#f5d259', '#f55a3c', '#063e7b', '#ececd1'])),
defaultStrokeStyle = body.isStatic ? '#555' : '#ccc',
defaultLineWidth = body.isStatic && body.render.fillStyle === null ? 1 : 0;
body.render.fillStyle = body.render.fillStyle || defaultFillStyle;
body.render.strokeStyle = body.render.strokeStyle || defaultStrokeStyle;
body.render.lineWidth = body.render.lineWidth || defaultLineWidth;
body.render.sprite.xOffset += -(body.bounds.min.x - body.position.x) / (body.bounds.max.x - body.bounds.min.x);
body.render.sprite.yOffset += -(body.bounds.min.y - body.position.y) / (body.bounds.max.y - body.bounds.min.y);
};
/**
* Given a property and a value (or map of), sets the property(s) on the body, using the appropriate setter functions if they exist.
* Prefer to use the actual setter functions in performance critical situations.
* @method set
* @param {body} body
* @param {} settings A property name (or map of properties and values) to set on the body.
* @param {} value The value to set if `settings` is a single property name.
*/
Body.set = function(body, settings, value) {
var property;
if (typeof settings === 'string') {
property = settings;
settings = {};
settings[property] = value;
}
for (property in settings) {
if (!Object.prototype.hasOwnProperty.call(settings, property))
continue;
value = settings[property];
switch (property) {
case 'isStatic':
Body.setStatic(body, value);
break;
case 'isSleeping':
Sleeping.set(body, value);
break;
case 'mass':
Body.setMass(body, value);
break;
case 'density':
Body.setDensity(body, value);
break;
case 'inertia':
Body.setInertia(body, value);
break;
case 'vertices':
Body.setVertices(body, value);
break;
case 'position':
Body.setPosition(body, value);
break;
case 'angle':
Body.setAngle(body, value);
break;
case 'velocity':
Body.setVelocity(body, value);
break;
case 'angularVelocity':
Body.setAngularVelocity(body, value);
break;
case 'speed':
Body.setSpeed(body, value);
break;
case 'angularSpeed':
Body.setAngularSpeed(body, value);
break;
case 'parts':
Body.setParts(body, value);
break;
case 'centre':
Body.setCentre(body, value);
break;
default:
body[property] = value;
}
}
};
/**
* Sets the body as static, including isStatic flag and setting mass and inertia to Infinity.
* @method setStatic
* @param {body} body
* @param {bool} isStatic
*/
Body.setStatic = function(body, isStatic) {
for (var i = 0; i < body.parts.length; i++) {
var part = body.parts[i];
if (isStatic) {
if (!part.isStatic) {
part._original = {
restitution: part.restitution,
friction: part.friction,
mass: part.mass,
inertia: part.inertia,
density: part.density,
inverseMass: part.inverseMass,
inverseInertia: part.inverseInertia
};
}
part.restitution = 0;
part.friction = 1;
part.mass = part.inertia = part.density = Infinity;
part.inverseMass = part.inverseInertia = 0;
part.positionPrev.x = part.position.x;
part.positionPrev.y = part.position.y;
part.anglePrev = part.angle;
part.angularVelocity = 0;
part.speed = 0;
part.angularSpeed = 0;
part.motion = 0;
} else if (part._original) {
part.restitution = part._original.restitution;
part.friction = part._original.friction;
part.mass = part._original.mass;
part.inertia = part._original.inertia;
part.density = part._original.density;
part.inverseMass = part._original.inverseMass;
part.inverseInertia = part._original.inverseInertia;
part._original = null;
}
part.isStatic = isStatic;
}
};
/**
* Sets the mass of the body. Inverse mass, density and inertia are automatically updated to reflect the change.
* @method setMass
* @param {body} body
* @param {number} mass
*/
Body.setMass = function(body, mass) {
var moment = body.inertia / (body.mass / 6);
body.inertia = moment * (mass / 6);
body.inverseInertia = 1 / body.inertia;
body.mass = mass;
body.inverseMass = 1 / body.mass;
body.density = body.mass / body.area;
};
/**
* Sets the density of the body. Mass and inertia are automatically updated to reflect the change.
* @method setDensity
* @param {body} body
* @param {number} density
*/
Body.setDensity = function(body, density) {
Body.setMass(body, density * body.area);
body.density = density;
};
/**
* Sets the moment of inertia of the body. This is the second moment of area in two dimensions.
* Inverse inertia is automatically updated to reflect the change. Mass is not changed.
* @method setInertia
* @param {body} body
* @param {number} inertia
*/
Body.setInertia = function(body, inertia) {
body.inertia = inertia;
body.inverseInertia = 1 / body.inertia;
};
/**
* Sets the body's vertices and updates body properties accordingly, including inertia, area and mass (with respect to `body.density`).
* Vertices will be automatically transformed to be orientated around their centre of mass as the origin.
* They are then automatically translated to world space based on `body.position`.
*
* The `vertices` argument should be passed as an array of `Matter.Vector` points (or a `Matter.Vertices` array).
* Vertices must form a convex hull. Concave vertices must be decomposed into convex parts.
*
* @method setVertices
* @param {body} body
* @param {vector[]} vertices
*/
Body.setVertices = function(body, vertices) {
// change vertices
if (vertices[0].body === body) {
body.vertices = vertices;
} else {
body.vertices = Vertices.create(vertices, body);
}
// update properties
body.axes = Axes.fromVertices(body.vertices);
body.area = Vertices.area(body.vertices);
Body.setMass(body, body.density * body.area);
// orient vertices around the centre of mass at origin (0, 0)
var centre = Vertices.centre(body.vertices);
Vertices.translate(body.vertices, centre, -1);
// update inertia while vertices are at origin (0, 0)
Body.setInertia(body, Body._inertiaScale * Vertices.inertia(body.vertices, body.mass));
// update geometry
Vertices.translate(body.vertices, body.position);
Bounds.update(body.bounds, body.vertices, body.velocity);
};
/**
* Sets the parts of the `body`.
*
* See `body.parts` for details and requirements on how parts are used.
*
* See Bodies.fromVertices for a related utility.
*
* This function updates `body` mass, inertia and centroid based on the parts geometry.
* Sets each `part.parent` to be this `body`.
*
* The convex hull is computed and set on this `body` (unless `autoHull` is `false`).
* Automatically ensures that the first part in `body.parts` is the `body`.
* @method setParts
* @param {body} body
* @param {body[]} parts
* @param {bool} [autoHull=true]
*/
Body.setParts = function(body, parts, autoHull) {
var i;
// add all the parts, ensuring that the first part is always the parent body
parts = parts.slice(0);
body.parts.length = 0;
body.parts.push(body);
body.parent = body;
for (i = 0; i < parts.length; i++) {
var part = parts[i];
if (part !== body) {
part.parent = body;
body.parts.push(part);
}
}
if (body.parts.length === 1)
return;
autoHull = typeof autoHull !== 'undefined' ? autoHull : true;
// find the convex hull of all parts to set on the parent body
if (autoHull) {
var vertices = [];
for (i = 0; i < parts.length; i++) {
vertices = vertices.concat(parts[i].vertices);
}
Vertices.clockwiseSort(vertices);
var hull = Vertices.hull(vertices),
hullCentre = Vertices.centre(hull);
Body.setVertices(body, hull);
Vertices.translate(body.vertices, hullCentre);
}
// sum the properties of all compound parts of the parent body
var total = Body._totalProperties(body);
body.area = total.area;
body.parent = body;
body.position.x = total.centre.x;
body.position.y = total.centre.y;
body.positionPrev.x = total.centre.x;
body.positionPrev.y = total.centre.y;
Body.setMass(body, total.mass);
Body.setInertia(body, total.inertia);
Body.setPosition(body, total.centre);
};
/**
* Set the centre of mass of the body.
* The `centre` is a vector in world-space unless `relative` is set, in which case it is a translation.
* The centre of mass is the point the body rotates about and can be used to simulate non-uniform density.
* This is equal to moving `body.position` but not the `body.vertices`.
* Invalid if the `centre` falls outside the body's convex hull.
* @method setCentre
* @param {body} body
* @param {vector} centre
* @param {bool} relative
*/
Body.setCentre = function(body, centre, relative) {
if (!relative) {
body.positionPrev.x = centre.x - (body.position.x - body.positionPrev.x);
body.positionPrev.y = centre.y - (body.position.y - body.positionPrev.y);
body.position.x = centre.x;
body.position.y = centre.y;
} else {
body.positionPrev.x += centre.x;
body.positionPrev.y += centre.y;
body.position.x += centre.x;
body.position.y += centre.y;
}
};
/**
* Sets the position of the body. By default velocity is unchanged.
* If `updateVelocity` is `true` then velocity is inferred from the change in position.
* @method setPosition
* @param {body} body
* @param {vector} position
* @param {boolean} [updateVelocity=false]
*/
Body.setPosition = function(body, position, updateVelocity) {
var delta = Vector.sub(position, body.position);
if (updateVelocity) {
body.positionPrev.x = body.position.x;
body.positionPrev.y = body.position.y;
body.velocity.x = delta.x;
body.velocity.y = delta.y;
body.speed = Vector.magnitude(delta);
} else {
body.positionPrev.x += delta.x;
body.positionPrev.y += delta.y;
}
for (var i = 0; i < body.parts.length; i++) {
var part = body.parts[i];
part.position.x += delta.x;
part.position.y += delta.y;
Vertices.translate(part.vertices, delta);
Bounds.update(part.bounds, part.vertices, body.velocity);
}
};
/**
* Sets the angle of the body. By default angular velocity is unchanged.
* If `updateVelocity` is `true` then angular velocity is inferred from the change in angle.
* @method setAngle
* @param {body} body
* @param {number} angle
* @param {boolean} [updateVelocity=false]
*/
Body.setAngle = function(body, angle, updateVelocity) {
var delta = angle - body.angle;
if (updateVelocity) {
body.anglePrev = body.angle;
body.angularVelocity = delta;
body.angularSpeed = Math.abs(delta);
} else {
body.anglePrev += delta;
}
for (var i = 0; i < body.parts.length; i++) {
var part = body.parts[i];
part.angle += delta;
Vertices.rotate(part.vertices, delta, body.position);
Axes.rotate(part.axes, delta);
Bounds.update(part.bounds, part.vertices, body.velocity);
if (i > 0) {
Vector.rotateAbout(part.position, delta, body.position, part.position);
}
}
};
/**
* Sets the current linear velocity of the body.
* Affects body speed.
* @method setVelocity
* @param {body} body
* @param {vector} velocity
*/
Body.setVelocity = function(body, velocity) {
var timeScale = body.deltaTime / Body._baseDelta;
body.positionPrev.x = body.position.x - velocity.x * timeScale;
body.positionPrev.y = body.position.y - velocity.y * timeScale;
body.velocity.x = (body.position.x - body.positionPrev.x) / timeScale;
body.velocity.y = (body.position.y - body.positionPrev.y) / timeScale;
body.speed = Vector.magnitude(body.velocity);
};
/**
* Gets the current linear velocity of the body.
* @method getVelocity
* @param {body} body
* @return {vector} velocity
*/
Body.getVelocity = function(body) {
var timeScale = Body._baseDelta / body.deltaTime;
return {
x: (body.position.x - body.positionPrev.x) * timeScale,
y: (body.position.y - body.positionPrev.y) * timeScale
};
};
/**
* Gets the current linear speed of the body.
* Equivalent to the magnitude of its velocity.
* @method getSpeed
* @param {body} body
* @return {number} speed
*/
Body.getSpeed = function(body) {
return Vector.magnitude(Body.getVelocity(body));
};
/**
* Sets the current linear speed of the body.
* Direction is maintained. Affects body velocity.
* @method setSpeed
* @param {body} body
* @param {number} speed
*/
Body.setSpeed = function(body, speed) {
Body.setVelocity(body, Vector.mult(Vector.normalise(Body.getVelocity(body)), speed));
};
/**
* Sets the current rotational velocity of the body.
* Affects body angular speed.
* @method setAngularVelocity
* @param {body} body
* @param {number} velocity
*/
Body.setAngularVelocity = function(body, velocity) {
var timeScale = body.deltaTime / Body._baseDelta;
body.anglePrev = body.angle - velocity * timeScale;
body.angularVelocity = (body.angle - body.anglePrev) / timeScale;
body.angularSpeed = Math.abs(body.angularVelocity);
};
/**
* Gets the current rotational velocity of the body.
* @method getAngularVelocity
* @param {body} body
* @return {number} angular velocity
*/
Body.getAngularVelocity = function(body) {
return (body.angle - body.anglePrev) * Body._baseDelta / body.deltaTime;
};
/**
* Gets the current rotational speed of the body.
* Equivalent to the magnitude of its angular velocity.
* @method getAngularSpeed
* @param {body} body
* @return {number} angular speed
*/
Body.getAngularSpeed = function(body) {
return Math.abs(Body.getAngularVelocity(body));
};
/**
* Sets the current rotational speed of the body.
* Direction is maintained. Affects body angular velocity.
* @method setAngularSpeed
* @param {body} body
* @param {number} speed
*/
Body.setAngularSpeed = function(body, speed) {
Body.setAngularVelocity(body, Common.sign(Body.getAngularVelocity(body)) * speed);
};
/**
* Moves a body by a given vector relative to its current position. By default velocity is unchanged.
* If `updateVelocity` is `true` then velocity is inferred from the change in position.
* @method translate
* @param {body} body
* @param {vector} translation
* @param {boolean} [updateVelocity=false]
*/
Body.translate = function(body, translation, updateVelocity) {
Body.setPosition(body, Vector.add(body.position, translation), updateVelocity);
};
/**
* Rotates a body by a given angle relative to its current angle. By default angular velocity is unchanged.
* If `updateVelocity` is `true` then angular velocity is inferred from the change in angle.
* @method rotate
* @param {body} body
* @param {number} rotation
* @param {vector} [point]
* @param {boolean} [updateVelocity=false]
*/
Body.rotate = function(body, rotation, point, updateVelocity) {
if (!point) {
Body.setAngle(body, body.angle + rotation, updateVelocity);
} else {
var cos = Math.cos(rotation),
sin = Math.sin(rotation),
dx = body.position.x - point.x,
dy = body.position.y - point.y;
Body.setPosition(body, {
x: point.x + (dx * cos - dy * sin),
y: point.y + (dx * sin + dy * cos)
}, updateVelocity);
Body.setAngle(body, body.angle + rotation, updateVelocity);
}
};
/**
* Scales the body, including updating physical properties (mass, area, axes, inertia), from a world-space point (default is body centre).
* @method scale
* @param {body} body
* @param {number} scaleX
* @param {number} scaleY
* @param {vector} [point]
*/
Body.scale = function(body, scaleX, scaleY, point) {
var totalArea = 0,
totalInertia = 0;
point = point || body.position;
for (var i = 0; i < body.parts.length; i++) {
var part = body.parts[i];
// scale vertices
Vertices.scale(part.vertices, scaleX, scaleY, point);
// update properties
part.axes = Axes.fromVertices(part.vertices);
part.area = Vertices.area(part.vertices);
Body.setMass(part, body.density * part.area);
// update inertia (requires vertices to be at origin)
Vertices.translate(part.vertices, { x: -part.position.x, y: -part.position.y });
Body.setInertia(part, Body._inertiaScale * Vertices.inertia(part.vertices, part.mass));
Vertices.translate(part.vertices, { x: part.position.x, y: part.position.y });
if (i > 0) {
totalArea += part.area;
totalInertia += part.inertia;
}
// scale position
part.position.x = point.x + (part.position.x - point.x) * scaleX;
part.position.y = point.y + (part.position.y - point.y) * scaleY;
// update bounds
Bounds.update(part.bounds, part.vertices, body.velocity);
}
// handle parent body
if (body.parts.length > 1) {
body.area = totalArea;
if (!body.isStatic) {
Body.setMass(body, body.density * totalArea);
Body.setInertia(body, totalInertia);
}
}
// handle circles
if (body.circleRadius) {
if (scaleX === scaleY) {
body.circleRadius *= scaleX;
} else {
// body is no longer a circle
body.circleRadius = null;
}
}
};
/**
* Performs an update by integrating the equations of motion on the `body`.
* This is applied every update by `Matter.Engine` automatically.
* @method update
* @param {body} body
* @param {number} [deltaTime=16.666]
*/
Body.update = function(body, deltaTime) {
deltaTime = (typeof deltaTime !== 'undefined' ? deltaTime : (1000 / 60)) * body.timeScale;
var deltaTimeSquared = deltaTime * deltaTime,
correction = Body._timeCorrection ? deltaTime / (body.deltaTime || deltaTime) : 1;
// from the previous step
var frictionAir = 1 - body.frictionAir * (deltaTime / Common._baseDelta),
velocityPrevX = (body.position.x - body.positionPrev.x) * correction,
velocityPrevY = (body.position.y - body.positionPrev.y) * correction;
// update velocity with Verlet integration
body.velocity.x = (velocityPrevX * frictionAir) + (body.force.x / body.mass) * deltaTimeSquared;
body.velocity.y = (velocityPrevY * frictionAir) + (body.force.y / body.mass) * deltaTimeSquared;
body.positionPrev.x = body.position.x;
body.positionPrev.y = body.position.y;
body.position.x += body.velocity.x;
body.position.y += body.velocity.y;
body.deltaTime = deltaTime;
// update angular velocity with Verlet integration
body.angularVelocity = ((body.angle - body.anglePrev) * frictionAir * correction) + (body.torque / body.inertia) * deltaTimeSquared;
body.anglePrev = body.angle;
body.angle += body.angularVelocity;
// transform the body geometry
for (var i = 0; i < body.parts.length; i++) {
var part = body.parts[i];
Vertices.translate(part.vertices, body.velocity);
if (i > 0) {
part.position.x += body.velocity.x;
part.position.y += body.velocity.y;
}
if (body.angularVelocity !== 0) {
Vertices.rotate(part.vertices, body.angularVelocity, body.position);
Axes.rotate(part.axes, body.angularVelocity);
if (i > 0) {
Vector.rotateAbout(part.position, body.angularVelocity, body.position, part.position);
}
}
Bounds.update(part.bounds, part.vertices, body.velocity);
}
};
/**
* Updates properties `body.velocity`, `body.speed`, `body.angularVelocity` and `body.angularSpeed` which are normalised in relation to `Body._baseDelta`.
* @method updateVelocities
* @param {body} body
*/
Body.updateVelocities = function(body) {
var timeScale = Body._baseDelta / body.deltaTime,
bodyVelocity = body.velocity;
bodyVelocity.x = (body.position.x - body.positionPrev.x) * timeScale;
bodyVelocity.y = (body.position.y - body.positionPrev.y) * timeScale;
body.speed = Math.sqrt((bodyVelocity.x * bodyVelocity.x) + (bodyVelocity.y * bodyVelocity.y));
body.angularVelocity = (body.angle - body.anglePrev) * timeScale;
body.angularSpeed = Math.abs(body.angularVelocity);
};
/**
* Applies the `force` to the `body` from the force origin `position` in world-space, over a single timestep, including applying any resulting angular torque.
*
* Forces are useful for effects like gravity, wind or rocket thrust, but can be difficult in practice when precise control is needed. In these cases see `Body.setVelocity` and `Body.setPosition` as an alternative.
*
* The force from this function is only applied once for the duration of a single timestep, in other words the duration depends directly on the current engine update `delta` and the rate of calls to this function.
*
* Therefore to account for time, you should apply the force constantly over as many engine updates as equivalent to the intended duration.
*
* If all or part of the force duration is some fraction of a timestep, first multiply the force by `duration / timestep`.
*
* The force origin `position` in world-space must also be specified. Passing `body.position` will result in zero angular effect as the force origin would be at the centre of mass.
*
* The `body` will take time to accelerate under a force, the resulting effect depends on duration of the force, the body mass and other forces on the body including friction combined.
* @method applyForce
* @param {body} body
* @param {vecto
gitextract_6pk11ypt/ ├── .eslintignore ├── .eslintrc ├── .github/ │ └── workflows/ │ └── ci.yml ├── .gitignore ├── CHANGELOG.md ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── RELEASE.md ├── build/ │ └── matter.js ├── demo/ │ ├── index.html │ └── src/ │ ├── Compare.js │ ├── Demo.js │ ├── Multi.js │ ├── index.ejs │ └── index.js ├── examples/ │ ├── airFriction.js │ ├── avalanche.js │ ├── ballPool.js │ ├── bridge.js │ ├── car.js │ ├── catapult.js │ ├── chains.js │ ├── circleStack.js │ ├── cloth.js │ ├── collisionFiltering.js │ ├── compositeManipulation.js │ ├── compound.js │ ├── compoundStack.js │ ├── concave.js │ ├── constraints.js │ ├── doublePendulum.js │ ├── events.js │ ├── friction.js │ ├── gravity.js │ ├── gyro.js │ ├── index.js │ ├── manipulation.js │ ├── mixed.js │ ├── newtonsCradle.js │ ├── pyramid.js │ ├── ragdoll.js │ ├── raycasting.js │ ├── remove.js │ ├── renderResize.js │ ├── restitution.js │ ├── rounded.js │ ├── sensors.js │ ├── sleeping.js │ ├── slingshot.js │ ├── softBody.js │ ├── sprites.js │ ├── stack.js │ ├── staticFriction.js │ ├── stats.js │ ├── stress.js │ ├── stress2.js │ ├── stress3.js │ ├── stress4.js │ ├── substep.js │ ├── svg.js │ ├── terrain.js │ ├── timescale.js │ ├── views.js │ └── wreckingBall.js ├── package.json ├── src/ │ ├── body/ │ │ ├── Body.js │ │ ├── Composite.js │ │ └── World.js │ ├── collision/ │ │ ├── Collision.js │ │ ├── Contact.js │ │ ├── Detector.js │ │ ├── Grid.js │ │ ├── Pair.js │ │ ├── Pairs.js │ │ ├── Query.js │ │ ├── Resolver.js │ │ └── SAT.js │ ├── constraint/ │ │ ├── Constraint.js │ │ └── MouseConstraint.js │ ├── core/ │ │ ├── Common.js │ │ ├── Engine.js │ │ ├── Events.js │ │ ├── Matter.js │ │ ├── Mouse.js │ │ ├── Plugin.js │ │ ├── Runner.js │ │ └── Sleeping.js │ ├── factory/ │ │ ├── Bodies.js │ │ └── Composites.js │ ├── geometry/ │ │ ├── Axes.js │ │ ├── Bounds.js │ │ ├── Svg.js │ │ ├── Vector.js │ │ └── Vertices.js │ ├── module/ │ │ ├── license.js │ │ └── main.js │ └── render/ │ └── Render.js ├── test/ │ ├── Browser.spec.js │ ├── ExampleWorker.js │ ├── Examples.spec.js │ └── TestTools.js ├── webpack.config.js ├── webpack.demo.config.js └── yuidoc.json
SYMBOL INDEX (4 symbols across 3 files)
FILE: build/matter.js
function __webpack_require__ (line 43) | function __webpack_require__(moduleId) {
FILE: test/ExampleWorker.js
method get (line 193) | get() { return () => {}; }
FILE: test/TestTools.js
method toMatchExtrinsics (line 343) | toMatchExtrinsics(received, value) {
method toMatchIntrinsics (line 355) | toMatchIntrinsics(currentCaptures, referenceCaptures) {
Condensed preview — 105 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (1,133K chars).
[
{
"path": ".eslintignore",
"chars": 19,
"preview": "demo/js/Examples.js"
},
{
"path": ".eslintrc",
"chars": 1704,
"preview": "{\n \"rules\": {\n \"no-fallthrough\": 2,\n \"no-console\": 0,\n \"no-unused-vars\": 0,\n \"no-redeclar"
},
{
"path": ".github/workflows/ci.yml",
"chars": 522,
"preview": "name: CI\n\non:\n push:\n branches: [ master ]\n pull_request:\n branches: [ master ]\n\njobs:\n build:\n\n runs-on: ub"
},
{
"path": ".gitignore",
"chars": 308,
"preview": ".idea\n*.map\nnode_modules\nnpm-debug.log\ndocs\nmatter-doc-theme\nbuild/matter-dev.js\nbuild/matter-dev.min.js\nbuild/matter.de"
},
{
"path": "CHANGELOG.md",
"chars": 86940,
"preview": "## 0.20.0 (2024-06-23)\n\n* added event passive options to Matter.Mouse, closes #930, closes #976 ([e888f3c](https://githu"
},
{
"path": "CONTRIBUTING.md",
"chars": 1836,
"preview": "# Contributing\n\n## License Agreement\n\nBy providing any kind of contribution to this project, **you must agree and be leg"
},
{
"path": "LICENSE",
"chars": 1092,
"preview": "The MIT License (MIT)\n\nCopyright (c) Liam Brummitt and contributors.\n\nPermission is hereby granted, free of charge, to a"
},
{
"path": "README.md",
"chars": 9001,
"preview": "<img alt=\"Matter.js\" src=\"https://brm.io/matter-js/img/matter-js.svg\" width=\"300\">\n\n> *Matter.js* is a JavaScript 2D rig"
},
{
"path": "RELEASE.md",
"chars": 17304,
"preview": "## ▲.● matter.js `0.20.0`\n\nRelease notes for `0.20.0`. See the release [readme](https://github.com/liabru/matter-js/blob"
},
{
"path": "build/matter.js",
"chars": 374355,
"preview": "/*!\n * matter-js 0.20.0 by @liabru\n * http://brm.io/matter-js/\n * License MIT\n * \n * The MIT License (MIT)\n * \n * Copyri"
},
{
"path": "demo/index.html",
"chars": 2275,
"preview": "<!DOCTYPE html>\n<html lang=\"en\">\n <head>\n <meta charset=\"utf-8\">\n <meta http-equiv=\"X-UA-Compatible\" content=\"IE="
},
{
"path": "demo/src/Compare.js",
"chars": 5572,
"preview": "/**\n* A Matter.js version comparison testbed based on MatterTools.\n*\n* Tool to interactively compare engine results of \n"
},
{
"path": "demo/src/Demo.js",
"chars": 3551,
"preview": "/**\r\n* A Matter.js demo and development testbed based on MatterTools.\r\n*\r\n* For a simpler, minimal Matter.js example see"
},
{
"path": "demo/src/Multi.js",
"chars": 3290,
"preview": "/**\n* A Matter.js multi example testbed based on MatterTools.\n*\n* Tool to interactively test multiple examples at once.\n"
},
{
"path": "demo/src/index.ejs",
"chars": 2000,
"preview": "<!DOCTYPE html>\n<html lang=\"en\">\n <head>\n <meta charset=\"utf-8\">\n <meta http-equiv=\"X-UA-Compatible\" content=\"IE="
},
{
"path": "demo/src/index.js",
"chars": 1175,
"preview": "/**\n* Initialise and start the browser demo / compare tool.\n*\n* For a simpler, minimal Matter.js example see:\n* https://"
},
{
"path": "examples/airFriction.js",
"chars": 2316,
"preview": "var Example = Example || {};\n\nExample.airFriction = function() {\n var Engine = Matter.Engine,\n Render = Matter"
},
{
"path": "examples/avalanche.js",
"chars": 3142,
"preview": "var Example = Example || {};\n\nExample.avalanche = function() {\n try {\n if (typeof MatterWrap !== 'undefined') "
},
{
"path": "examples/ballPool.js",
"chars": 3094,
"preview": "var Example = Example || {};\n\nExample.ballPool = function() {\n try {\n if (typeof MatterWrap !== 'undefined') {"
},
{
"path": "examples/bridge.js",
"chars": 3364,
"preview": "var Example = Example || {};\n\nExample.bridge = function() {\n var Engine = Matter.Engine,\n Render = Matter.Rend"
},
{
"path": "examples/car.js",
"chars": 4735,
"preview": "var Example = Example || {};\n\nExample.car = function() {\n var Engine = Matter.Engine,\n Render = Matter.Render,"
},
{
"path": "examples/catapult.js",
"chars": 2868,
"preview": "var Example = Example || {};\n\nExample.catapult = function() {\n var Engine = Matter.Engine,\n Render = Matter.Re"
},
{
"path": "examples/chains.js",
"chars": 3705,
"preview": "var Example = Example || {};\n\nExample.chains = function() {\n var Engine = Matter.Engine,\n Render = Matter.Rend"
},
{
"path": "examples/circleStack.js",
"chars": 2300,
"preview": "var Example = Example || {};\n\nExample.circleStack = function() {\n var Engine = Matter.Engine,\n Render = Matter"
},
{
"path": "examples/cloth.js",
"chars": 3538,
"preview": "var Example = Example || {};\n\nExample.cloth = function() {\n var Engine = Matter.Engine,\n Render = Matter.Rende"
},
{
"path": "examples/collisionFiltering.js",
"chars": 4320,
"preview": "var Example = Example || {};\n\nExample.collisionFiltering = function() {\n var Engine = Matter.Engine,\n Render ="
},
{
"path": "examples/compositeManipulation.js",
"chars": 2998,
"preview": "var Example = Example || {};\n\nExample.compositeManipulation = function() {\n var Engine = Matter.Engine,\n Rende"
},
{
"path": "examples/compound.js",
"chars": 2784,
"preview": "var Example = Example || {};\n\nExample.compound = function() {\n var Engine = Matter.Engine,\n Render = Matter.Re"
},
{
"path": "examples/compoundStack.js",
"chars": 2527,
"preview": "var Example = Example || {};\n\nExample.compoundStack = function() {\n var Engine = Matter.Engine,\n Render = Matt"
},
{
"path": "examples/concave.js",
"chars": 3087,
"preview": "var Example = Example || {};\n\nExample.concave = function() {\n var Engine = Matter.Engine,\n Render = Matter.Ren"
},
{
"path": "examples/constraints.js",
"chars": 4946,
"preview": "var Example = Example || {};\n\nExample.constraints = function() {\n var Engine = Matter.Engine,\n Render = Matter"
},
{
"path": "examples/doublePendulum.js",
"chars": 4020,
"preview": "var Example = Example || {};\n\nExample.doublePendulum = function() {\n var Engine = Matter.Engine,\n Events = Mat"
},
{
"path": "examples/events.js",
"chars": 5962,
"preview": "var Example = Example || {};\n\nExample.events = function() {\n var Engine = Matter.Engine,\n Render = Matter.Rend"
},
{
"path": "examples/friction.js",
"chars": 2734,
"preview": "var Example = Example || {};\n\nExample.friction = function() {\n var Engine = Matter.Engine,\n Render = Matter.Re"
},
{
"path": "examples/gravity.js",
"chars": 2775,
"preview": "var Example = Example || {};\n\nExample.gravity = function() {\n var Engine = Matter.Engine,\n Render = Matter.Ren"
},
{
"path": "examples/gyro.js",
"chars": 4179,
"preview": "var Example = Example || {};\n\nExample.gyro = function() {\n var Engine = Matter.Engine,\n Render = Matter.Render"
},
{
"path": "examples/index.js",
"chars": 1986,
"preview": "module.exports = {\n airFriction: require('./airFriction.js'),\n avalanche: require('./avalanche.js'),\n ballPool:"
},
{
"path": "examples/manipulation.js",
"chars": 5110,
"preview": "var Example = Example || {};\n\nExample.manipulation = function() {\n var Engine = Matter.Engine,\n Render = Matte"
},
{
"path": "examples/mixed.js",
"chars": 3001,
"preview": "var Example = Example || {};\n\nExample.mixed = function() {\n var Engine = Matter.Engine,\n Render = Matter.Rende"
},
{
"path": "examples/newtonsCradle.js",
"chars": 3278,
"preview": "var Example = Example || {};\n\nExample.newtonsCradle = function() {\n var Engine = Matter.Engine,\n Render = Matt"
},
{
"path": "examples/pyramid.js",
"chars": 2279,
"preview": "var Example = Example || {};\n\nExample.pyramid = function() {\n var Engine = Matter.Engine,\n Render = Matter.Ren"
},
{
"path": "examples/ragdoll.js",
"chars": 13408,
"preview": "var Example = Example || {};\n\nExample.ragdoll = function() {\n var Engine = Matter.Engine,\n Events = Matter.Eve"
},
{
"path": "examples/raycasting.js",
"chars": 4412,
"preview": "var Example = Example || {};\n\nExample.raycasting = function() {\n var Engine = Matter.Engine,\n Render = Matter."
},
{
"path": "examples/remove.js",
"chars": 4074,
"preview": "var Example = Example || {};\n\nExample.remove = function() {\n var Engine = Matter.Engine,\n Render = Matter.Rend"
},
{
"path": "examples/renderResize.js",
"chars": 3679,
"preview": "var Example = Example || {};\n\nExample.renderResize = function() {\n var Engine = Matter.Engine,\n Render = Matte"
},
{
"path": "examples/restitution.js",
"chars": 2670,
"preview": "var Example = Example || {};\n\nExample.restitution = function() {\n var Engine = Matter.Engine,\n Render = Matter"
},
{
"path": "examples/rounded.js",
"chars": 2959,
"preview": "var Example = Example || {};\n\nExample.rounded = function() {\n var Engine = Matter.Engine,\n Render = Matter.Ren"
},
{
"path": "examples/sensors.js",
"chars": 3413,
"preview": "var Example = Example || {};\n\nExample.sensors = function() {\n var Engine = Matter.Engine,\n Render = Matter.Ren"
},
{
"path": "examples/sleeping.js",
"chars": 3084,
"preview": "var Example = Example || {};\n\nExample.sleeping = function() {\n var Engine = Matter.Engine,\n Render = Matter.Re"
},
{
"path": "examples/slingshot.js",
"chars": 3338,
"preview": "var Example = Example || {};\n\nExample.slingshot = function() {\n var Engine = Matter.Engine,\n Render = Matter.R"
},
{
"path": "examples/softBody.js",
"chars": 3696,
"preview": "var Example = Example || {};\n\nExample.softBody = function() {\n var Engine = Matter.Engine,\n Render = Matter.Re"
},
{
"path": "examples/sprites.js",
"chars": 3180,
"preview": "var Example = Example || {};\n\nExample.sprites = function() {\n var Engine = Matter.Engine,\n Render = Matter.Ren"
},
{
"path": "examples/stack.js",
"chars": 2270,
"preview": "var Example = Example || {};\n\nExample.stack = function() {\n var Engine = Matter.Engine,\n Render = Matter.Rende"
},
{
"path": "examples/staticFriction.js",
"chars": 3096,
"preview": "var Example = Example || {};\n\nExample.staticFriction = function() {\n var Engine = Matter.Engine,\n Render = Mat"
},
{
"path": "examples/stats.js",
"chars": 2355,
"preview": "var Example = Example || {};\n\nExample.stats = function() {\n var Engine = Matter.Engine,\n Render = Matter.Rende"
},
{
"path": "examples/stress.js",
"chars": 2280,
"preview": "var Example = Example || {};\n\nExample.stress = function() {\n var Engine = Matter.Engine,\n Render = Matter.Rend"
},
{
"path": "examples/stress2.js",
"chars": 2287,
"preview": "var Example = Example || {};\n\nExample.stress2 = function() {\n var Engine = Matter.Engine,\n Render = Matter.Ren"
},
{
"path": "examples/stress3.js",
"chars": 2905,
"preview": "var Example = Example || {};\n\nExample.stress3 = function() {\n var Engine = Matter.Engine,\n Render = Matter.Ren"
},
{
"path": "examples/stress4.js",
"chars": 3436,
"preview": "var Example = Example || {};\n\nExample.stress4 = function() {\n var Engine = Matter.Engine,\n Events = Matter.Eve"
},
{
"path": "examples/substep.js",
"chars": 3490,
"preview": "var Example = Example || {};\n\nExample.substep = function() {\n var Engine = Matter.Engine,\n Render = Matter.Ren"
},
{
"path": "examples/svg.js",
"chars": 4192,
"preview": "var Example = Example || {};\n\nExample.svg = function() {\n var Engine = Matter.Engine,\n Render = Matter.Render,"
},
{
"path": "examples/terrain.js",
"chars": 3569,
"preview": "var Example = Example || {};\n\nExample.terrain = function() {\n var Engine = Matter.Engine,\n Render = Matter.Ren"
},
{
"path": "examples/timescale.js",
"chars": 4593,
"preview": "var Example = Example || {};\n\nExample.timescale = function() {\n var Engine = Matter.Engine,\n Render = Matter.R"
},
{
"path": "examples/views.js",
"chars": 6034,
"preview": "var Example = Example || {};\n\nExample.views = function() {\n var Engine = Matter.Engine,\n Render = Matter.Rende"
},
{
"path": "examples/wreckingBall.js",
"chars": 2621,
"preview": "var Example = Example || {};\n\nExample.wreckingBall = function() {\n var Engine = Matter.Engine,\n Render = Matte"
},
{
"path": "package.json",
"chars": 3315,
"preview": "{\n \"name\": \"matter-js\",\n \"version\": \"0.20.0\",\n \"license\": \"MIT\",\n \"homepage\": \"http://brm.io/matter-js/\",\n \"author\""
},
{
"path": "src/body/Body.js",
"chars": 51154,
"preview": "/**\n* The `Matter.Body` module contains methods for creating and manipulating rigid bodies.\n* For creating bodies with c"
},
{
"path": "src/body/Composite.js",
"chars": 23836,
"preview": "/**\n* A composite is a collection of `Matter.Body`, `Matter.Constraint` and other `Matter.Composite` objects.\n*\n* They a"
},
{
"path": "src/body/World.js",
"chars": 1058,
"preview": "/**\n* This module has now been replaced by `Matter.Composite`.\n*\n* All usage should be migrated to the equivalent functi"
},
{
"path": "src/collision/Collision.js",
"chars": 11967,
"preview": "/**\n* The `Matter.Collision` module contains methods for detecting collisions between a given pair of bodies.\n*\n* For ef"
},
{
"path": "src/collision/Contact.js",
"chars": 494,
"preview": "/**\n* The `Matter.Contact` module contains methods for creating and manipulating collision contacts.\n*\n* @class Contact\n"
},
{
"path": "src/collision/Detector.js",
"chars": 6414,
"preview": "/**\n* The `Matter.Detector` module contains methods for efficiently detecting collisions between a list of bodies using "
},
{
"path": "src/collision/Grid.js",
"chars": 10250,
"preview": "/**\n* This module has now been replaced by `Matter.Detector`.\n*\n* All usage should be migrated to `Matter.Detector` or a"
},
{
"path": "src/collision/Pair.js",
"chars": 3617,
"preview": "/**\n* The `Matter.Pair` module contains methods for creating and manipulating collision pairs.\n*\n* @class Pair\n*/\n\nvar P"
},
{
"path": "src/collision/Pairs.js",
"chars": 4266,
"preview": "/**\n* The `Matter.Pairs` module contains methods for creating and manipulating collision pair sets.\n*\n* @class Pairs\n*/\n"
},
{
"path": "src/collision/Query.js",
"chars": 4325,
"preview": "/**\n* The `Matter.Query` module contains methods for performing collision queries.\n*\n* See the included usage [examples]"
},
{
"path": "src/collision/Resolver.js",
"chars": 15326,
"preview": "/**\n* The `Matter.Resolver` module contains methods for resolving collision pairs.\n*\n* @class Resolver\n*/\n\nvar Resolver "
},
{
"path": "src/collision/SAT.js",
"chars": 995,
"preview": "/**\n* This module has now been replaced by `Matter.Collision`.\n*\n* All usage should be migrated to `Matter.Collision`.\n*"
},
{
"path": "src/constraint/Constraint.js",
"chars": 17785,
"preview": "/**\n* The `Matter.Constraint` module contains methods for creating and manipulating constraints.\n* Constraints are used "
},
{
"path": "src/constraint/MouseConstraint.js",
"chars": 8460,
"preview": "/**\n* The `Matter.MouseConstraint` module contains methods for creating mouse constraints.\n* Mouse constraints are used "
},
{
"path": "src/core/Common.js",
"chars": 19315,
"preview": "/**\n* The `Matter.Common` module contains utility functions that are common to all modules.\n*\n* @class Common\n*/\n\nvar Co"
},
{
"path": "src/core/Engine.js",
"chars": 18621,
"preview": "/**\n* The `Matter.Engine` module contains methods for creating and manipulating engines.\n* An engine is a controller tha"
},
{
"path": "src/core/Events.js",
"chars": 3118,
"preview": "/**\n* The `Matter.Events` module contains methods to fire and listen to events on other objects.\n*\n* See the included us"
},
{
"path": "src/core/Matter.js",
"chars": 2863,
"preview": "/**\r\n* The `Matter` module is the top level namespace. It also includes a function for installing plugins on top of the "
},
{
"path": "src/core/Mouse.js",
"chars": 7050,
"preview": "/**\n* The `Matter.Mouse` module contains methods for creating and manipulating mouse inputs.\n*\n* @class Mouse\n*/\n\nvar Mo"
},
{
"path": "src/core/Plugin.js",
"chars": 13272,
"preview": "/**\n* The `Matter.Plugin` module contains functions for registering and installing plugins on modules.\n*\n* @class Plugin"
},
{
"path": "src/core/Runner.js",
"chars": 16710,
"preview": "/**\n* The `Matter.Runner` module is an optional utility that provides a game loop for running a `Matter.Engine` inside a"
},
{
"path": "src/core/Sleeping.js",
"chars": 4162,
"preview": "/**\n* The `Matter.Sleeping` module contains methods to manage the sleeping state of bodies.\n*\n* @class Sleeping\n*/\n\nvar "
},
{
"path": "src/factory/Bodies.js",
"chars": 14188,
"preview": "/**\n* The `Matter.Bodies` module contains factory methods for creating rigid body models \n* with commonly used body conf"
},
{
"path": "src/factory/Composites.js",
"chars": 12843,
"preview": "/**\n* The `Matter.Composites` module contains factory methods for creating composite bodies\n* with commonly used configu"
},
{
"path": "src/geometry/Axes.js",
"chars": 1673,
"preview": "/**\n* The `Matter.Axes` module contains methods for creating and manipulating sets of axes.\n*\n* @class Axes\n*/\n\nvar Axes"
},
{
"path": "src/geometry/Bounds.js",
"chars": 3505,
"preview": "/**\n* The `Matter.Bounds` module contains methods for creating and manipulating axis-aligned bounding boxes (AABB).\n*\n* "
},
{
"path": "src/geometry/Svg.js",
"chars": 7393,
"preview": "/**\n* The `Matter.Svg` module contains methods for converting SVG images into an array of vector points.\n*\n* To use this"
},
{
"path": "src/geometry/Vector.js",
"chars": 7179,
"preview": "/**\n* The `Matter.Vector` module contains methods for creating and manipulating vectors.\n* Vectors are the basis of all "
},
{
"path": "src/geometry/Vertices.js",
"chars": 14056,
"preview": "/**\n* The `Matter.Vertices` module contains methods for creating and manipulating sets of vertices.\n* A set of vertices "
},
{
"path": "src/module/license.js",
"chars": 1163,
"preview": "/**\n * The MIT License (MIT)\n * \n * Copyright (c) Liam Brummitt and contributors.\n * \n * Permission is hereby granted, f"
},
{
"path": "src/module/main.js",
"chars": 1627,
"preview": "var Matter = module.exports = require('../core/Matter');\r\n\r\nMatter.Axes = require('../geometry/Axes');\r\nMatter.Bodies = "
},
{
"path": "src/render/Render.js",
"chars": 59780,
"preview": "/**\n* The `Matter.Render` module is a lightweight, optional utility which provides a simple canvas based renderer for vi"
},
{
"path": "test/Browser.spec.js",
"chars": 3135,
"preview": "/* eslint-env es6 */\n\"use strict\";\n\njest.setTimeout(120 * 1000);\n\nconst puppeteer = require('puppeteer-core');\nconst Exa"
},
{
"path": "test/ExampleWorker.js",
"chars": 9784,
"preview": "/* eslint-env es6 */\n/* eslint no-global-assign: 0 */\n\"use strict\";\n\nconst mock = require('mock-require');\nconst { requi"
},
{
"path": "test/Examples.spec.js",
"chars": 3792,
"preview": "/* eslint-env es6 */\n\"use strict\";\n\njest.setTimeout(2 * 60 * 1000);\n\nconst fs = require('fs');\n\nconst {\n requireUncac"
},
{
"path": "test/TestTools.js",
"chars": 12738,
"preview": "/* eslint-env es6 */\n\"use strict\";\n\nconst fs = require('fs');\nconst compactStringify = require('json-stringify-pretty-co"
},
{
"path": "webpack.config.js",
"chars": 2029,
"preview": "/* eslint-env es6 */\n\"use strict\";\n\nconst webpack = require('webpack');\nconst path = require('path');\nconst pkg = requir"
},
{
"path": "webpack.demo.config.js",
"chars": 3658,
"preview": "/* eslint-env es6 */\n\"use strict\";\n\nconst webpack = require('webpack');\nconst path = require('path');\nconst pkg = requir"
},
{
"path": "yuidoc.json",
"chars": 279,
"preview": "{\n \"name\": \"Matter.js Physics Engine API Docs\",\n \"description\": \"a 2D rigid body physics engine for the web\",\n \"url\":"
}
]
About this extraction
This page contains the full source code of the liabru/matter-js GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 105 files (1.0 MB), approximately 262.8k tokens, and a symbol index with 4 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.