phaser/docs/Phaser.Physics.P2.html
2014-07-10 20:39:17 +01:00

13884 lines
No EOL
200 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Phaser Class: P2</title>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/sunlight.default.css">
<link type="text/css" rel="stylesheet" href="styles/site.cerulean.css">
</head>
<body>
<div class="container-fluid">
<div class="navbar navbar-fixed-top navbar-inverse">
<div class="navbar-inner">
<a class="brand" href="index.html">Phaser</a>
<ul class="nav">
<li class="dropdown">
<a href="namespaces.list.html" class="dropdown-toggle" data-toggle="dropdown">Namespaces<b
class="caret"></b></a>
<ul class="dropdown-menu ">
<li class="class-depth-0">
<a href="Phaser.html">Phaser</a>
</li>
</ul>
</li>
<li class="dropdown">
<a href="classes.list.html" class="dropdown-toggle" data-toggle="dropdown">Classes<b
class="caret"></b></a>
<ul class="dropdown-menu ">
<li class="class-depth-1">
<a href="Phaser.Animation.html">Animation</a>
</li>
<li class="class-depth-1">
<a href="Phaser.AnimationManager.html">AnimationManager</a>
</li>
<li class="class-depth-1">
<a href="Phaser.AnimationParser.html">AnimationParser</a>
</li>
<li class="class-depth-1">
<a href="Phaser.ArrayList.html">ArrayList</a>
</li>
<li class="class-depth-1">
<a href="Phaser.BitmapData.html">BitmapData</a>
</li>
<li class="class-depth-1">
<a href="Phaser.BitmapText.html">BitmapText</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Button.html">Button</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Cache.html">Cache</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Camera.html">Camera</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Canvas.html">Canvas</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Circle.html">Circle</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Color.html">Color</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Device.html">Device</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Easing.html">Easing</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Easing.Back.html">Back</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Easing.Bounce.html">Bounce</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Easing.Circular.html">Circular</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Easing.Cubic.html">Cubic</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Easing.Elastic.html">Elastic</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Easing.Exponential.html">Exponential</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Easing.Linear.html">Linear</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Easing.Quadratic.html">Quadratic</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Easing.Quartic.html">Quartic</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Easing.Quintic.html">Quintic</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Easing.Sinusoidal.html">Sinusoidal</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Ellipse.html">Ellipse</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Events.html">Events</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Filter.html">Filter</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Frame.html">Frame</a>
</li>
<li class="class-depth-1">
<a href="Phaser.FrameData.html">FrameData</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Game.html">Game</a>
</li>
<li class="class-depth-1">
<a href="Phaser.GameObjectCreator.html">GameObjectCreator</a>
</li>
<li class="class-depth-1">
<a href="Phaser.GameObjectFactory.html">GameObjectFactory</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Gamepad.html">Gamepad</a>
</li>
<li class="class-depth-1">
<a href="Phaser.GamepadButton.html">GamepadButton</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Graphics.html">Graphics</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Group.html">Group</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Image.html">Image</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Input.html">Input</a>
</li>
<li class="class-depth-1">
<a href="Phaser.InputHandler.html">InputHandler</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Key.html">Key</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Keyboard.html">Keyboard</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Line.html">Line</a>
</li>
<li class="class-depth-1">
<a href="Phaser.LinkedList.html">LinkedList</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Loader.html">Loader</a>
</li>
<li class="class-depth-1">
<a href="Phaser.LoaderParser.html">LoaderParser</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Math.html">Math</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Mouse.html">Mouse</a>
</li>
<li class="class-depth-1">
<a href="Phaser.MSPointer.html">MSPointer</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Net.html">Net</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Particle.html">Particle</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Particles.html">Particles</a>
</li>
<li class="class-depth-3">
<a href="Phaser.Particles.Arcade.Emitter.html">Emitter</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Physics.html">Physics</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Physics.Arcade.html">Arcade</a>
</li>
<li class="class-depth-3">
<a href="Phaser.Physics.Arcade.Body.html">Body</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Physics.Ninja.html">Ninja</a>
</li>
<li class="class-depth-3">
<a href="Phaser.Physics.Ninja.AABB.html">AABB</a>
</li>
<li class="class-depth-3">
<a href="Phaser.Physics.Ninja.Body.html">Body</a>
</li>
<li class="class-depth-3">
<a href="Phaser.Physics.Ninja.Circle.html">Circle</a>
</li>
<li class="class-depth-3">
<a href="Phaser.Physics.Ninja.Tile.html">Tile</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Physics.P2.html">P2</a>
</li>
<li class="class-depth-3">
<a href="Phaser.Physics.P2.Body.html">Body</a>
</li>
<li class="class-depth-3">
<a href="Phaser.Physics.P2.BodyDebug.html">BodyDebug</a>
</li>
<li class="class-depth-3">
<a href="Phaser.Physics.P2.CollisionGroup.html">CollisionGroup</a>
</li>
<li class="class-depth-3">
<a href="Phaser.Physics.P2.ContactMaterial.html">ContactMaterial</a>
</li>
<li class="class-depth-3">
<a href="Phaser.Physics.P2.DistanceConstraint.html">DistanceConstraint</a>
</li>
<li class="class-depth-3">
<a href="Phaser.Physics.P2.FixtureList.html">FixtureList</a>
</li>
<li class="class-depth-3">
<a href="Phaser.Physics.P2.GearConstraint.html">GearConstraint</a>
</li>
<li class="class-depth-3">
<a href="Phaser.Physics.P2.InversePointProxy.html">InversePointProxy</a>
</li>
<li class="class-depth-3">
<a href="Phaser.Physics.P2.LockConstraint.html">LockConstraint</a>
</li>
<li class="class-depth-3">
<a href="Phaser.Physics.P2.Material.html">Material</a>
</li>
<li class="class-depth-3">
<a href="Phaser.Physics.P2.PointProxy.html">PointProxy</a>
</li>
<li class="class-depth-3">
<a href="Phaser.Physics.P2.PrismaticConstraint.html">PrismaticConstraint</a>
</li>
<li class="class-depth-3">
<a href="Phaser.Physics.P2.RevoluteConstraint.html">RevoluteConstraint</a>
</li>
<li class="class-depth-3">
<a href="Phaser.Physics.P2.Spring.html">Spring</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Plugin.html">Plugin</a>
</li>
<li class="class-depth-1">
<a href="Phaser.PluginManager.html">PluginManager</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Point.html">Point</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Pointer.html">Pointer</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Polygon.html">Polygon</a>
</li>
<li class="class-depth-1">
<a href="Phaser.QuadTree.html">QuadTree</a>
</li>
<li class="class-depth-1">
<a href="Phaser.RandomDataGenerator.html">RandomDataGenerator</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Rectangle.html">Rectangle</a>
</li>
<li class="class-depth-1">
<a href="Phaser.RenderTexture.html">RenderTexture</a>
</li>
<li class="class-depth-1">
<a href="Phaser.RequestAnimationFrame.html">RequestAnimationFrame</a>
</li>
<li class="class-depth-1">
<a href="Phaser.RetroFont.html">RetroFont</a>
</li>
<li class="class-depth-1">
<a href="Phaser.ScaleManager.html">ScaleManager</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Signal.html">Signal</a>
</li>
<li class="class-depth-1">
<a href="Phaser.SignalBinding.html">SignalBinding</a>
</li>
<li class="class-depth-1">
<a href="Phaser.SinglePad.html">SinglePad</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Sound.html">Sound</a>
</li>
<li class="class-depth-1">
<a href="Phaser.SoundManager.html">SoundManager</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Sprite.html">Sprite</a>
</li>
<li class="class-depth-1">
<a href="Phaser.SpriteBatch.html">SpriteBatch</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Stage.html">Stage</a>
</li>
<li class="class-depth-1">
<a href="Phaser.State.html">State</a>
</li>
<li class="class-depth-1">
<a href="Phaser.StateManager.html">StateManager</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Text.html">Text</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Tile.html">Tile</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Tilemap.html">Tilemap</a>
</li>
<li class="class-depth-1">
<a href="Phaser.TilemapLayer.html">TilemapLayer</a>
</li>
<li class="class-depth-1">
<a href="Phaser.TilemapParser.html">TilemapParser</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Tileset.html">Tileset</a>
</li>
<li class="class-depth-1">
<a href="Phaser.TileSprite.html">TileSprite</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Time.html">Time</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Timer.html">Timer</a>
</li>
<li class="class-depth-1">
<a href="Phaser.TimerEvent.html">TimerEvent</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Touch.html">Touch</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Tween.html">Tween</a>
</li>
<li class="class-depth-1">
<a href="Phaser.TweenManager.html">TweenManager</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Utils.html">Utils</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Utils.Debug.html">Debug</a>
</li>
<li class="class-depth-1">
<a href="Phaser.World.html">World</a>
</li>
</ul>
</li>
</ul>
</div>
</div>
<div class="row-fluid">
<div class="span8">
<div id="main">
<h1 class="page-title">Class: P2</h1>
<section>
<header>
<h2>
<span class="ancestors"><a href="Phaser.html">Phaser</a><a href="Phaser.Physics.html">.Physics</a>.</span>
P2
</h2>
<div class="class-description"><p>Physics World Constructor</p></div>
</header>
<article>
<div class="container-overview">
<dt>
<h4 class="name" id="P2"><span class="type-signature"></span>new P2<span class="signature">(game, <span class="optional">config</span>)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Argument</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>game</code></td>
<td class="type">
<span class="param-type"><a href="Phaser.Game.html">Phaser.Game</a></span>
</td>
<td class="attributes">
</td>
<td class="description last"><p>Reference to the current game instance.</p></td>
</tr>
<tr>
<td class="name"><code>config</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last"><p>Physics configuration object passed in from the game constructor.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="World.js.html">physics/p2/World.js</a>, <a href="World.js.html#sunlight-1-line-18">line 18</a>
</li></ul></dd>
</dl>
</dd>
</div>
<h3 class="subsection-title">Classes</h3>
<dl>
<dt class="class-depth-3">
<a href="Phaser.Physics.P2.Body.html">Body</a>
</dt>
<dd>
</dd>
<dt class="class-depth-3">
<a href="Phaser.Physics.P2.BodyDebug.html">BodyDebug</a>
</dt>
<dd>
</dd>
<dt class="class-depth-3">
<a href="Phaser.Physics.P2.CollisionGroup.html">CollisionGroup</a>
</dt>
<dd>
</dd>
<dt class="class-depth-3">
<a href="Phaser.Physics.P2.ContactMaterial.html">ContactMaterial</a>
</dt>
<dd>
</dd>
<dt class="class-depth-3">
<a href="Phaser.Physics.P2.DistanceConstraint.html">DistanceConstraint</a>
</dt>
<dd>
</dd>
<dt class="class-depth-3">
<a href="Phaser.Physics.P2.FixtureList.html">FixtureList</a>
</dt>
<dd>
</dd>
<dt class="class-depth-3">
<a href="Phaser.Physics.P2.GearConstraint.html">GearConstraint</a>
</dt>
<dd>
</dd>
<dt class="class-depth-3">
<a href="Phaser.Physics.P2.InversePointProxy.html">InversePointProxy</a>
</dt>
<dd>
</dd>
<dt class="class-depth-3">
<a href="Phaser.Physics.P2.LockConstraint.html">LockConstraint</a>
</dt>
<dd>
</dd>
<dt class="class-depth-3">
<a href="Phaser.Physics.P2.Material.html">Material</a>
</dt>
<dd>
</dd>
<dt class="class-depth-3">
<a href="Phaser.Physics.P2.PointProxy.html">PointProxy</a>
</dt>
<dd>
</dd>
<dt class="class-depth-3">
<a href="Phaser.Physics.P2.PrismaticConstraint.html">PrismaticConstraint</a>
</dt>
<dd>
</dd>
<dt class="class-depth-3">
<a href="Phaser.Physics.P2.RevoluteConstraint.html">RevoluteConstraint</a>
</dt>
<dd>
</dd>
<dt class="class-depth-3">
<a href="Phaser.Physics.P2.Spring.html">Spring</a>
</dt>
<dd>
</dd>
</dl>
<h3 class="subsection-title">Members</h3>
<dl>
<dt>
<h4 class="name" id="applyDamping"><span class="type-signature"></span>applyDamping<span class="type-signature"></span></h4>
</dt>
<dd>
<dl class="details">
<h5 class="subsection-title">Properties:</h5>
<dl>
<table class="props table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>applyDamping</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="description last"><p>Enable to automatically apply body damping each step.</p></td>
</tr>
</tbody>
</table>
</dl>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="World.js.html">physics/p2/World.js</a>, <a href="World.js.html#sunlight-1-line-1748">line 1748</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="applyGravity"><span class="type-signature"></span>applyGravity<span class="type-signature"></span></h4>
</dt>
<dd>
<dl class="details">
<h5 class="subsection-title">Properties:</h5>
<dl>
<table class="props table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>applyGravity</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="description last"><p>Enable to automatically apply gravity each step.</p></td>
</tr>
</tbody>
</table>
</dl>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="World.js.html">physics/p2/World.js</a>, <a href="World.js.html#sunlight-1-line-1768">line 1768</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="applySpringForces"><span class="type-signature"></span>applySpringForces<span class="type-signature"></span></h4>
</dt>
<dd>
<dl class="details">
<h5 class="subsection-title">Properties:</h5>
<dl>
<table class="props table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>applySpringForces</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="description last"><p>Enable to automatically apply spring forces each step.</p></td>
</tr>
</tbody>
</table>
</dl>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="World.js.html">physics/p2/World.js</a>, <a href="World.js.html#sunlight-1-line-1728">line 1728</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="boundsCollidesWith"><span class="type-signature"></span>boundsCollidesWith<span class="type-signature"></span></h4>
</dt>
<dd>
<dl class="details">
<h5 class="subsection-title">Properties:</h5>
<dl>
<table class="props table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>boundsCollidesWith</code></td>
<td class="type">
<span class="param-type">array</span>
</td>
<td class="description last"><p>An array of the bodies the world bounds collides with.</p></td>
</tr>
</tbody>
</table>
</dl>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="World.js.html">physics/p2/World.js</a>, <a href="World.js.html#sunlight-1-line-166">line 166</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="boundsCollisionGroup"><span class="type-signature"></span>boundsCollisionGroup<span class="type-signature"></span></h4>
</dt>
<dd>
<dl class="details">
<h5 class="subsection-title">Properties:</h5>
<dl>
<table class="props table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>boundsCollisionGroup</code></td>
<td class="type">
<span class="param-type"><a href="Phaser.Physics.P2.CollisionGroup.html">Phaser.Physics.P2.CollisionGroup</a></span>
</td>
<td class="description last"><p>A default collision group.</p></td>
</tr>
</tbody>
</table>
</dl>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="World.js.html">physics/p2/World.js</a>, <a href="World.js.html#sunlight-1-line-156">line 156</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="callbackContext"><span class="type-signature"></span>callbackContext<span class="type-signature"></span></h4>
</dt>
<dd>
<dl class="details">
<h5 class="subsection-title">Properties:</h5>
<dl>
<table class="props table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>callbackContext</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="description last"><p>The context under which the callbacks are fired.</p></td>
</tr>
</tbody>
</table>
</dl>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="World.js.html">physics/p2/World.js</a>, <a href="World.js.html#sunlight-1-line-118">line 118</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="collisionGroups"><span class="type-signature"></span>collisionGroups<span class="type-signature"></span></h4>
</dt>
<dd>
<dl class="details">
<h5 class="subsection-title">Properties:</h5>
<dl>
<table class="props table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>collisionGroups</code></td>
<td class="type">
<span class="param-type">array</span>
</td>
<td class="description last"><p>An array containing the collision groups that have been defined in the World.</p></td>
</tr>
</tbody>
</table>
</dl>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="World.js.html">physics/p2/World.js</a>, <a href="World.js.html#sunlight-1-line-146">line 146</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="contactMaterial"><span class="type-signature"></span>contactMaterial<span class="type-signature"></span></h4>
</dt>
<dd>
<dl class="details">
<h5 class="subsection-title">Properties:</h5>
<dl>
<table class="props table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>contactMaterial</code></td>
<td class="type">
<span class="param-type">p2.ContactMaterial</span>
</td>
<td class="description last"><p>The default Contact Material being used by the World.</p></td>
</tr>
</tbody>
</table>
</dl>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="World.js.html">physics/p2/World.js</a>, <a href="World.js.html#sunlight-1-line-1708">line 1708</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="defaultFriction"><span class="type-signature"></span>defaultFriction<span class="type-signature"></span></h4>
</dt>
<dd>
<dl class="details">
<h5 class="subsection-title">Properties:</h5>
<dl>
<table class="props table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>defaultFriction</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>DEPRECATED: Use World.friction instead.</p></td>
</tr>
</tbody>
</table>
</dl>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="World.js.html">physics/p2/World.js</a>, <a href="World.js.html#sunlight-1-line-1648">line 1648</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="defaultRestitution"><span class="type-signature"></span>defaultRestitution<span class="type-signature"></span></h4>
</dt>
<dd>
<dl class="details">
<h5 class="subsection-title">Properties:</h5>
<dl>
<table class="props table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>defaultRestitution</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>DEPRECATED: Use World.restitution instead.</p></td>
</tr>
</tbody>
</table>
</dl>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="World.js.html">physics/p2/World.js</a>, <a href="World.js.html#sunlight-1-line-1688">line 1688</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="emitImpactEvent"><span class="type-signature"></span>emitImpactEvent<span class="type-signature"></span></h4>
</dt>
<dd>
<dl class="details">
<h5 class="subsection-title">Properties:</h5>
<dl>
<table class="props table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>emitImpactEvent</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="description last"><p>Set to true if you want to the world to emit the &quot;impact&quot; event. Turning this off could improve performance.</p></td>
</tr>
</tbody>
</table>
</dl>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="World.js.html">physics/p2/World.js</a>, <a href="World.js.html#sunlight-1-line-1823">line 1823</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="enableBodySleeping"><span class="type-signature"></span>enableBodySleeping<span class="type-signature"></span></h4>
</dt>
<dd>
<dl class="details">
<h5 class="subsection-title">Properties:</h5>
<dl>
<table class="props table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>enableBodySleeping</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="description last"><p>Enable / disable automatic body sleeping.</p></td>
</tr>
</tbody>
</table>
</dl>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="World.js.html">physics/p2/World.js</a>, <a href="World.js.html#sunlight-1-line-1843">line 1843</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="everythingCollisionGroup"><span class="type-signature"></span>everythingCollisionGroup<span class="type-signature"></span></h4>
</dt>
<dd>
<dl class="details">
<h5 class="subsection-title">Properties:</h5>
<dl>
<table class="props table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>everythingCollisionGroup</code></td>
<td class="type">
<span class="param-type"><a href="Phaser.Physics.P2.CollisionGroup.html">Phaser.Physics.P2.CollisionGroup</a></span>
</td>
<td class="description last"><p>A default collision group.</p></td>
</tr>
</tbody>
</table>
</dl>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="World.js.html">physics/p2/World.js</a>, <a href="World.js.html#sunlight-1-line-161">line 161</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="frameRate"><span class="type-signature"></span>frameRate<span class="type-signature"></span></h4>
</dt>
<dd>
<dl class="details">
<h5 class="subsection-title">Properties:</h5>
<dl>
<table class="props table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>frameRate</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>The frame rate the world will be stepped at. Defaults to 1 / 60, but you can change here. Also see useElapsedTime property.</p></td>
</tr>
</tbody>
</table>
</dl>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="World.js.html">physics/p2/World.js</a>, <a href="World.js.html#sunlight-1-line-40">line 40</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="friction"><span class="type-signature"></span>friction<span class="type-signature"></span></h4>
</dt>
<dd>
<dl class="details">
<h5 class="subsection-title">Properties:</h5>
<dl>
<table class="props table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>friction</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>Friction between colliding bodies. This value is used if no matching ContactMaterial is found for a Material pair.</p></td>
</tr>
</tbody>
</table>
</dl>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="World.js.html">physics/p2/World.js</a>, <a href="World.js.html#sunlight-1-line-1628">line 1628</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="game"><span class="type-signature"></span>game<span class="type-signature"></span></h4>
</dt>
<dd>
<dl class="details">
<h5 class="subsection-title">Properties:</h5>
<dl>
<table class="props table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>game</code></td>
<td class="type">
<span class="param-type"><a href="Phaser.Game.html">Phaser.Game</a></span>
</td>
<td class="description last"><p>Local reference to game.</p></td>
</tr>
</tbody>
</table>
</dl>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="World.js.html">physics/p2/World.js</a>, <a href="World.js.html#sunlight-1-line-23">line 23</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="gravity"><span class="type-signature"></span>gravity<span class="type-signature"></span></h4>
</dt>
<dd>
<dl class="details">
<h5 class="subsection-title">Properties:</h5>
<dl>
<table class="props table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>gravity</code></td>
<td class="type">
<span class="param-type"><a href="Phaser.Physics.P2.InversePointProxy.html">Phaser.Physics.P2.InversePointProxy</a></span>
</td>
<td class="description last"><p>The gravity applied to all bodies each step.</p></td>
</tr>
</tbody>
</table>
</dl>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="World.js.html">physics/p2/World.js</a>, <a href="World.js.html#sunlight-1-line-63">line 63</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="materials"><span class="type-signature">&lt;protected> </span>materials<span class="type-signature"></span></h4>
</dt>
<dd>
<dl class="details">
<h5 class="subsection-title">Properties:</h5>
<dl>
<table class="props table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>materials</code></td>
<td class="type">
<span class="param-type">array.&lt;<a href="Phaser.Physics.P2.Material.html">Phaser.Physics.P2.Material</a>></span>
</td>
<td class="description last"><p>A local array of all created Materials.</p></td>
</tr>
</tbody>
</table>
</dl>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="World.js.html">physics/p2/World.js</a>, <a href="World.js.html#sunlight-1-line-58">line 58</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="nothingCollisionGroup"><span class="type-signature"></span>nothingCollisionGroup<span class="type-signature"></span></h4>
</dt>
<dd>
<dl class="details">
<h5 class="subsection-title">Properties:</h5>
<dl>
<table class="props table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>nothingCollisionGroup</code></td>
<td class="type">
<span class="param-type"><a href="Phaser.Physics.P2.CollisionGroup.html">Phaser.Physics.P2.CollisionGroup</a></span>
</td>
<td class="description last"><p>A default collision group.</p></td>
</tr>
</tbody>
</table>
</dl>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="World.js.html">physics/p2/World.js</a>, <a href="World.js.html#sunlight-1-line-151">line 151</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="onBeginContact"><span class="type-signature"></span>onBeginContact<span class="type-signature"></span></h4>
</dt>
<dd>
<dl class="details">
<h5 class="subsection-title">Properties:</h5>
<dl>
<table class="props table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>onBeginContact</code></td>
<td class="type">
<span class="param-type"><a href="Phaser.Signal.html">Phaser.Signal</a></span>
</td>
<td class="description last"><p>Dispatched when a first contact is created between two bodies. This event is fired before the step has been done.</p></td>
</tr>
</tbody>
</table>
</dl>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="World.js.html">physics/p2/World.js</a>, <a href="World.js.html#sunlight-1-line-123">line 123</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="onBodyAdded"><span class="type-signature"></span>onBodyAdded<span class="type-signature"></span></h4>
</dt>
<dd>
<dl class="details">
<h5 class="subsection-title">Properties:</h5>
<dl>
<table class="props table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>onBodyAdded</code></td>
<td class="type">
<span class="param-type"><a href="Phaser.Signal.html">Phaser.Signal</a></span>
</td>
<td class="description last"><p>Dispatched when a new Body is added to the World.</p></td>
</tr>
</tbody>
</table>
</dl>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="World.js.html">physics/p2/World.js</a>, <a href="World.js.html#sunlight-1-line-73">line 73</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="onBodyRemoved"><span class="type-signature"></span>onBodyRemoved<span class="type-signature"></span></h4>
</dt>
<dd>
<dl class="details">
<h5 class="subsection-title">Properties:</h5>
<dl>
<table class="props table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>onBodyRemoved</code></td>
<td class="type">
<span class="param-type"><a href="Phaser.Signal.html">Phaser.Signal</a></span>
</td>
<td class="description last"><p>Dispatched when a Body is removed from the World.</p></td>
</tr>
</tbody>
</table>
</dl>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="World.js.html">physics/p2/World.js</a>, <a href="World.js.html#sunlight-1-line-78">line 78</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="onConstraintAdded"><span class="type-signature"></span>onConstraintAdded<span class="type-signature"></span></h4>
</dt>
<dd>
<dl class="details">
<h5 class="subsection-title">Properties:</h5>
<dl>
<table class="props table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>onConstraintAdded</code></td>
<td class="type">
<span class="param-type"><a href="Phaser.Signal.html">Phaser.Signal</a></span>
</td>
<td class="description last"><p>Dispatched when a new Constraint is added to the World.</p></td>
</tr>
</tbody>
</table>
</dl>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="World.js.html">physics/p2/World.js</a>, <a href="World.js.html#sunlight-1-line-93">line 93</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="onConstraintRemoved"><span class="type-signature"></span>onConstraintRemoved<span class="type-signature"></span></h4>
</dt>
<dd>
<dl class="details">
<h5 class="subsection-title">Properties:</h5>
<dl>
<table class="props table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>onConstraintRemoved</code></td>
<td class="type">
<span class="param-type"><a href="Phaser.Signal.html">Phaser.Signal</a></span>
</td>
<td class="description last"><p>Dispatched when a Constraint is removed from the World.</p></td>
</tr>
</tbody>
</table>
</dl>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="World.js.html">physics/p2/World.js</a>, <a href="World.js.html#sunlight-1-line-98">line 98</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="onContactMaterialAdded"><span class="type-signature"></span>onContactMaterialAdded<span class="type-signature"></span></h4>
</dt>
<dd>
<dl class="details">
<h5 class="subsection-title">Properties:</h5>
<dl>
<table class="props table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>onContactMaterialAdded</code></td>
<td class="type">
<span class="param-type"><a href="Phaser.Signal.html">Phaser.Signal</a></span>
</td>
<td class="description last"><p>Dispatched when a new ContactMaterial is added to the World.</p></td>
</tr>
</tbody>
</table>
</dl>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="World.js.html">physics/p2/World.js</a>, <a href="World.js.html#sunlight-1-line-103">line 103</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="onContactMaterialRemoved"><span class="type-signature"></span>onContactMaterialRemoved<span class="type-signature"></span></h4>
</dt>
<dd>
<dl class="details">
<h5 class="subsection-title">Properties:</h5>
<dl>
<table class="props table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>onContactMaterialRemoved</code></td>
<td class="type">
<span class="param-type"><a href="Phaser.Signal.html">Phaser.Signal</a></span>
</td>
<td class="description last"><p>Dispatched when a ContactMaterial is removed from the World.</p></td>
</tr>
</tbody>
</table>
</dl>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="World.js.html">physics/p2/World.js</a>, <a href="World.js.html#sunlight-1-line-108">line 108</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="onEndContact"><span class="type-signature"></span>onEndContact<span class="type-signature"></span></h4>
</dt>
<dd>
<dl class="details">
<h5 class="subsection-title">Properties:</h5>
<dl>
<table class="props table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>onEndContact</code></td>
<td class="type">
<span class="param-type"><a href="Phaser.Signal.html">Phaser.Signal</a></span>
</td>
<td class="description last"><p>Dispatched when final contact occurs between two bodies. This event is fired before the step has been done.</p></td>
</tr>
</tbody>
</table>
</dl>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="World.js.html">physics/p2/World.js</a>, <a href="World.js.html#sunlight-1-line-128">line 128</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="onSpringAdded"><span class="type-signature"></span>onSpringAdded<span class="type-signature"></span></h4>
</dt>
<dd>
<dl class="details">
<h5 class="subsection-title">Properties:</h5>
<dl>
<table class="props table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>onSpringAdded</code></td>
<td class="type">
<span class="param-type"><a href="Phaser.Signal.html">Phaser.Signal</a></span>
</td>
<td class="description last"><p>Dispatched when a new Spring is added to the World.</p></td>
</tr>
</tbody>
</table>
</dl>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="World.js.html">physics/p2/World.js</a>, <a href="World.js.html#sunlight-1-line-83">line 83</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="onSpringRemoved"><span class="type-signature"></span>onSpringRemoved<span class="type-signature"></span></h4>
</dt>
<dd>
<dl class="details">
<h5 class="subsection-title">Properties:</h5>
<dl>
<table class="props table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>onSpringRemoved</code></td>
<td class="type">
<span class="param-type"><a href="Phaser.Signal.html">Phaser.Signal</a></span>
</td>
<td class="description last"><p>Dispatched when a Spring is removed from the World.</p></td>
</tr>
</tbody>
</table>
</dl>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="World.js.html">physics/p2/World.js</a>, <a href="World.js.html#sunlight-1-line-88">line 88</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="paused"><span class="type-signature"></span>paused<span class="type-signature"></span></h4>
</dt>
<dd>
<dl class="details">
<h5 class="subsection-title">Properties:</h5>
<dl>
<table class="props table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>paused</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="description last"><p>The paused state of the P2 World.</p></td>
</tr>
</tbody>
</table>
</dl>
<dt class="tag-default">Default Value:</dt>
<dd class="tag-default"><ul class="dummy"><li>false</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="World.js.html">physics/p2/World.js</a>, <a href="World.js.html#sunlight-1-line-52">line 52</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="postBroadphaseCallback"><span class="type-signature"></span>postBroadphaseCallback<span class="type-signature"></span></h4>
</dt>
<dd>
<dl class="details">
<h5 class="subsection-title">Properties:</h5>
<dl>
<table class="props table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>postBroadphaseCallback</code></td>
<td class="type">
<span class="param-type">function</span>
</td>
<td class="description last"><p>A postBroadphase callback.</p></td>
</tr>
</tbody>
</table>
</dl>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="World.js.html">physics/p2/World.js</a>, <a href="World.js.html#sunlight-1-line-113">line 113</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="restitution"><span class="type-signature"></span>restitution<span class="type-signature"></span></h4>
</dt>
<dd>
<dl class="details">
<h5 class="subsection-title">Properties:</h5>
<dl>
<table class="props table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>restitution</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>Default coefficient of restitution between colliding bodies. This value is used if no matching ContactMaterial is found for a Material pair.</p></td>
</tr>
</tbody>
</table>
</dl>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="World.js.html">physics/p2/World.js</a>, <a href="World.js.html#sunlight-1-line-1668">line 1668</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="solveConstraints"><span class="type-signature"></span>solveConstraints<span class="type-signature"></span></h4>
</dt>
<dd>
<dl class="details">
<h5 class="subsection-title">Properties:</h5>
<dl>
<table class="props table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>solveConstraints</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="description last"><p>Enable/disable constraint solving in each step.</p></td>
</tr>
</tbody>
</table>
</dl>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="World.js.html">physics/p2/World.js</a>, <a href="World.js.html#sunlight-1-line-1788">line 1788</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="time"><span class="type-signature">&lt;readonly> </span>time<span class="type-signature"></span></h4>
</dt>
<dd>
<dl class="details">
<h5 class="subsection-title">Properties:</h5>
<dl>
<table class="props table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>time</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="description last"><p>The World time.</p></td>
</tr>
</tbody>
</table>
</dl>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="World.js.html">physics/p2/World.js</a>, <a href="World.js.html#sunlight-1-line-1808">line 1808</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="total"><span class="type-signature">&lt;readonly> </span>total<span class="type-signature"></span></h4>
</dt>
<dd>
<dl class="details">
<h5 class="subsection-title">Properties:</h5>
<dl>
<table class="props table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>total</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>The total number of bodies in the world.</p></td>
</tr>
</tbody>
</table>
</dl>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="World.js.html">physics/p2/World.js</a>, <a href="World.js.html#sunlight-1-line-1863">line 1863</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="useElapsedTime"><span class="type-signature"></span>useElapsedTime<span class="type-signature"></span></h4>
</dt>
<dd>
<dl class="details">
<h5 class="subsection-title">Properties:</h5>
<dl>
<table class="props table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>useElapsedTime</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="description last"><p>If true the frameRate value will be ignored and instead p2 will step with the value of Game.Time.physicsElapsed, which is a delta time value.</p></td>
</tr>
</tbody>
</table>
</dl>
<dt class="tag-default">Default Value:</dt>
<dd class="tag-default"><ul class="dummy"><li>false</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="World.js.html">physics/p2/World.js</a>, <a href="World.js.html#sunlight-1-line-46">line 46</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="walls"><span class="type-signature"></span>walls<span class="type-signature"></span></h4>
</dt>
<dd>
<dl class="details">
<h5 class="subsection-title">Properties:</h5>
<dl>
<table class="props table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>walls</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="description last"><p>An object containing the 4 wall bodies that bound the physics world.</p></td>
</tr>
</tbody>
</table>
</dl>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="World.js.html">physics/p2/World.js</a>, <a href="World.js.html#sunlight-1-line-68">line 68</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="world"><span class="type-signature">&lt;protected> </span>world<span class="type-signature"></span></h4>
</dt>
<dd>
<dl class="details">
<h5 class="subsection-title">Properties:</h5>
<dl>
<table class="props table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>world</code></td>
<td class="type">
<span class="param-type">p2.World</span>
</td>
<td class="description last"><p>The p2 World in which the simulation is run.</p></td>
</tr>
</tbody>
</table>
</dl>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="World.js.html">physics/p2/World.js</a>, <a href="World.js.html#sunlight-1-line-34">line 34</a>
</li></ul></dd>
</dl>
</dd>
</dl>
<h3 class="subsection-title">Methods</h3>
<dl>
<dt>
<h4 class="name" id="addBody"><span class="type-signature"></span>addBody<span class="signature">(body)</span><span class="type-signature"> &rarr; {boolean}</span></h4>
</dt>
<dd>
<div class="description">
<p>Add a body to the world.</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>body</code></td>
<td class="type">
<span class="param-type"><a href="Phaser.Physics.P2.Body.html">Phaser.Physics.P2.Body</a></span>
</td>
<td class="description last"><p>The Body to add to the World.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="World.js.html">physics/p2/World.js</a>, <a href="World.js.html#sunlight-1-line-719">line 719</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>True if the Body was added successfully, otherwise false.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">boolean</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="addConstraint"><span class="type-signature"></span>addConstraint<span class="signature">(constraint)</span><span class="type-signature"> &rarr; {Phaser.Physics.P2.Constraint}</span></h4>
</dt>
<dd>
<div class="description">
<p>Adds a Constraint to the world.</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>constraint</code></td>
<td class="type">
<span class="param-type">Phaser.Physics.P2.Constraint</span>
</td>
<td class="description last"><p>The Constraint to add to the World.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="World.js.html">physics/p2/World.js</a>, <a href="World.js.html#sunlight-1-line-934">line 934</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>The Constraint that was added.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Phaser.Physics.P2.Constraint</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="addContactMaterial"><span class="type-signature"></span>addContactMaterial<span class="signature">(material)</span><span class="type-signature"> &rarr; {<a href="Phaser.Physics.P2.ContactMaterial.html">Phaser.Physics.P2.ContactMaterial</a>}</span></h4>
</dt>
<dd>
<div class="description">
<p>Adds a Contact Material to the world.</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>material</code></td>
<td class="type">
<span class="param-type"><a href="Phaser.Physics.P2.ContactMaterial.html">Phaser.Physics.P2.ContactMaterial</a></span>
</td>
<td class="description last"><p>The Contact Material to be added to the World.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="World.js.html">physics/p2/World.js</a>, <a href="World.js.html#sunlight-1-line-968">line 968</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>The Contact Material that was added.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type"><a href="Phaser.Physics.P2.ContactMaterial.html">Phaser.Physics.P2.ContactMaterial</a></span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="addSpring"><span class="type-signature"></span>addSpring<span class="signature">(spring)</span><span class="type-signature"> &rarr; {<a href="Phaser.Physics.P2.Spring.html">Phaser.Physics.P2.Spring</a>}</span></h4>
</dt>
<dd>
<div class="description">
<p>Adds a Spring to the world.</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>spring</code></td>
<td class="type">
<span class="param-type"><a href="Phaser.Physics.P2.Spring.html">Phaser.Physics.P2.Spring</a></span>
</td>
<td class="description last"><p>The Spring to add to the World.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="World.js.html">physics/p2/World.js</a>, <a href="World.js.html#sunlight-1-line-763">line 763</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>The Spring that was added.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type"><a href="Phaser.Physics.P2.Spring.html">Phaser.Physics.P2.Spring</a></span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="beginContactHandler"><span class="type-signature"></span>beginContactHandler<span class="signature">(event)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>Handles a p2 begin contact event.</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>event</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="description last"><p>The event data.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="World.js.html">physics/p2/World.js</a>, <a href="World.js.html#sunlight-1-line-404">line 404</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="clear"><span class="type-signature"></span>clear<span class="signature">()</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>Clears all bodies from the simulation, resets callbacks and resets the collision bitmask.</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="World.js.html">physics/p2/World.js</a>, <a href="World.js.html#sunlight-1-line-683">line 683</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="clearTilemapLayerBodies"><span class="type-signature"></span>clearTilemapLayerBodies<span class="signature">(map, <span class="optional">layer</span>)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>Clears all physics bodies from the given TilemapLayer that were created with <code>World.convertTilemap</code>.</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Argument</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>map</code></td>
<td class="type">
<span class="param-type"><a href="Phaser.Tilemap.html">Phaser.Tilemap</a></span>
</td>
<td class="attributes">
</td>
<td class="description last"><p>The Tilemap to get the map data from.</p></td>
</tr>
<tr>
<td class="name"><code>layer</code></td>
<td class="type">
<span class="param-type">number</span>
|
<span class="param-type">string</span>
|
<span class="param-type"><a href="Phaser.TilemapLayer.html">Phaser.TilemapLayer</a></span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last"><p>The layer to operate on. If not given will default to map.currentLayer.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="World.js.html">physics/p2/World.js</a>, <a href="World.js.html#sunlight-1-line-1455">line 1455</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="convertCollisionObjects"><span class="type-signature"></span>convertCollisionObjects<span class="signature">(map, <span class="optional">layer</span>, <span class="optional">addToWorld</span>)</span><span class="type-signature"> &rarr; {array}</span></h4>
</dt>
<dd>
<div class="description">
<p>Converts all of the polylines objects inside a Tiled ObjectGroup into physics bodies that are added to the world.
Note that the polylines must be created in such a way that they can withstand polygon decomposition.</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Argument</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>map</code></td>
<td class="type">
<span class="param-type"><a href="Phaser.Tilemap.html">Phaser.Tilemap</a></span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"><p>The Tilemap to get the map data from.</p></td>
</tr>
<tr>
<td class="name"><code>layer</code></td>
<td class="type">
<span class="param-type">number</span>
|
<span class="param-type">string</span>
|
<span class="param-type"><a href="Phaser.TilemapLayer.html">Phaser.TilemapLayer</a></span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
</td>
<td class="description last"><p>The layer to operate on. If not given will default to map.currentLayer.</p></td>
</tr>
<tr>
<td class="name"><code>addToWorld</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
true
</td>
<td class="description last"><p>If true it will automatically add each body to the world.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="World.js.html">physics/p2/World.js</a>, <a href="World.js.html#sunlight-1-line-1414">line 1414</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>An array of the Phaser.Physics.Body objects that have been created.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">array</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="convertTilemap"><span class="type-signature"></span>convertTilemap<span class="signature">(map, <span class="optional">layer</span>, <span class="optional">addToWorld</span>, <span class="optional">optimize</span>)</span><span class="type-signature"> &rarr; {array}</span></h4>
</dt>
<dd>
<div class="description">
<p>Goes through all tiles in the given Tilemap and TilemapLayer and converts those set to collide into physics bodies.
Only call this <em>after</em> you have specified all of the tiles you wish to collide with calls like Tilemap.setCollisionBetween, etc.
Every time you call this method it will destroy any previously created bodies and remove them from the world.
Therefore understand it's a very expensive operation and not to be done in a core game update loop.</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Argument</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>map</code></td>
<td class="type">
<span class="param-type"><a href="Phaser.Tilemap.html">Phaser.Tilemap</a></span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"><p>The Tilemap to get the map data from.</p></td>
</tr>
<tr>
<td class="name"><code>layer</code></td>
<td class="type">
<span class="param-type">number</span>
|
<span class="param-type">string</span>
|
<span class="param-type"><a href="Phaser.TilemapLayer.html">Phaser.TilemapLayer</a></span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
</td>
<td class="description last"><p>The layer to operate on. If not given will default to map.currentLayer.</p></td>
</tr>
<tr>
<td class="name"><code>addToWorld</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
true
</td>
<td class="description last"><p>If true it will automatically add each body to the world, otherwise it's up to you to do so.</p></td>
</tr>
<tr>
<td class="name"><code>optimize</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
true
</td>
<td class="description last"><p>If true adjacent colliding tiles will be combined into a single body to save processing. However it means you cannot perform specific Tile to Body collision responses.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="World.js.html">physics/p2/World.js</a>, <a href="World.js.html#sunlight-1-line-1477">line 1477</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>An array of the Phaser.Physics.P2.Body objects that were created.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">array</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="createBody"><span class="type-signature"></span>createBody<span class="signature">(x, y, mass, <span class="optional">addToWorld</span>, options, points)</span><span class="type-signature"> &rarr; {<a href="Phaser.Physics.P2.Body.html">Phaser.Physics.P2.Body</a>}</span></h4>
</dt>
<dd>
<div class="description">
<p>Creates a new Body and adds it to the World.</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Argument</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>x</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"><p>The x coordinate of Body.</p></td>
</tr>
<tr>
<td class="name"><code>y</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"><p>The y coordinate of Body.</p></td>
</tr>
<tr>
<td class="name"><code>mass</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"><p>The mass of the Body. A mass of 0 means a 'static' Body is created.</p></td>
</tr>
<tr>
<td class="name"><code>addToWorld</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
false
</td>
<td class="description last"><p>Automatically add this Body to the world? (usually false as it won't have any shapes on construction).</p></td>
</tr>
<tr>
<td class="name"><code>options</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"><p>An object containing the build options:</p>
<h6>Properties</h6>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Argument</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>optimalDecomp</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
false
</td>
<td class="description last"><p>Set to true if you need optimal decomposition. Warning: very slow for polygons with more than 10 vertices.</p></td>
</tr>
<tr>
<td class="name"><code>skipSimpleCheck</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
false
</td>
<td class="description last"><p>Set to true if you already know that the path is not intersecting itself.</p></td>
</tr>
<tr>
<td class="name"><code>removeCollinearPoints</code></td>
<td class="type">
<span class="param-type">boolean</span>
|
<span class="param-type">number</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
false
</td>
<td class="description last"><p>Set to a number (angle threshold value) to remove collinear points, or false to keep all points.</p></td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td class="name"><code>points</code></td>
<td class="type">
<span class="param-type"><a href="Array.html">Array</a>.&lt;number></span>
|
<span class="param-type">number</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"><p>An array of 2d vectors that form the convex or concave polygon.
Either [[0,0], [0,1],...] or a flat array of numbers that will be interpreted as [x,y, x,y, ...],
or the arguments passed can be flat x,y values e.g. <code>setPolygon(options, x,y, x,y, x,y, ...)</code> where <code>x</code> and <code>y</code> are numbers.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="World.js.html">physics/p2/World.js</a>, <a href="World.js.html#sunlight-1-line-1331">line 1331</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>The body</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type"><a href="Phaser.Physics.P2.Body.html">Phaser.Physics.P2.Body</a></span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="createCollisionGroup"><span class="type-signature"></span>createCollisionGroup<span class="signature">(<span class="optional">object</span>)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>Creates a new Collision Group and optionally applies it to the given object.
Collision Groups are handled using bitmasks, therefore you have a fixed limit you can create before you need to re-use older groups.</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Argument</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>object</code></td>
<td class="type">
<span class="param-type"><a href="Phaser.Group.html">Phaser.Group</a></span>
|
<span class="param-type"><a href="Phaser.Sprite.html">Phaser.Sprite</a></span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last"><p>An optional Sprite or Group to apply the Collision Group to. If a Group is given it will be applied to all top-level children.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="World.js.html">physics/p2/World.js</a>, <a href="World.js.html#sunlight-1-line-1224">line 1224</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="createContactMaterial"><span class="type-signature"></span>createContactMaterial<span class="signature">(<span class="optional">materialA</span>, <span class="optional">materialB</span>, <span class="optional">options</span>)</span><span class="type-signature"> &rarr; {<a href="Phaser.Physics.P2.ContactMaterial.html">Phaser.Physics.P2.ContactMaterial</a>}</span></h4>
</dt>
<dd>
<div class="description">
<p>Creates a Contact Material from the two given Materials. You can then edit the properties of the Contact Material directly.</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Argument</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>materialA</code></td>
<td class="type">
<span class="param-type"><a href="Phaser.Physics.P2.Material.html">Phaser.Physics.P2.Material</a></span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last"><p>The first Material to create the ContactMaterial from. If undefined it will create a new Material object first.</p></td>
</tr>
<tr>
<td class="name"><code>materialB</code></td>
<td class="type">
<span class="param-type"><a href="Phaser.Physics.P2.Material.html">Phaser.Physics.P2.Material</a></span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last"><p>The second Material to create the ContactMaterial from. If undefined it will create a new Material object first.</p></td>
</tr>
<tr>
<td class="name"><code>options</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last"><p>Material options object.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="World.js.html">physics/p2/World.js</a>, <a href="World.js.html#sunlight-1-line-1061">line 1061</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>The Contact Material that was created.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type"><a href="Phaser.Physics.P2.ContactMaterial.html">Phaser.Physics.P2.ContactMaterial</a></span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="createDistanceConstraint"><span class="type-signature"></span>createDistanceConstraint<span class="signature">(bodyA, bodyB, distance, <span class="optional">maxForce</span>)</span><span class="type-signature"> &rarr; {<a href="Phaser.Physics.P2.DistanceConstraint.html">Phaser.Physics.P2.DistanceConstraint</a>}</span></h4>
</dt>
<dd>
<div class="description">
<p>Creates a constraint that tries to keep the distance between two bodies constant.</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Argument</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>bodyA</code></td>
<td class="type">
<span class="param-type"><a href="Phaser.Sprite.html">Phaser.Sprite</a></span>
|
<span class="param-type"><a href="Phaser.Physics.P2.Body.html">Phaser.Physics.P2.Body</a></span>
|
<span class="param-type"><a href="p2.Body.html">p2.Body</a></span>
</td>
<td class="attributes">
</td>
<td class="description last"><p>First connected body.</p></td>
</tr>
<tr>
<td class="name"><code>bodyB</code></td>
<td class="type">
<span class="param-type"><a href="Phaser.Sprite.html">Phaser.Sprite</a></span>
|
<span class="param-type"><a href="Phaser.Physics.P2.Body.html">Phaser.Physics.P2.Body</a></span>
|
<span class="param-type"><a href="p2.Body.html">p2.Body</a></span>
</td>
<td class="attributes">
</td>
<td class="description last"><p>Second connected body.</p></td>
</tr>
<tr>
<td class="name"><code>distance</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
</td>
<td class="description last"><p>The distance to keep between the bodies.</p></td>
</tr>
<tr>
<td class="name"><code>maxForce</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last"><p>The maximum force that should be applied to constrain the bodies.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="World.js.html">physics/p2/World.js</a>, <a href="World.js.html#sunlight-1-line-797">line 797</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>The constraint</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type"><a href="Phaser.Physics.P2.DistanceConstraint.html">Phaser.Physics.P2.DistanceConstraint</a></span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="createGearConstraint"><span class="type-signature"></span>createGearConstraint<span class="signature">(bodyA, bodyB, <span class="optional">angle</span>, <span class="optional">ratio</span>)</span><span class="type-signature"> &rarr; {<a href="Phaser.Physics.P2.GearConstraint.html">Phaser.Physics.P2.GearConstraint</a>}</span></h4>
</dt>
<dd>
<div class="description">
<p>Creates a constraint that tries to keep the distance between two bodies constant.</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Argument</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>bodyA</code></td>
<td class="type">
<span class="param-type"><a href="Phaser.Sprite.html">Phaser.Sprite</a></span>
|
<span class="param-type"><a href="Phaser.Physics.P2.Body.html">Phaser.Physics.P2.Body</a></span>
|
<span class="param-type"><a href="p2.Body.html">p2.Body</a></span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"><p>First connected body.</p></td>
</tr>
<tr>
<td class="name"><code>bodyB</code></td>
<td class="type">
<span class="param-type"><a href="Phaser.Sprite.html">Phaser.Sprite</a></span>
|
<span class="param-type"><a href="Phaser.Physics.P2.Body.html">Phaser.Physics.P2.Body</a></span>
|
<span class="param-type"><a href="p2.Body.html">p2.Body</a></span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"><p>Second connected body.</p></td>
</tr>
<tr>
<td class="name"><code>angle</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
0
</td>
<td class="description last"><p>The relative angle</p></td>
</tr>
<tr>
<td class="name"><code>ratio</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
1
</td>
<td class="description last"><p>The gear ratio.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="World.js.html">physics/p2/World.js</a>, <a href="World.js.html#sunlight-1-line-823">line 823</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>The constraint</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type"><a href="Phaser.Physics.P2.GearConstraint.html">Phaser.Physics.P2.GearConstraint</a></span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="createLockConstraint"><span class="type-signature"></span>createLockConstraint<span class="signature">(bodyA, bodyB, <span class="optional">offset</span>, <span class="optional">angle</span>, <span class="optional">maxForce</span>)</span><span class="type-signature"> &rarr; {<a href="Phaser.Physics.P2.LockConstraint.html">Phaser.Physics.P2.LockConstraint</a>}</span></h4>
</dt>
<dd>
<div class="description">
<p>Locks the relative position between two bodies.</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Argument</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>bodyA</code></td>
<td class="type">
<span class="param-type"><a href="Phaser.Sprite.html">Phaser.Sprite</a></span>
|
<span class="param-type"><a href="Phaser.Physics.P2.Body.html">Phaser.Physics.P2.Body</a></span>
|
<span class="param-type"><a href="p2.Body.html">p2.Body</a></span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"><p>First connected body.</p></td>
</tr>
<tr>
<td class="name"><code>bodyB</code></td>
<td class="type">
<span class="param-type"><a href="Phaser.Sprite.html">Phaser.Sprite</a></span>
|
<span class="param-type"><a href="Phaser.Physics.P2.Body.html">Phaser.Physics.P2.Body</a></span>
|
<span class="param-type"><a href="p2.Body.html">p2.Body</a></span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"><p>Second connected body.</p></td>
</tr>
<tr>
<td class="name"><code>offset</code></td>
<td class="type">
<span class="param-type"><a href="Array.html">Array</a></span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
</td>
<td class="description last"><p>The offset of bodyB in bodyA's frame. The value is an array with 2 elements matching x and y, i.e: [32, 32].</p></td>
</tr>
<tr>
<td class="name"><code>angle</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
0
</td>
<td class="description last"><p>The angle of bodyB in bodyA's frame.</p></td>
</tr>
<tr>
<td class="name"><code>maxForce</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
</td>
<td class="description last"><p>The maximum force that should be applied to constrain the bodies.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="World.js.html">physics/p2/World.js</a>, <a href="World.js.html#sunlight-1-line-877">line 877</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>The constraint</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type"><a href="Phaser.Physics.P2.LockConstraint.html">Phaser.Physics.P2.LockConstraint</a></span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="createMaterial"><span class="type-signature"></span>createMaterial<span class="signature">(<span class="optional">name</span>, <span class="optional">body</span>)</span><span class="type-signature"> &rarr; {<a href="Phaser.Physics.P2.Material.html">Phaser.Physics.P2.Material</a>}</span></h4>
</dt>
<dd>
<div class="description">
<p>Creates a Material. Materials are applied to Shapes owned by a Body and can be set with Body.setMaterial().
Materials are a way to control what happens when Shapes collide. Combine unique Materials together to create Contact Materials.
Contact Materials have properties such as friction and restitution that allow for fine-grained collision control between different Materials.</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Argument</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>name</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last"><p>Optional name of the Material. Each Material has a unique ID but string names are handy for debugging.</p></td>
</tr>
<tr>
<td class="name"><code>body</code></td>
<td class="type">
<span class="param-type"><a href="Phaser.Physics.P2.Body.html">Phaser.Physics.P2.Body</a></span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last"><p>Optional Body. If given it will assign the newly created Material to the Body shapes.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="World.js.html">physics/p2/World.js</a>, <a href="World.js.html#sunlight-1-line-1034">line 1034</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>The Material that was created. This is also stored in Phaser.Physics.P2.materials.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type"><a href="Phaser.Physics.P2.Material.html">Phaser.Physics.P2.Material</a></span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="createParticle"><span class="type-signature"></span>createParticle<span class="signature">(x, y, mass, <span class="optional">addToWorld</span>, options, points)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>Creates a new Particle and adds it to the World.</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Argument</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>x</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"><p>The x coordinate of Body.</p></td>
</tr>
<tr>
<td class="name"><code>y</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"><p>The y coordinate of Body.</p></td>
</tr>
<tr>
<td class="name"><code>mass</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"><p>The mass of the Body. A mass of 0 means a 'static' Body is created.</p></td>
</tr>
<tr>
<td class="name"><code>addToWorld</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
false
</td>
<td class="description last"><p>Automatically add this Body to the world? (usually false as it won't have any shapes on construction).</p></td>
</tr>
<tr>
<td class="name"><code>options</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"><p>An object containing the build options:</p>
<h6>Properties</h6>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Argument</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>optimalDecomp</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
false
</td>
<td class="description last"><p>Set to true if you need optimal decomposition. Warning: very slow for polygons with more than 10 vertices.</p></td>
</tr>
<tr>
<td class="name"><code>skipSimpleCheck</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
false
</td>
<td class="description last"><p>Set to true if you already know that the path is not intersecting itself.</p></td>
</tr>
<tr>
<td class="name"><code>removeCollinearPoints</code></td>
<td class="type">
<span class="param-type">boolean</span>
|
<span class="param-type">number</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
false
</td>
<td class="description last"><p>Set to a number (angle threshold value) to remove collinear points, or false to keep all points.</p></td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td class="name"><code>points</code></td>
<td class="type">
<span class="param-type"><a href="Array.html">Array</a>.&lt;number></span>
|
<span class="param-type">number</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"><p>An array of 2d vectors that form the convex or concave polygon.
Either [[0,0], [0,1],...] or a flat array of numbers that will be interpreted as [x,y, x,y, ...],
or the arguments passed can be flat x,y values e.g. <code>setPolygon(options, x,y, x,y, x,y, ...)</code> where <code>x</code> and <code>y</code> are numbers.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="World.js.html">physics/p2/World.js</a>, <a href="World.js.html#sunlight-1-line-1373">line 1373</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="createPrismaticConstraint"><span class="type-signature"></span>createPrismaticConstraint<span class="signature">(bodyA, bodyB, <span class="optional">lockRotation</span>, <span class="optional">anchorA</span>, <span class="optional">anchorB</span>, <span class="optional">axis</span>, <span class="optional">maxForce</span>)</span><span class="type-signature"> &rarr; {<a href="Phaser.Physics.P2.PrismaticConstraint.html">Phaser.Physics.P2.PrismaticConstraint</a>}</span></h4>
</dt>
<dd>
<div class="description">
<p>Constraint that only allows bodies to move along a line, relative to each other.
See <a href="http://www.iforce2d.net/b2dtut/joints-prismatic">http://www.iforce2d.net/b2dtut/joints-prismatic</a></p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Argument</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>bodyA</code></td>
<td class="type">
<span class="param-type"><a href="Phaser.Sprite.html">Phaser.Sprite</a></span>
|
<span class="param-type"><a href="Phaser.Physics.P2.Body.html">Phaser.Physics.P2.Body</a></span>
|
<span class="param-type"><a href="p2.Body.html">p2.Body</a></span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"><p>First connected body.</p></td>
</tr>
<tr>
<td class="name"><code>bodyB</code></td>
<td class="type">
<span class="param-type"><a href="Phaser.Sprite.html">Phaser.Sprite</a></span>
|
<span class="param-type"><a href="Phaser.Physics.P2.Body.html">Phaser.Physics.P2.Body</a></span>
|
<span class="param-type"><a href="p2.Body.html">p2.Body</a></span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"><p>Second connected body.</p></td>
</tr>
<tr>
<td class="name"><code>lockRotation</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
true
</td>
<td class="description last"><p>If set to false, bodyB will be free to rotate around its anchor point.</p></td>
</tr>
<tr>
<td class="name"><code>anchorA</code></td>
<td class="type">
<span class="param-type"><a href="Array.html">Array</a></span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
</td>
<td class="description last"><p>Body A's anchor point, defined in its own local frame. The value is an array with 2 elements matching x and y, i.e: [32, 32].</p></td>
</tr>
<tr>
<td class="name"><code>anchorB</code></td>
<td class="type">
<span class="param-type"><a href="Array.html">Array</a></span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
</td>
<td class="description last"><p>Body A's anchor point, defined in its own local frame. The value is an array with 2 elements matching x and y, i.e: [32, 32].</p></td>
</tr>
<tr>
<td class="name"><code>axis</code></td>
<td class="type">
<span class="param-type"><a href="Array.html">Array</a></span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
</td>
<td class="description last"><p>An axis, defined in body A frame, that body B's anchor point may slide along. The value is an array with 2 elements matching x and y, i.e: [32, 32].</p></td>
</tr>
<tr>
<td class="name"><code>maxForce</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
</td>
<td class="description last"><p>The maximum force that should be applied to constrain the bodies.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="World.js.html">physics/p2/World.js</a>, <a href="World.js.html#sunlight-1-line-904">line 904</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>The constraint</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type"><a href="Phaser.Physics.P2.PrismaticConstraint.html">Phaser.Physics.P2.PrismaticConstraint</a></span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="createRevoluteConstraint"><span class="type-signature"></span>createRevoluteConstraint<span class="signature">(bodyA, pivotA, bodyB, pivotB, <span class="optional">maxForce</span>)</span><span class="type-signature"> &rarr; {<a href="Phaser.Physics.P2.RevoluteConstraint.html">Phaser.Physics.P2.RevoluteConstraint</a>}</span></h4>
</dt>
<dd>
<div class="description">
<p>Connects two bodies at given offset points, letting them rotate relative to each other around this point.
The pivot points are given in world (pixel) coordinates.</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Argument</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>bodyA</code></td>
<td class="type">
<span class="param-type"><a href="Phaser.Sprite.html">Phaser.Sprite</a></span>
|
<span class="param-type"><a href="Phaser.Physics.P2.Body.html">Phaser.Physics.P2.Body</a></span>
|
<span class="param-type"><a href="p2.Body.html">p2.Body</a></span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"><p>First connected body.</p></td>
</tr>
<tr>
<td class="name"><code>pivotA</code></td>
<td class="type">
<span class="param-type"><a href="Array.html">Array</a></span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"><p>The point relative to the center of mass of bodyA which bodyA is constrained to. The value is an array with 2 elements matching x and y, i.e: [32, 32].</p></td>
</tr>
<tr>
<td class="name"><code>bodyB</code></td>
<td class="type">
<span class="param-type"><a href="Phaser.Sprite.html">Phaser.Sprite</a></span>
|
<span class="param-type"><a href="Phaser.Physics.P2.Body.html">Phaser.Physics.P2.Body</a></span>
|
<span class="param-type"><a href="p2.Body.html">p2.Body</a></span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"><p>Second connected body.</p></td>
</tr>
<tr>
<td class="name"><code>pivotB</code></td>
<td class="type">
<span class="param-type"><a href="Array.html">Array</a></span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"><p>The point relative to the center of mass of bodyB which bodyB is constrained to. The value is an array with 2 elements matching x and y, i.e: [32, 32].</p></td>
</tr>
<tr>
<td class="name"><code>maxForce</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
0
</td>
<td class="description last"><p>The maximum force that should be applied to constrain the bodies.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="World.js.html">physics/p2/World.js</a>, <a href="World.js.html#sunlight-1-line-849">line 849</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>The constraint</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type"><a href="Phaser.Physics.P2.RevoluteConstraint.html">Phaser.Physics.P2.RevoluteConstraint</a></span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="createSpring"><span class="type-signature"></span>createSpring<span class="signature">(bodyA, bodyB, <span class="optional">restLength</span>, <span class="optional">stiffness</span>, <span class="optional">damping</span>, <span class="optional">restLength</span>, <span class="optional">stiffness</span>, <span class="optional">damping</span>, <span class="optional">worldA</span>, <span class="optional">worldB</span>, <span class="optional">localA</span>, <span class="optional">localB</span>)</span><span class="type-signature"> &rarr; {<a href="Phaser.Physics.P2.Spring.html">Phaser.Physics.P2.Spring</a>}</span></h4>
</dt>
<dd>
<div class="description">
<p>Creates a spring, connecting two bodies. A spring can have a resting length, a stiffness and damping.</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Argument</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>bodyA</code></td>
<td class="type">
<span class="param-type"><a href="Phaser.Sprite.html">Phaser.Sprite</a></span>
|
<span class="param-type"><a href="Phaser.Physics.P2.Body.html">Phaser.Physics.P2.Body</a></span>
|
<span class="param-type"><a href="p2.Body.html">p2.Body</a></span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"><p>First connected body.</p></td>
</tr>
<tr>
<td class="name"><code>bodyB</code></td>
<td class="type">
<span class="param-type"><a href="Phaser.Sprite.html">Phaser.Sprite</a></span>
|
<span class="param-type"><a href="Phaser.Physics.P2.Body.html">Phaser.Physics.P2.Body</a></span>
|
<span class="param-type"><a href="p2.Body.html">p2.Body</a></span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"><p>Second connected body.</p></td>
</tr>
<tr>
<td class="name"><code>restLength</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
1
</td>
<td class="description last"><p>Rest length of the spring. A number &gt; 0.</p></td>
</tr>
<tr>
<td class="name"><code>stiffness</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
100
</td>
<td class="description last"><p>Stiffness of the spring. A number &gt;= 0.</p></td>
</tr>
<tr>
<td class="name"><code>damping</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
1
</td>
<td class="description last"><p>Damping of the spring. A number &gt;= 0.</p></td>
</tr>
<tr>
<td class="name"><code>restLength</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
1
</td>
<td class="description last"><p>Rest length of the spring. A number &gt; 0.</p></td>
</tr>
<tr>
<td class="name"><code>stiffness</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
100
</td>
<td class="description last"><p>Stiffness of the spring. A number &gt;= 0.</p></td>
</tr>
<tr>
<td class="name"><code>damping</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
1
</td>
<td class="description last"><p>Damping of the spring. A number &gt;= 0.</p></td>
</tr>
<tr>
<td class="name"><code>worldA</code></td>
<td class="type">
<span class="param-type"><a href="Array.html">Array</a></span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
</td>
<td class="description last"><p>Where to hook the spring to body A in world coordinates. This value is an array by 2 elements, x and y, i.e: [32, 32].</p></td>
</tr>
<tr>
<td class="name"><code>worldB</code></td>
<td class="type">
<span class="param-type"><a href="Array.html">Array</a></span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
</td>
<td class="description last"><p>Where to hook the spring to body B in world coordinates. This value is an array by 2 elements, x and y, i.e: [32, 32].</p></td>
</tr>
<tr>
<td class="name"><code>localA</code></td>
<td class="type">
<span class="param-type"><a href="Array.html">Array</a></span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
</td>
<td class="description last"><p>Where to hook the spring to body A in local body coordinates. This value is an array by 2 elements, x and y, i.e: [32, 32].</p></td>
</tr>
<tr>
<td class="name"><code>localB</code></td>
<td class="type">
<span class="param-type"><a href="Array.html">Array</a></span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
</td>
<td class="description last"><p>Where to hook the spring to body B in local body coordinates. This value is an array by 2 elements, x and y, i.e: [32, 32].</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="World.js.html">physics/p2/World.js</a>, <a href="World.js.html#sunlight-1-line-1297">line 1297</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>The spring</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type"><a href="Phaser.Physics.P2.Spring.html">Phaser.Physics.P2.Spring</a></span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="destroy"><span class="type-signature"></span>destroy<span class="signature">()</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>Clears all bodies from the simulation and unlinks World from Game. Should only be called on game shutdown. Call <code>clear</code> on a State change.</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="World.js.html">physics/p2/World.js</a>, <a href="World.js.html#sunlight-1-line-706">line 706</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="enable"><span class="type-signature"></span>enable<span class="signature">(object, <span class="optional">debug</span>, <span class="optional">children</span>)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>This will create a P2 Physics body on the given game object or array of game objects.
A game object can only have 1 physics body active at any one time, and it can't be changed until the object is destroyed.
Note: When the game object is enabled for P2 physics it has its anchor x/y set to 0.5 so it becomes centered.</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Argument</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>object</code></td>
<td class="type">
<span class="param-type">object</span>
|
<span class="param-type">array</span>
|
<span class="param-type"><a href="Phaser.Group.html">Phaser.Group</a></span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"><p>The game object to create the physics body on. Can also be an array or Group of objects, a body will be created on every child that has a <code>body</code> property.</p></td>
</tr>
<tr>
<td class="name"><code>debug</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
false
</td>
<td class="description last"><p>Create a debug object to go with this body?</p></td>
</tr>
<tr>
<td class="name"><code>children</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
true
</td>
<td class="description last"><p>Should a body be created on all children of this object? If true it will recurse down the display list as far as it can go.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="World.js.html">physics/p2/World.js</a>, <a href="World.js.html#sunlight-1-line-217">line 217</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="enableBody"><span class="type-signature"></span>enableBody<span class="signature">(object, debug)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>Creates a P2 Physics body on the given game object.
A game object can only have 1 physics body active at any one time, and it can't be changed until the body is nulled.</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>object</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="description last"><p>The game object to create the physics body on. A body will only be created if this object has a null <code>body</code> property.</p></td>
</tr>
<tr>
<td class="name"><code>debug</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="description last"><p>Create a debug object to go with this body?</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="World.js.html">physics/p2/World.js</a>, <a href="World.js.html#sunlight-1-line-276">line 276</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="endContactHandler"><span class="type-signature"></span>endContactHandler<span class="signature">(event)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>Handles a p2 end contact event.</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>event</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="description last"><p>The event data.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="World.js.html">physics/p2/World.js</a>, <a href="World.js.html#sunlight-1-line-426">line 426</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="getBodies"><span class="type-signature"></span>getBodies<span class="signature">()</span><span class="type-signature"> &rarr; {array.&lt;<a href="Phaser.Physics.P2.Body.html">Phaser.Physics.P2.Body</a>>}</span></h4>
</dt>
<dd>
<div class="description">
<p>Populates and returns an array with references to of all current Bodies in the world.</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="World.js.html">physics/p2/World.js</a>, <a href="World.js.html#sunlight-1-line-1081">line 1081</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>An array containing all current Bodies in the world.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">array.&lt;<a href="Phaser.Physics.P2.Body.html">Phaser.Physics.P2.Body</a>></span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="getBody"><span class="type-signature"></span>getBody<span class="signature">(object)</span><span class="type-signature"> &rarr; {<a href="p2.Body.html">p2.Body</a>}</span></h4>
</dt>
<dd>
<div class="description">
<p>Checks the given object to see if it has a p2.Body and if so returns it.</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>object</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="description last"><p>The object to check for a p2.Body on.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="World.js.html">physics/p2/World.js</a>, <a href="World.js.html#sunlight-1-line-1101">line 1101</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>The p2.Body, or null if not found.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type"><a href="p2.Body.html">p2.Body</a></span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="getConstraints"><span class="type-signature"></span>getConstraints<span class="signature">()</span><span class="type-signature"> &rarr; {array.&lt;Phaser.Physics.P2.Constraint>}</span></h4>
</dt>
<dd>
<div class="description">
<p>Populates and returns an array of all current Constraints in the world.</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="World.js.html">physics/p2/World.js</a>, <a href="World.js.html#sunlight-1-line-1150">line 1150</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>An array containing all current Constraints in the world.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">array.&lt;Phaser.Physics.P2.Constraint></span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="getContactMaterial"><span class="type-signature"></span>getContactMaterial<span class="signature">(materialA, materialB)</span><span class="type-signature"> &rarr; {<a href="Phaser.Physics.P2.ContactMaterial.html">Phaser.Physics.P2.ContactMaterial</a>|boolean}</span></h4>
</dt>
<dd>
<div class="description">
<p>Gets a Contact Material based on the two given Materials.</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>materialA</code></td>
<td class="type">
<span class="param-type"><a href="Phaser.Physics.P2.Material.html">Phaser.Physics.P2.Material</a></span>
</td>
<td class="description last"><p>The first Material to search for.</p></td>
</tr>
<tr>
<td class="name"><code>materialB</code></td>
<td class="type">
<span class="param-type"><a href="Phaser.Physics.P2.Material.html">Phaser.Physics.P2.Material</a></span>
</td>
<td class="description last"><p>The second Material to search for.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="World.js.html">physics/p2/World.js</a>, <a href="World.js.html#sunlight-1-line-1002">line 1002</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>The Contact Material or false if none was found matching the Materials given.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type"><a href="Phaser.Physics.P2.ContactMaterial.html">Phaser.Physics.P2.ContactMaterial</a></span>
|
<span class="param-type">boolean</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="getSprings"><span class="type-signature"></span>getSprings<span class="signature">()</span><span class="type-signature"> &rarr; {array.&lt;<a href="Phaser.Physics.P2.Spring.html">Phaser.Physics.P2.Spring</a>>}</span></h4>
</dt>
<dd>
<div class="description">
<p>Populates and returns an array of all current Springs in the world.</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="World.js.html">physics/p2/World.js</a>, <a href="World.js.html#sunlight-1-line-1130">line 1130</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>An array containing all current Springs in the world.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">array.&lt;<a href="Phaser.Physics.P2.Spring.html">Phaser.Physics.P2.Spring</a>></span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="hitTest"><span class="type-signature"></span>hitTest<span class="signature">(worldPoint, <span class="optional">bodies</span>, <span class="optional">precision</span>, <span class="optional">filterStatic</span>)</span><span class="type-signature"> &rarr; {<a href="Array.html">Array</a>}</span></h4>
</dt>
<dd>
<div class="description">
<p>Test if a world point overlaps bodies. You will get an array of actual P2 bodies back. You can find out which Sprite a Body belongs to
(if any) by checking the Body.parent.sprite property. Body.parent is a Phaser.Physics.P2.Body property.</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Argument</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>worldPoint</code></td>
<td class="type">
<span class="param-type"><a href="Phaser.Point.html">Phaser.Point</a></span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"><p>Point to use for intersection tests. The points values must be in world (pixel) coordinates.</p></td>
</tr>
<tr>
<td class="name"><code>bodies</code></td>
<td class="type">
<span class="param-type"><a href="Array.html">Array</a>.&lt;(<a href="Phaser.Physics.P2.Body.html">Phaser.Physics.P2.Body</a>|<a href="Phaser.Sprite.html">Phaser.Sprite</a>|<a href="p2.Body.html">p2.Body</a>)></span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
</td>
<td class="description last"><p>A list of objects to check for intersection. If not given it will check Phaser.Physics.P2.world.bodies (i.e. all world bodies)</p></td>
</tr>
<tr>
<td class="name"><code>precision</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
5
</td>
<td class="description last"><p>Used for matching against particles and lines. Adds some margin to these infinitesimal objects.</p></td>
</tr>
<tr>
<td class="name"><code>filterStatic</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
false
</td>
<td class="description last"><p>If true all Static objects will be removed from the results array.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="World.js.html">physics/p2/World.js</a>, <a href="World.js.html#sunlight-1-line-1170">line 1170</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Array of bodies that overlap the point.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type"><a href="Array.html">Array</a></span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="mpx"><span class="type-signature"></span>mpx<span class="signature">(v)</span><span class="type-signature"> &rarr; {number}</span></h4>
</dt>
<dd>
<div class="description">
<p>Convert p2 physics value (meters) to pixel scale.
By default Phaser uses a scale of 20px per meter.
If you need to modify this you can over-ride these functions via the Physics Configuration object.</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>v</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>The value to convert.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="World.js.html">physics/p2/World.js</a>, <a href="World.js.html#sunlight-1-line-1566">line 1566</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>The scaled value.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">number</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="mpxi"><span class="type-signature"></span>mpxi<span class="signature">(v)</span><span class="type-signature"> &rarr; {number}</span></h4>
</dt>
<dd>
<div class="description">
<p>Convert p2 physics value (meters) to pixel scale and inverses it.
By default Phaser uses a scale of 20px per meter.
If you need to modify this you can over-ride these functions via the Physics Configuration object.</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>v</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>The value to convert.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="World.js.html">physics/p2/World.js</a>, <a href="World.js.html#sunlight-1-line-1596">line 1596</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>The scaled value.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">number</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="pause"><span class="type-signature"></span>pause<span class="signature">()</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>Pauses the P2 World independent of the game pause state.</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="World.js.html">physics/p2/World.js</a>, <a href="World.js.html#sunlight-1-line-637">line 637</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="preUpdate"><span class="type-signature"></span>preUpdate<span class="signature">()</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>Called at the start of the core update loop. Purges flagged bodies from the world.</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="World.js.html">physics/p2/World.js</a>, <a href="World.js.html#sunlight-1-line-199">line 199</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="pxm"><span class="type-signature"></span>pxm<span class="signature">(v)</span><span class="type-signature"> &rarr; {number}</span></h4>
</dt>
<dd>
<div class="description">
<p>Convert pixel value to p2 physics scale (meters).
By default Phaser uses a scale of 20px per meter.
If you need to modify this you can over-ride these functions via the Physics Configuration object.</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>v</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>The value to convert.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="World.js.html">physics/p2/World.js</a>, <a href="World.js.html#sunlight-1-line-1581">line 1581</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>The scaled value.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">number</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="pxmi"><span class="type-signature"></span>pxmi<span class="signature">(v)</span><span class="type-signature"> &rarr; {number}</span></h4>
</dt>
<dd>
<div class="description">
<p>Convert pixel value to p2 physics scale (meters) and inverses it.
By default Phaser uses a scale of 20px per meter.
If you need to modify this you can over-ride these functions via the Physics Configuration object.</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>v</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>The value to convert.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="World.js.html">physics/p2/World.js</a>, <a href="World.js.html#sunlight-1-line-1611">line 1611</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>The scaled value.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">number</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="removeBody"><span class="type-signature"></span>removeBody<span class="signature">(body)</span><span class="type-signature"> &rarr; {<a href="Phaser.Physics.P2.Body.html">Phaser.Physics.P2.Body</a>}</span></h4>
</dt>
<dd>
<div class="description">
<p>Removes a body from the world. This will silently fail if the body wasn't part of the world to begin with.</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>body</code></td>
<td class="type">
<span class="param-type"><a href="Phaser.Physics.P2.Body.html">Phaser.Physics.P2.Body</a></span>
</td>
<td class="description last"><p>The Body to remove from the World.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="World.js.html">physics/p2/World.js</a>, <a href="World.js.html#sunlight-1-line-743">line 743</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>The Body that was removed.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type"><a href="Phaser.Physics.P2.Body.html">Phaser.Physics.P2.Body</a></span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="removeBodyNextStep"><span class="type-signature"></span>removeBodyNextStep<span class="signature">(body)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>This will add a P2 Physics body into the removal list for the next step.</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>body</code></td>
<td class="type">
<span class="param-type"><a href="Phaser.Physics.P2.Body.html">Phaser.Physics.P2.Body</a></span>
</td>
<td class="description last"><p>The body to remove at the start of the next step.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="World.js.html">physics/p2/World.js</a>, <a href="World.js.html#sunlight-1-line-187">line 187</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="removeConstraint"><span class="type-signature"></span>removeConstraint<span class="signature">(constraint)</span><span class="type-signature"> &rarr; {Phaser.Physics.P2.Constraint}</span></h4>
</dt>
<dd>
<div class="description">
<p>Removes a Constraint from the world.</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>constraint</code></td>
<td class="type">
<span class="param-type">Phaser.Physics.P2.Constraint</span>
</td>
<td class="description last"><p>The Constraint to be removed from the World.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="World.js.html">physics/p2/World.js</a>, <a href="World.js.html#sunlight-1-line-951">line 951</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>The Constraint that was removed.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Phaser.Physics.P2.Constraint</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="removeContactMaterial"><span class="type-signature"></span>removeContactMaterial<span class="signature">(material)</span><span class="type-signature"> &rarr; {<a href="Phaser.Physics.P2.ContactMaterial.html">Phaser.Physics.P2.ContactMaterial</a>}</span></h4>
</dt>
<dd>
<div class="description">
<p>Removes a Contact Material from the world.</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>material</code></td>
<td class="type">
<span class="param-type"><a href="Phaser.Physics.P2.ContactMaterial.html">Phaser.Physics.P2.ContactMaterial</a></span>
</td>
<td class="description last"><p>The Contact Material to be removed from the World.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="World.js.html">physics/p2/World.js</a>, <a href="World.js.html#sunlight-1-line-985">line 985</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>The Contact Material that was removed.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type"><a href="Phaser.Physics.P2.ContactMaterial.html">Phaser.Physics.P2.ContactMaterial</a></span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="removeSpring"><span class="type-signature"></span>removeSpring<span class="signature">(spring)</span><span class="type-signature"> &rarr; {<a href="Phaser.Physics.P2.Spring.html">Phaser.Physics.P2.Spring</a>}</span></h4>
</dt>
<dd>
<div class="description">
<p>Removes a Spring from the world.</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>spring</code></td>
<td class="type">
<span class="param-type"><a href="Phaser.Physics.P2.Spring.html">Phaser.Physics.P2.Spring</a></span>
</td>
<td class="description last"><p>The Spring to remove from the World.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="World.js.html">physics/p2/World.js</a>, <a href="World.js.html#sunlight-1-line-780">line 780</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>The Spring that was removed.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type"><a href="Phaser.Physics.P2.Spring.html">Phaser.Physics.P2.Spring</a></span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="resume"><span class="type-signature"></span>resume<span class="signature">()</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>Resumes a paused P2 World.</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="World.js.html">physics/p2/World.js</a>, <a href="World.js.html#sunlight-1-line-648">line 648</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="setBounds"><span class="type-signature"></span>setBounds<span class="signature">(x, y, width, height, <span class="optional">left</span>, <span class="optional">right</span>, <span class="optional">top</span>, <span class="optional">bottom</span>, <span class="optional">setCollisionGroup</span>)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>Sets the bounds of the Physics world to match the given world pixel dimensions.
You can optionally set which 'walls' to create: left, right, top or bottom.</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Argument</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>x</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"><p>The x coordinate of the top-left corner of the bounds.</p></td>
</tr>
<tr>
<td class="name"><code>y</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"><p>The y coordinate of the top-left corner of the bounds.</p></td>
</tr>
<tr>
<td class="name"><code>width</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"><p>The width of the bounds.</p></td>
</tr>
<tr>
<td class="name"><code>height</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"><p>The height of the bounds.</p></td>
</tr>
<tr>
<td class="name"><code>left</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
true
</td>
<td class="description last"><p>If true will create the left bounds wall.</p></td>
</tr>
<tr>
<td class="name"><code>right</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
true
</td>
<td class="description last"><p>If true will create the right bounds wall.</p></td>
</tr>
<tr>
<td class="name"><code>top</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
true
</td>
<td class="description last"><p>If true will create the top bounds wall.</p></td>
</tr>
<tr>
<td class="name"><code>bottom</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
true
</td>
<td class="description last"><p>If true will create the bottom bounds wall.</p></td>
</tr>
<tr>
<td class="name"><code>setCollisionGroup</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
true
</td>
<td class="description last"><p>If true the Bounds will be set to use its own Collision Group.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="World.js.html">physics/p2/World.js</a>, <a href="World.js.html#sunlight-1-line-540">line 540</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="setImpactEvents"><span class="type-signature"></span>setImpactEvents<span class="signature">(state)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>Impact event handling is disabled by default. Enable it before any impact events will be dispatched.
In a busy world hundreds of impact events can be generated every step, so only enable this if you cannot do what you need via beginContact or collision masks.</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>state</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="description last"><p>Set to true to enable impact events, or false to disable.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="World.js.html">physics/p2/World.js</a>, <a href="World.js.html#sunlight-1-line-295">line 295</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="setMaterial"><span class="type-signature"></span>setMaterial<span class="signature">(material, bodies)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>Sets the given Material against all Shapes owned by all the Bodies in the given array.</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>material</code></td>
<td class="type">
<span class="param-type"><a href="Phaser.Physics.P2.Material.html">Phaser.Physics.P2.Material</a></span>
</td>
<td class="description last"><p>The Material to be applied to the given Bodies.</p></td>
</tr>
<tr>
<td class="name"><code>bodies</code></td>
<td class="type">
<span class="param-type">array.&lt;<a href="Phaser.Physics.P2.Body.html">Phaser.Physics.P2.Body</a>></span>
</td>
<td class="description last"><p>An Array of Body objects that the given Material will be set on.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="World.js.html">physics/p2/World.js</a>, <a href="World.js.html#sunlight-1-line-1016">line 1016</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="setPostBroadphaseCallback"><span class="type-signature"></span>setPostBroadphaseCallback<span class="signature">(callback, context)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>Sets a callback to be fired after the Broadphase has collected collision pairs in the world.
Just because a pair exists it doesn't mean they <em>will</em> collide, just that they potentially could do.
If your calback returns <code>false</code> the pair will be removed from the narrowphase. This will stop them testing for collision this step.
Returning <code>true</code> from the callback will ensure they are checked in the narrowphase.</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>callback</code></td>
<td class="type">
<span class="param-type">function</span>
</td>
<td class="description last"><p>The callback that will receive the postBroadphase event data. It must return a boolean. Set to null to disable an existing callback.</p></td>
</tr>
<tr>
<td class="name"><code>context</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="description last"><p>The context under which the callback will be fired.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="World.js.html">physics/p2/World.js</a>, <a href="World.js.html#sunlight-1-line-315">line 315</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="toJSON"><span class="type-signature"></span>toJSON<span class="signature">()</span><span class="type-signature"> &rarr; {object}</span></h4>
</dt>
<dd>
<div class="description">
<p>Converts the current world into a JSON object.</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="World.js.html">physics/p2/World.js</a>, <a href="World.js.html#sunlight-1-line-1212">line 1212</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>A JSON representation of the world.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">object</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="update"><span class="type-signature"></span>update<span class="signature">()</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>Internal P2 update loop.</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="World.js.html">physics/p2/World.js</a>, <a href="World.js.html#sunlight-1-line-659">line 659</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="updateBoundsCollisionGroup"><span class="type-signature"></span>updateBoundsCollisionGroup<span class="signature">(<span class="optional">setCollisionGroup</span>)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>By default the World will be set to collide everything with everything. The bounds of the world is a Body with 4 shapes, one for each face.
If you start to use your own collision groups then your objects will no longer collide with the bounds.
To fix this you need to adjust the bounds to use its own collision group first BEFORE changing your Sprites collision group.</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Argument</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>setCollisionGroup</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
true
</td>
<td class="description last"><p>If true the Bounds will be set to use its own Collision Group.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="World.js.html">physics/p2/World.js</a>, <a href="World.js.html#sunlight-1-line-504">line 504</a>
</li></ul></dd>
</dl>
</dd>
</dl>
</article>
</section>
</div>
<div class="clearfix"></div>
<footer>
<span class="copyright">
Phaser Copyright © 2012-2014 Photon Storm Ltd.
</span>
<br />
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-dev</a>
on Thu Jul 10 2014 20:19:08 GMT+0100 (BST) using the <a href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
</span>
</footer>
</div>
<div class="span3">
<div id="toc"></div>
</div>
<br clear="both">
</div>
</div>
<script src="scripts/sunlight.js"></script>
<script src="scripts/sunlight.javascript.js"></script>
<script src="scripts/sunlight-plugin.doclinks.js"></script>
<script src="scripts/sunlight-plugin.linenumbers.js"></script>
<script src="scripts/sunlight-plugin.menu.js"></script>
<script src="scripts/jquery.min.js"></script>
<script src="scripts/jquery.scrollTo.js"></script>
<script src="scripts/jquery.localScroll.js"></script>
<script src="scripts/bootstrap-dropdown.js"></script>
<script src="scripts/toc.js"></script>
<script> Sunlight.highlightAll({lineNumbers:true, showMenu: true, enableDoclinks :true}); </script>
<script>
$( function () {
$( "#toc" ).toc( {
anchorName : function(i, heading, prefix) {
return $(heading).attr("id") || ( prefix + i );
},
selectors : "h1,h2,h3,h4",
showAndHide : false,
scrollTo : 60
} );
$( "#toc>ul" ).addClass( "nav nav-pills nav-stacked" );
$( "#main span[id^='toc']" ).addClass( "toc-shim" );
} );
</script>
</body>
</html>