phaser/docs/Phaser.Physics.P2.Body.html

12665 lines
176 KiB
HTML
Raw Normal View History

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Phaser Class: Body</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 ">
2014-04-10 22:13:43 +00:00
<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 ">
2014-04-10 22:13:43 +00:00
<li class="class-depth-1">
<a href="Phaser.Animation.html">Animation</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-1">
<a href="Phaser.AnimationManager.html">AnimationManager</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-1">
<a href="Phaser.AnimationParser.html">AnimationParser</a>
</li>
2014-04-29 14:39:02 +00:00
<li class="class-depth-1">
<a href="Phaser.ArrayList.html">ArrayList</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-1">
<a href="Phaser.BitmapData.html">BitmapData</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-1">
<a href="Phaser.BitmapText.html">BitmapText</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-1">
<a href="Phaser.Button.html">Button</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-1">
<a href="Phaser.Cache.html">Cache</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-1">
<a href="Phaser.Camera.html">Camera</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-1">
<a href="Phaser.Canvas.html">Canvas</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-1">
<a href="Phaser.Circle.html">Circle</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-1">
<a href="Phaser.Color.html">Color</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-1">
<a href="Phaser.Device.html">Device</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-1">
<a href="Phaser.Easing.html">Easing</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-2">
<a href="Phaser.Easing.Back.html">Back</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-2">
<a href="Phaser.Easing.Bounce.html">Bounce</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-2">
<a href="Phaser.Easing.Circular.html">Circular</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-2">
<a href="Phaser.Easing.Cubic.html">Cubic</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-2">
<a href="Phaser.Easing.Elastic.html">Elastic</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-2">
<a href="Phaser.Easing.Exponential.html">Exponential</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-2">
<a href="Phaser.Easing.Linear.html">Linear</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-2">
<a href="Phaser.Easing.Quadratic.html">Quadratic</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-2">
<a href="Phaser.Easing.Quartic.html">Quartic</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-2">
<a href="Phaser.Easing.Quintic.html">Quintic</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-2">
<a href="Phaser.Easing.Sinusoidal.html">Sinusoidal</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-1">
<a href="Phaser.Ellipse.html">Ellipse</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-1">
<a href="Phaser.Events.html">Events</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-1">
<a href="Phaser.Filter.html">Filter</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-1">
<a href="Phaser.Frame.html">Frame</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-1">
<a href="Phaser.FrameData.html">FrameData</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-1">
<a href="Phaser.Game.html">Game</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-1">
<a href="Phaser.GameObjectCreator.html">GameObjectCreator</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-1">
<a href="Phaser.GameObjectFactory.html">GameObjectFactory</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-1">
<a href="Phaser.Gamepad.html">Gamepad</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-1">
<a href="Phaser.GamepadButton.html">GamepadButton</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-1">
<a href="Phaser.Graphics.html">Graphics</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-1">
<a href="Phaser.Group.html">Group</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-1">
<a href="Phaser.Image.html">Image</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-1">
<a href="Phaser.Input.html">Input</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-1">
<a href="Phaser.InputHandler.html">InputHandler</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-1">
<a href="Phaser.Key.html">Key</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-1">
<a href="Phaser.Keyboard.html">Keyboard</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-1">
<a href="Phaser.Line.html">Line</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-1">
<a href="Phaser.LinkedList.html">LinkedList</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-1">
<a href="Phaser.Loader.html">Loader</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-1">
<a href="Phaser.LoaderParser.html">LoaderParser</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-1">
<a href="Phaser.Math.html">Math</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-1">
<a href="Phaser.Mouse.html">Mouse</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-1">
<a href="Phaser.MSPointer.html">MSPointer</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-1">
<a href="Phaser.Net.html">Net</a>
</li>
2014-04-10 22:13:43 +00:00
<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>
2014-04-10 22:13:43 +00:00
<li class="class-depth-3">
<a href="Phaser.Particles.Arcade.Emitter.html">Emitter</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-1">
<a href="Phaser.Physics.html">Physics</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-2">
<a href="Phaser.Physics.Arcade.html">Arcade</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-3">
<a href="Phaser.Physics.Arcade.Body.html">Body</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-2">
<a href="Phaser.Physics.Ninja.html">Ninja</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-3">
<a href="Phaser.Physics.Ninja.AABB.html">AABB</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-3">
<a href="Phaser.Physics.Ninja.Body.html">Body</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-3">
<a href="Phaser.Physics.Ninja.Circle.html">Circle</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-3">
<a href="Phaser.Physics.Ninja.Tile.html">Tile</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-2">
<a href="Phaser.Physics.P2.html">P2</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-3">
<a href="Phaser.Physics.P2.Body.html">Body</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-3">
<a href="Phaser.Physics.P2.BodyDebug.html">BodyDebug</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-3">
<a href="Phaser.Physics.P2.CollisionGroup.html">CollisionGroup</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-3">
<a href="Phaser.Physics.P2.ContactMaterial.html">ContactMaterial</a>
</li>
2014-04-10 22:13:43 +00:00
<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>
2014-04-10 22:13:43 +00:00
<li class="class-depth-3">
<a href="Phaser.Physics.P2.GearConstraint.html">GearConstraint</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-3">
<a href="Phaser.Physics.P2.InversePointProxy.html">InversePointProxy</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-3">
<a href="Phaser.Physics.P2.LockConstraint.html">LockConstraint</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-3">
<a href="Phaser.Physics.P2.Material.html">Material</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-3">
<a href="Phaser.Physics.P2.PointProxy.html">PointProxy</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-3">
<a href="Phaser.Physics.P2.PrismaticConstraint.html">PrismaticConstraint</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-3">
<a href="Phaser.Physics.P2.RevoluteConstraint.html">RevoluteConstraint</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-3">
<a href="Phaser.Physics.P2.Spring.html">Spring</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-1">
<a href="Phaser.Plugin.html">Plugin</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-1">
<a href="Phaser.PluginManager.html">PluginManager</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-1">
<a href="Phaser.Point.html">Point</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-1">
<a href="Phaser.Pointer.html">Pointer</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-1">
<a href="Phaser.Polygon.html">Polygon</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-1">
<a href="Phaser.QuadTree.html">QuadTree</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-1">
<a href="Phaser.RandomDataGenerator.html">RandomDataGenerator</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-1">
<a href="Phaser.Rectangle.html">Rectangle</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-1">
<a href="Phaser.RenderTexture.html">RenderTexture</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-1">
<a href="Phaser.RequestAnimationFrame.html">RequestAnimationFrame</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-1">
<a href="Phaser.RetroFont.html">RetroFont</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-1">
<a href="Phaser.ScaleManager.html">ScaleManager</a>
</li>
2014-04-10 22:13:43 +00:00
<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>
2014-04-10 22:13:43 +00:00
<li class="class-depth-1">
<a href="Phaser.SinglePad.html">SinglePad</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-1">
<a href="Phaser.Sound.html">Sound</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-1">
<a href="Phaser.SoundManager.html">SoundManager</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-1">
<a href="Phaser.Sprite.html">Sprite</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-1">
<a href="Phaser.SpriteBatch.html">SpriteBatch</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-1">
<a href="Phaser.Stage.html">Stage</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-1">
<a href="Phaser.State.html">State</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-1">
<a href="Phaser.StateManager.html">StateManager</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-1">
<a href="Phaser.Text.html">Text</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-1">
<a href="Phaser.Tile.html">Tile</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-1">
<a href="Phaser.Tilemap.html">Tilemap</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-1">
<a href="Phaser.TilemapLayer.html">TilemapLayer</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-1">
<a href="Phaser.TilemapParser.html">TilemapParser</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-1">
<a href="Phaser.Tileset.html">Tileset</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-1">
<a href="Phaser.TileSprite.html">TileSprite</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-1">
<a href="Phaser.Time.html">Time</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-1">
<a href="Phaser.Timer.html">Timer</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-1">
<a href="Phaser.TimerEvent.html">TimerEvent</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-1">
<a href="Phaser.Touch.html">Touch</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-1">
<a href="Phaser.Tween.html">Tween</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-1">
<a href="Phaser.TweenManager.html">TweenManager</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-1">
<a href="Phaser.Utils.html">Utils</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-2">
<a href="Phaser.Utils.Debug.html">Debug</a>
</li>
2014-04-10 22:13:43 +00:00
<li class="class-depth-1">
<a href="Phaser.World.html">World</a>
</li>
</ul>
</li>
2014-07-18 11:45:51 +00:00
</strong>
</ul>
</div>
</div>
<div class="row-fluid">
<div class="span8">
<div id="main">
<h1 class="page-title">Class: Body</h1>
<section>
<header>
<h2>
<span class="ancestors"><a href="Phaser.html">Phaser</a><a href="Phaser.Physics.html">.Physics</a><a href="Phaser.Physics.P2.html">.P2</a>.</span>
Body
</h2>
<div class="class-description"><p>Physics Body Constructor</p></div>
</header>
<article>
<div class="container-overview">
<dt>
<h4 class="name" id="Body"><span class="type-signature"></span>new Body<span class="signature">(game, <span class="optional">sprite</span>, <span class="optional">x</span>, <span class="optional">y</span>, <span class="optional">mass</span>)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>The Physics Body is typically linked to a single Sprite and defines properties that determine how the physics body is simulated.
These properties affect how the body reacts to forces, what forces it generates on itself (to simulate friction), and how it reacts to collisions in the scene.
In most cases, the properties are used to simulate physical effects. Each body also has its own property values that determine exactly how it reacts to forces and collisions in the scene.
By default a single Rectangle shape is added to the Body that matches the dimensions of the parent Sprite. See addShape, removeShape, clearShapes to add extra shapes around the Body.
2014-07-10 19:31:11 +00:00
Note: When bound to a Sprite to avoid single-pixel jitters on mobile devices we strongly recommend using Sprite sizes that are even on both axis, i.e. 128x128 not 127x127.
Note: When a game object is given a P2 body 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>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="default">
</td>
<td class="description last"><p>Game reference to the currently running game.</p></td>
</tr>
<tr>
<td class="name"><code>sprite</code></td>
<td class="type">
<span class="param-type"><a href="Phaser.Sprite.html">Phaser.Sprite</a></span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
</td>
<td class="description last"><p>The Sprite object this physics body belongs to.</p></td>
</tr>
<tr>
<td class="name"><code>x</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 x coordinate of this 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">
&lt;optional><br>
</td>
<td class="default">
0
</td>
<td class="description last"><p>The y coordinate of this 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">
&lt;optional><br>
</td>
<td class="default">
1
</td>
<td class="description last"><p>The default mass of this Body (0 = static).</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
2014-07-10 19:31:11 +00:00
<a href="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-24">line 24</a>
</li></ul></dd>
</dl>
</dd>
</div>
<h3 class="subsection-title">Members</h3>
<dl>
2014-03-24 12:41:45 +00:00
<dt>
<h4 class="name" id="DYNAMIC"><span class="type-signature">&lt;static> </span>DYNAMIC<span class="type-signature"> :Number</span></h4>
</dt>
<dd>
<div class="description">
<p>Dynamic body.</p>
</div>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">Number</span>
</li>
</ul>
<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>DYNAMIC</code></td>
<td class="type">
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
</dl>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
2014-07-18 11:45:51 +00:00
<a href="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-1306">line 1306</a>
2014-03-24 12:41:45 +00:00
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="KINEMATIC"><span class="type-signature">&lt;static> </span>KINEMATIC<span class="type-signature"> :Number</span></h4>
</dt>
<dd>
<div class="description">
<p>Kinematic body.</p>
</div>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">Number</span>
</li>
</ul>
<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>KINEMATIC</code></td>
<td class="type">
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
</dl>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
2014-07-18 11:45:51 +00:00
<a href="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-1322">line 1322</a>
2014-03-24 12:41:45 +00:00
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="STATIC"><span class="type-signature">&lt;static> </span>STATIC<span class="type-signature"> :Number</span></h4>
</dt>
<dd>
<div class="description">
<p>Static body.</p>
</div>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">Number</span>
</li>
</ul>
<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>STATIC</code></td>
<td class="type">
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
</dl>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
2014-07-18 11:45:51 +00:00
<a href="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-1314">line 1314</a>
2014-03-24 12:41:45 +00:00
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="allowSleep"><span class="type-signature"></span>allowSleep<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>allowSleep</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="description last"><p>-</p></td>
</tr>
</tbody>
</table>
</dl>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
2014-07-18 11:45:51 +00:00
<a href="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-1419">line 1419</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="angle"><span class="type-signature"></span>angle<span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>The angle of the Body in degrees from its original orientation. Values from 0 to 180 represent clockwise rotation; values from 0 to -180 represent counterclockwise rotation.
Values outside this range are added to or subtracted from 360 to obtain a value within the range. For example, the statement Body.angle = 450 is the same as Body.angle = 90.
If you wish to work in radians instead of degrees use the property Body.rotation instead. Working in radians is faster as it doesn't have to convert values.</p>
</div>
<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>angle</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>The angle of this Body in degrees.</p></td>
</tr>
</tbody>
</table>
</dl>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
2014-07-18 11:45:51 +00:00
<a href="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-1442">line 1442</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="angularDamping"><span class="type-signature"></span>angularDamping<span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>Damping is specified as a value between 0 and 1, which is the proportion of velocity lost per second.</p>
</div>
<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>angularDamping</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>The angular damping acting acting on the body.</p></td>
</tr>
</tbody>
</table>
</dl>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
2014-07-18 11:45:51 +00:00
<a href="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-1466">line 1466</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="angularForce"><span class="type-signature"></span>angularForce<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>angularForce</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>The angular force acting on the body.</p></td>
</tr>
</tbody>
</table>
</dl>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
2014-07-18 11:45:51 +00:00
<a href="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-1487">line 1487</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="angularVelocity"><span class="type-signature"></span>angularVelocity<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>angularVelocity</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>The angular velocity of the body.</p></td>
</tr>
</tbody>
</table>
</dl>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
2014-07-18 11:45:51 +00:00
<a href="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-1507">line 1507</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="collidesWith"><span class="type-signature"></span>collidesWith<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>collidesWith</code></td>
<td class="type">
<span class="param-type">array</span>
</td>
<td class="description last"><p>Array of CollisionGroups that this Bodies shapes collide with.</p></td>
</tr>
</tbody>
</table>
</dl>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
2014-07-10 19:31:11 +00:00
<a href="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-96">line 96</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="collideWorldBounds"><span class="type-signature"></span>collideWorldBounds<span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>A Body can be set to collide against the World bounds automatically if this is set to true. Otherwise it will leave the World.
Note that this only applies if your World has bounds! The response to the collision should be managed via CollisionMaterials.</p>
</div>
<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>collideWorldBounds</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="description last"><p>Should the Body collide with the World bounds?</p></td>
</tr>
</tbody>
</table>
</dl>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
2014-07-18 11:45:51 +00:00
<a href="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-1765">line 1765</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="damping"><span class="type-signature"></span>damping<span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>Damping is specified as a value between 0 and 1, which is the proportion of velocity lost per second.</p>
</div>
<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>damping</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>The linear damping acting on the body in the velocity direction.</p></td>
</tr>
</tbody>
</table>
</dl>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
2014-07-18 11:45:51 +00:00
<a href="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-1527">line 1527</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="data"><span class="type-signature">&lt;protected> </span>data<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>data</code></td>
<td class="type">
<span class="param-type"><a href="p2.Body.html">p2.Body</a></span>
</td>
<td class="description last"><p>The p2 Body data.</p></td>
</tr>
</tbody>
</table>
</dl>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
2014-07-10 19:31:11 +00:00
<a href="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-60">line 60</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="debug"><span class="type-signature"></span>debug<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>debug</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="description last"><p>Enable or disable debug drawing of this body</p></td>
</tr>
</tbody>
</table>
</dl>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
2014-07-18 11:45:51 +00:00
<a href="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-1736">line 1736</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="debugBody"><span class="type-signature"></span>debugBody<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>debugBody</code></td>
<td class="type">
<span class="param-type"><a href="Phaser.Physics.P2.BodyDebug.html">Phaser.Physics.P2.BodyDebug</a></span>
</td>
<td class="description last"><p>Reference to the debug body.</p></td>
</tr>
</tbody>
</table>
</dl>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
2014-07-10 19:31:11 +00:00
<a href="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-106">line 106</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="dynamic"><span class="type-signature"></span>dynamic<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>dynamic</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="description last"><p>Returns true if the Body is dynamic. Setting Body.dynamic to 'false' will make it static.</p></td>
</tr>
</tbody>
</table>
</dl>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
2014-07-18 11:45:51 +00:00
<a href="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-1357">line 1357</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="fixedRotation"><span class="type-signature"></span>fixedRotation<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>fixedRotation</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="description last"><p>-</p></td>
</tr>
</tbody>
</table>
</dl>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
2014-07-18 11:45:51 +00:00
<a href="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-1548">line 1548</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="force"><span class="type-signature"></span>force<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>force</code></td>
<td class="type">
<span class="param-type">Phaser.InversePointProxy</span>
</td>
<td class="description last"><p>The force applied to the body.</p></td>
</tr>
</tbody>
</table>
</dl>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
2014-07-10 19:31:11 +00:00
<a href="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-72">line 72</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>
2014-07-10 19:31:11 +00:00
<a href="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-34">line 34</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.Point.html">Phaser.Point</a></span>
</td>
<td class="description last"><p>A locally applied gravity force to the Body. Applied directly before the world step. NOTE: Not currently implemented.</p></td>
</tr>
</tbody>
</table>
</dl>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
2014-07-10 19:31:11 +00:00
<a href="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-77">line 77</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="id"><span class="type-signature">&lt;readonly> </span>id<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>id</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>The Body ID. Each Body that has been added to the World has a unique ID.</p></td>
</tr>
</tbody>
</table>
</dl>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
2014-07-18 11:45:51 +00:00
<a href="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-1721">line 1721</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="inertia"><span class="type-signature"></span>inertia<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>inertia</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>The inertia of the body around the Z axis..</p></td>
</tr>
</tbody>
</table>
</dl>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
2014-07-18 11:45:51 +00:00
<a href="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-1571">line 1571</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="kinematic"><span class="type-signature"></span>kinematic<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>kinematic</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="description last"><p>Returns true if the Body is kinematic. Setting Body.kinematic to 'false' will make it static.</p></td>
</tr>
</tbody>
</table>
</dl>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
2014-07-18 11:45:51 +00:00
<a href="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-1390">line 1390</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="mass"><span class="type-signature"></span>mass<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>mass</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>-</p></td>
</tr>
</tbody>
</table>
</dl>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
2014-07-18 11:45:51 +00:00
<a href="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-1591">line 1591</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="motionState"><span class="type-signature"></span>motionState<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>motionState</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>The type of motion this body has. Should be one of: Body.STATIC (the body does not move), Body.DYNAMIC (body can move and respond to collisions) and Body.KINEMATIC (only moves according to its .velocity).</p></td>
</tr>
</tbody>
</table>
</dl>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
2014-07-18 11:45:51 +00:00
<a href="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-1615">line 1615</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="offset"><span class="type-signature"></span>offset<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>offset</code></td>
<td class="type">
<span class="param-type"><a href="Phaser.Point.html">Phaser.Point</a></span>
</td>
<td class="description last"><p>The offset of the Physics Body from the Sprite x/y position.</p></td>
</tr>
</tbody>
</table>
</dl>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
2014-07-10 19:31:11 +00:00
<a href="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-54">line 54</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>
<div class="description">
<p>Dispatched when a first contact is created between shapes in two bodies. This event is fired during the step, so collision has already taken place.
The event will be sent 4 parameters: The body it is in contact with, the shape from this body that caused the contact, the shape from the contact body and the contact equation data array.</p>
</div>
<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"></td>
</tr>
</tbody>
</table>
</dl>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
2014-07-10 19:31:11 +00:00
<a href="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-84">line 84</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>
<div class="description">
<p>Dispatched when contact ends between shapes in two bodies. This event is fired during the step, so collision has already taken place.
The event will be sent 3 parameters: The body it is in contact with, the shape from this body that caused the contact and the shape from the contact body.</p>
</div>
<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"></td>
</tr>
</tbody>
</table>
</dl>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
2014-07-10 19:31:11 +00:00
<a href="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-91">line 91</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="removeNextStep"><span class="type-signature"></span>removeNextStep<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>removeNextStep</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="description last"><p>To avoid deleting this body during a physics step, and causing all kinds of problems, set removeNextStep to true to have it removed in the next preUpdate.</p></td>
</tr>
</tbody>
</table>
</dl>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
2014-07-10 19:31:11 +00:00
<a href="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-101">line 101</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="rotation"><span class="type-signature"></span>rotation<span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>The angle of the Body in radians.
If you wish to work in degrees instead of radians use the Body.angle property instead. Working in radians is faster as it doesn't have to convert values.</p>
</div>
<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>rotation</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>The angle of this Body in radians.</p></td>
</tr>
</tbody>
</table>
</dl>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
2014-07-18 11:45:51 +00:00
<a href="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-1638">line 1638</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="sleepSpeedLimit"><span class="type-signature"></span>sleepSpeedLimit<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>sleepSpeedLimit</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>.</p></td>
</tr>
</tbody>
</table>
</dl>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
2014-07-18 11:45:51 +00:00
<a href="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-1661">line 1661</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="sprite"><span class="type-signature"></span>sprite<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>sprite</code></td>
<td class="type">
<span class="param-type"><a href="Phaser.Sprite.html">Phaser.Sprite</a></span>
</td>
<td class="description last"><p>Reference to the parent Sprite.</p></td>
</tr>
</tbody>
</table>
</dl>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
2014-07-10 19:31:11 +00:00
<a href="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-44">line 44</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="static"><span class="type-signature"></span>static<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>static</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="description last"><p>Returns true if the Body is static. Setting Body.static to 'false' will make it dynamic.</p></td>
</tr>
</tbody>
</table>
</dl>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
2014-07-18 11:45:51 +00:00
<a href="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-1324">line 1324</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="type"><span class="type-signature"></span>type<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>type</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>The type of physics system this body belongs to.</p></td>
</tr>
</tbody>
</table>
</dl>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
2014-07-10 19:31:11 +00:00
<a href="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-49">line 49</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="velocity"><span class="type-signature"></span>velocity<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>velocity</code></td>
<td class="type">
<span class="param-type">Phaser.InversePointProxy</span>
</td>
<td class="description last"><p>The velocity of the body. Set velocity.x to a negative value to move to the left, position to the right. velocity.y negative values move up, positive move down.</p></td>
</tr>
</tbody>
</table>
</dl>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
2014-07-10 19:31:11 +00:00
<a href="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-67">line 67</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="world"><span class="type-signature"></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"><a href="Phaser.Physics.P2.html">Phaser.Physics.P2</a></span>
</td>
<td class="description last"><p>Local reference to the P2 World.</p></td>
</tr>
</tbody>
</table>
</dl>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
2014-07-10 19:31:11 +00:00
<a href="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-39">line 39</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="x"><span class="type-signature"></span>x<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>x</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>The x coordinate of this Body.</p></td>
</tr>
</tbody>
</table>
</dl>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
2014-07-18 11:45:51 +00:00
<a href="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-1681">line 1681</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="y"><span class="type-signature"></span>y<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>y</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>The y coordinate of this Body.</p></td>
</tr>
</tbody>
</table>
</dl>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
2014-07-18 11:45:51 +00:00
<a href="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-1701">line 1701</a>
</li></ul></dd>
</dl>
</dd>
</dl>
<h3 class="subsection-title">Methods</h3>
<dl>
<dt>
<h4 class="name" id="addCapsule"><span class="type-signature"></span>addCapsule<span class="signature">(length, radius, <span class="optional">offsetX</span>, <span class="optional">offsetY</span>, <span class="optional">rotation</span>)</span><span class="type-signature"> &rarr; {p2.Capsule}</span></h4>
</dt>
<dd>
<div class="description">
<p>Adds a Capsule shape to this Body.
You can control the offset from the center of the body and the rotation.</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>length</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 distance between the end points in pixels.</p></td>
</tr>
<tr>
<td class="name"><code>radius</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>Radius of the capsule in radians.</p></td>
</tr>
<tr>
<td class="name"><code>offsetX</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>Local horizontal offset of the shape relative to the body center of mass.</p></td>
</tr>
<tr>
<td class="name"><code>offsetY</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>Local vertical offset of the shape relative to the body center of mass.</p></td>
</tr>
<tr>
<td class="name"><code>rotation</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>Local rotation of the shape relative to the body center of mass, specified in radians.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
2014-07-10 19:31:11 +00:00
<a href="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-915">line 915</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>The Capsule shape that was added to the Body.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">p2.Capsule</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="addCircle"><span class="type-signature"></span>addCircle<span class="signature">(radius, <span class="optional">offsetX</span>, <span class="optional">offsetY</span>, <span class="optional">rotation</span>)</span><span class="type-signature"> &rarr; {p2.Circle}</span></h4>
</dt>
<dd>
<div class="description">
<p>Adds a Circle shape to this Body. You can control the offset from the center of the body and the rotation.</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>radius</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 radius of this circle (in pixels)</p></td>
</tr>
<tr>
<td class="name"><code>offsetX</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>Local horizontal offset of the shape relative to the body center of mass.</p></td>
</tr>
<tr>
<td class="name"><code>offsetY</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>Local vertical offset of the shape relative to the body center of mass.</p></td>
</tr>
<tr>
<td class="name"><code>rotation</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>Local rotation of the shape relative to the body center of mass, specified in radians.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
2014-07-10 19:31:11 +00:00
<a href="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-824">line 824</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>The Circle shape that was added to the Body.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">p2.Circle</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="addFixture"><span class="type-signature"></span>addFixture<span class="signature">(fixtureData)</span><span class="type-signature"> &rarr; {array}</span></h4>
</dt>
<dd>
<div class="description">
2014-04-29 14:39:02 +00:00
<p>Add a polygon fixture. This is used during #loadPolygon.</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>fixtureData</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last"><p>The data for the fixture. It contains: isSensor, filter (collision) and the actual polygon shapes.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
2014-07-18 11:45:51 +00:00
<a href="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-1150">line 1150</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>An array containing the generated shapes for the given polygon.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">array</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="addLine"><span class="type-signature"></span>addLine<span class="signature">(length, <span class="optional">offsetX</span>, <span class="optional">offsetY</span>, <span class="optional">rotation</span>)</span><span class="type-signature"> &rarr; {p2.Line}</span></h4>
</dt>
<dd>
<div class="description">
<p>Adds a Line shape to this Body.
The line shape is along the x direction, and stretches from [-length/2, 0] to [length/2,0].
You can control the offset from the center of the body and the rotation.</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>length</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 length of this line (in pixels)</p></td>
</tr>
<tr>
<td class="name"><code>offsetX</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>Local horizontal offset of the shape relative to the body center of mass.</p></td>
</tr>
<tr>
<td class="name"><code>offsetY</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>Local vertical offset of the shape relative to the body center of mass.</p></td>
</tr>
<tr>
<td class="name"><code>rotation</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>Local rotation of the shape relative to the body center of mass, specified in radians.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
2014-07-10 19:31:11 +00:00
<a href="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-895">line 895</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>The Line shape that was added to the Body.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">p2.Line</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="addParticle"><span class="type-signature"></span>addParticle<span class="signature">(<span class="optional">offsetX</span>, <span class="optional">offsetY</span>, <span class="optional">rotation</span>)</span><span class="type-signature"> &rarr; {p2.Particle}</span></h4>
</dt>
<dd>
<div class="description">
<p>Adds a Particle shape to this Body. You can control the offset from the center of the body and the rotation.</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>offsetX</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>Local horizontal offset of the shape relative to the body center of mass.</p></td>
</tr>
<tr>
<td class="name"><code>offsetY</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>Local vertical offset of the shape relative to the body center of mass.</p></td>
</tr>
<tr>
<td class="name"><code>rotation</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>Local rotation of the shape relative to the body center of mass, specified in radians.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
2014-07-10 19:31:11 +00:00
<a href="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-878">line 878</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>The Particle shape that was added to the Body.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">p2.Particle</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="addPhaserPolygon"><span class="type-signature"></span>addPhaserPolygon<span class="signature">(key, object)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>Reads the shape data from a physics data file stored in the Game.Cache and adds it as a polygon to this Body.
The shape data format is based on the custom phaser export in.</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>key</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last"><p>The key of the Physics Data file as stored in Game.Cache.</p></td>
</tr>
<tr>
<td class="name"><code>object</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last"><p>The key of the object within the Physics data file that you wish to load the shape data from.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
2014-07-18 11:45:51 +00:00
<a href="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-1113">line 1113</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="addPlane"><span class="type-signature"></span>addPlane<span class="signature">(<span class="optional">offsetX</span>, <span class="optional">offsetY</span>, <span class="optional">rotation</span>)</span><span class="type-signature"> &rarr; {p2.Plane}</span></h4>
</dt>
<dd>
<div class="description">
<p>Adds a Plane shape to this Body. The plane is facing in the Y direction. You can control the offset from the center of the body and the rotation.</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>offsetX</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>Local horizontal offset of the shape relative to the body center of mass.</p></td>
</tr>
<tr>
<td class="name"><code>offsetY</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>Local vertical offset of the shape relative to the body center of mass.</p></td>
</tr>
<tr>
<td class="name"><code>rotation</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>Local rotation of the shape relative to the body center of mass, specified in radians.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
2014-07-10 19:31:11 +00:00
<a href="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-861">line 861</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>The Plane shape that was added to the Body.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">p2.Plane</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="addPolygon"><span class="type-signature"></span>addPolygon<span class="signature">(options, points)</span><span class="type-signature"> &rarr; {boolean}</span></h4>
</dt>
<dd>
<div class="description">
<p>Reads a polygon shape path, and assembles convex shapes from that and puts them at proper offset points. The shape must be simple and without holes.
This function expects the x.y values to be given in pixels. If you want to provide them at p2 world scales then call Body.data.fromPolygon directly.</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>options</code></td>
<td class="type">
<span class="param-type">object</span>
</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>
2014-03-24 12:41:45 +00:00
</td>
2014-03-24 12:41:45 +00:00
<td class="attributes">
&lt;optional><br>
2014-03-24 12:41:45 +00:00
2014-03-24 12:41:45 +00:00
</td>
2014-03-24 12:41:45 +00:00
<td class="default">
false
</td>
2014-03-24 12:41:45 +00:00
<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>
2014-03-24 12:41:45 +00:00
</tbody>
</table>
</td>
</tr>
2014-03-24 12:41:45 +00:00
<tr>
<td class="name"><code>points</code></td>
2014-03-24 12:41:45 +00:00
<td class="type">
<span class="param-type"><a href="Array.html">Array</a>.&lt;number></span>
|
<span class="param-type">number</span>
2014-03-24 12:41:45 +00:00
</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>
2014-03-24 12:41:45 +00:00
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
2014-07-10 19:31:11 +00:00
<a href="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-935">line 935</a>
2014-03-24 12:41:45 +00:00
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>True on success, else false.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">boolean</span>
</dd>
</dl>
2014-03-24 12:41:45 +00:00
</dd>
<dt>
<h4 class="name" id="addRectangle"><span class="type-signature"></span>addRectangle<span class="signature">(width, height, <span class="optional">offsetX</span>, <span class="optional">offsetY</span>, <span class="optional">rotation</span>)</span><span class="type-signature"> &rarr; {p2.Rectangle}</span></h4>
</dt>
<dd>
<div class="description">
<p>Adds a Rectangle shape to this Body. You can control the offset from the center of the body and the rotation.</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>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 rectangle in pixels.</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 rectangle in pixels.</p></td>
</tr>
<tr>
<td class="name"><code>offsetX</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>Local horizontal offset of the shape relative to the body center of mass.</p></td>
</tr>
<tr>
<td class="name"><code>offsetY</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>Local vertical offset of the shape relative to the body center of mass.</p></td>
</tr>
<tr>
<td class="name"><code>rotation</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>Local rotation of the shape relative to the body center of mass, specified in radians.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
2014-07-10 19:31:11 +00:00
<a href="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-842">line 842</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>The Rectangle shape that was added to the Body.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">p2.Rectangle</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="addShape"><span class="type-signature"></span>addShape<span class="signature">(shape, <span class="optional">offsetX</span>, <span class="optional">offsetY</span>, <span class="optional">rotation</span>)</span><span class="type-signature"> &rarr; {p2.Shape}</span></h4>
</dt>
<dd>
<div class="description">
<p>Add a shape to the body. You can pass a local transform when adding a shape, so that the shape gets an offset and an angle relative to the body center of mass.
Will automatically update the mass properties and bounding radius.</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>shape</code></td>
<td class="type">
<span class="param-type">p2.Shape</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"><p>The shape to add to the body.</p></td>
</tr>
<tr>
<td class="name"><code>offsetX</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>Local horizontal offset of the shape relative to the body center of mass.</p></td>
</tr>
<tr>
<td class="name"><code>offsetY</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>Local vertical offset of the shape relative to the body center of mass.</p></td>
</tr>
<tr>
<td class="name"><code>rotation</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>Local rotation of the shape relative to the body center of mass, specified in radians.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
2014-07-10 19:31:11 +00:00
<a href="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-800">line 800</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>The shape that was added to the body.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">p2.Shape</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="addToWorld"><span class="type-signature"></span>addToWorld<span class="signature">()</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>Adds this physics body to the world.</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
2014-07-10 19:31:11 +00:00
<a href="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-716">line 716</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="adjustCenterOfMass"><span class="type-signature"></span>adjustCenterOfMass<span class="signature">()</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>Moves the shape offsets so their center of mass becomes the body center of mass.</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
2014-07-10 19:31:11 +00:00
<a href="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-396">line 396</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="applyDamping"><span class="type-signature"></span>applyDamping<span class="signature">(dt)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>Apply damping, see <a href="http://code.google.com/p/bullet/issues/detail?id=74">http://code.google.com/p/bullet/issues/detail?id=74</a> for details.</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>dt</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>Current time step.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
2014-07-10 19:31:11 +00:00
<a href="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-407">line 407</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="applyForce"><span class="type-signature"></span>applyForce<span class="signature">(force, worldX, worldY)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>Apply force to a world point. This could for example be a point on the RigidBody surface. Applying force this way will add to Body.force and Body.angularForce.</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>force</code></td>
<td class="type">
2014-07-10 19:31:11 +00:00
<span class="param-type">Float32Array</span>
|
<span class="param-type"><a href="Array.html">Array</a></span>
</td>
2014-07-10 19:31:11 +00:00
<td class="description last"><p>The force vector to add.</p></td>
</tr>
<tr>
<td class="name"><code>worldX</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>The world x point to apply the force on.</p></td>
</tr>
<tr>
<td class="name"><code>worldY</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>The world y point to apply the force on.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
2014-07-10 19:31:11 +00:00
<a href="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-419">line 419</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="clearCollision"><span class="type-signature"></span>clearCollision<span class="signature">(<span class="optional">clearGroup</span>, <span class="optional">clearMask</span>, <span class="optional">shape</span>)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>Clears the collision data from the shapes in this Body. Optionally clears Group and/or Mask.</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>clearGroup</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>Clear the collisionGroup value from the shape/s?</p></td>
</tr>
<tr>
<td class="name"><code>clearMask</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>Clear the collisionMask value from the shape/s?</p></td>
</tr>
<tr>
<td class="name"><code>shape</code></td>
<td class="type">
<span class="param-type">p2.Shape</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
</td>
<td class="description last"><p>An optional Shape. If not provided the collision data will be cleared from all Shapes in this Body.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
2014-07-10 19:31:11 +00:00
<a href="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-296">line 296</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="clearShapes"><span class="type-signature"></span>clearShapes<span class="signature">()</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>Removes all Shapes from this Body.</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
2014-07-10 19:31:11 +00:00
<a href="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-782">line 782</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="collides"><span class="type-signature"></span>collides<span class="signature">(group, <span class="optional">callback</span>, <span class="optional">callbackContext</span>, <span class="optional">shape</span>)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>Adds the given CollisionGroup, or array of CollisionGroups, to the list of groups that this body will collide with and updates the collision masks.</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>group</code></td>
<td class="type">
<span class="param-type">Phaser.Physics.CollisionGroup</span>
|
<span class="param-type">array</span>
</td>
<td class="attributes">
</td>
<td class="description last"><p>The Collision Group or Array of Collision Groups that this Bodies shapes will collide with.</p></td>
</tr>
<tr>
<td class="name"><code>callback</code></td>
<td class="type">
<span class="param-type">function</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last"><p>Optional callback that will be triggered when this Body impacts with the given Group.</p></td>
</tr>
<tr>
<td class="name"><code>callbackContext</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last"><p>The context under which the callback will be called.</p></td>
</tr>
<tr>
<td class="name"><code>shape</code></td>
<td class="type">
<span class="param-type">p2.Shape</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last"><p>An optional Shape. If not provided the collision mask will be added to all Shapes in this Body.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
2014-07-10 19:31:11 +00:00
<a href="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-341">line 341</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="createBodyCallback"><span class="type-signature"></span>createBodyCallback<span class="signature">(object, callback, callbackContext)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>Sets a callback to be fired any time a shape in this Body impacts with a shape in the given Body. The impact test is performed against body.id values.
The callback will be sent 4 parameters: This body, the body that impacted, the Shape in this body and the shape in the impacting body.
Note that the impact event happens after collision resolution, so it cannot be used to prevent a collision from happening.
It also happens mid-step. So do not destroy a Body during this callback, instead set safeDestroy to true so it will be killed on the next preUpdate.</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"><a href="Phaser.Sprite.html">Phaser.Sprite</a></span>
|
<span class="param-type"><a href="Phaser.TileSprite.html">Phaser.TileSprite</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="description last"><p>The object to send impact events for.</p></td>
</tr>
<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 to fire on impact. Set to null to clear a previously set callback.</p></td>
</tr>
<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 callback will fire.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
2014-07-10 19:31:11 +00:00
<a href="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-153">line 153</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="createGroupCallback"><span class="type-signature"></span>createGroupCallback<span class="signature">(group, callback, callbackContext)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>Sets a callback to be fired any time this Body impacts with the given Group. The impact test is performed against shape.collisionGroup values.
The callback will be sent 4 parameters: This body, the body that impacted, the Shape in this body and the shape in the impacting body.
This callback will only fire if this Body has been assigned a collision group.
Note that the impact event happens after collision resolution, so it cannot be used to prevent a collision from happening.
It also happens mid-step. So do not destroy a Body during this callback, instead set safeDestroy to true so it will be killed on the next preUpdate.</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>group</code></td>
<td class="type">
<span class="param-type">Phaser.Physics.CollisionGroup</span>
</td>
<td class="description last"><p>The Group to send impact events for.</p></td>
</tr>
<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 to fire on impact. Set to null to clear a previously set callback.</p></td>
</tr>
<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 callback will fire.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
2014-07-10 19:31:11 +00:00
<a href="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-193">line 193</a>
</li></ul></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>Destroys this Body and all references it holds to other objects.</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
2014-07-10 19:31:11 +00:00
<a href="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-755">line 755</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="getCollisionMask"><span class="type-signature"></span>getCollisionMask<span class="signature">()</span><span class="type-signature"> &rarr; {number}</span></h4>
</dt>
<dd>
<div class="description">
<p>Gets the collision bitmask from the groups this body collides with.</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
2014-07-10 19:31:11 +00:00
<a href="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-220">line 220</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>The bitmask.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">number</span>
</dd>
</dl>
</dd>
<dt>
2014-04-29 14:39:02 +00:00
<h4 class="name" id="loadData"><span class="type-signature"></span>loadData<span class="signature">(key, object)</span><span class="type-signature"> &rarr; {boolean}</span></h4>
</dt>
<dd>
<div class="description">
2014-04-29 14:39:02 +00:00
<p>DEPRECATED: This method will soon be removed from the API. Please avoid using.
Reads the physics data from a physics data file stored in the Game.Cache.
It will add the shape data to this Body, as well as set the density (mass).</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>key</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last"><p>The key of the Physics Data file as stored in Game.Cache.</p></td>
</tr>
<tr>
<td class="name"><code>object</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last"><p>The key of the object within the Physics data file that you wish to load the shape data from.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
2014-07-18 11:45:51 +00:00
<a href="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-1274">line 1274</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>True on success, else false.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">boolean</span>
</dd>
</dl>
</dd>
<dt>
2014-04-29 14:39:02 +00:00
<h4 class="name" id="loadPolygon"><span class="type-signature"></span>loadPolygon<span class="signature">(key, object)</span><span class="type-signature"> &rarr; {boolean}</span></h4>
</dt>
<dd>
<div class="description">
2014-04-29 14:39:02 +00:00
<p>Reads the shape data from a physics data file stored in the Game.Cache and adds it as a polygon to this Body.</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>key</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last"><p>The key of the Physics Data file as stored in Game.Cache.</p></td>
</tr>
<tr>
<td class="name"><code>object</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last"><p>The key of the object within the Physics data file that you wish to load the shape data from.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
2014-07-18 11:45:51 +00:00
<a href="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-1222">line 1222</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>True on success, else false.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">boolean</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="moveBackward"><span class="type-signature"></span>moveBackward<span class="signature">(speed)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>Moves the Body backwards based on its current angle and the given speed.
The speed is represented in pixels per second. So a value of 100 would move 100 pixels in 1 second (1000ms).</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>speed</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>The speed at which it should move backwards.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
2014-07-10 19:31:11 +00:00
<a href="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-546">line 546</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="moveDown"><span class="type-signature"></span>moveDown<span class="signature">(speed)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>If this Body is dynamic then this will move it down by setting its y velocity to the given speed.
The speed is represented in pixels per second. So a value of 100 would move 100 pixels in 1 second (1000ms).</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>speed</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>The speed at which it should move down, in pixels per second.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
2014-07-10 19:31:11 +00:00
<a href="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-636">line 636</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="moveForward"><span class="type-signature"></span>moveForward<span class="signature">(speed)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>Moves the Body forwards based on its current angle and the given speed.
The speed is represented in pixels per second. So a value of 100 would move 100 pixels in 1 second (1000ms).</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>speed</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>The speed at which it should move forwards.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
2014-07-10 19:31:11 +00:00
<a href="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-529">line 529</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="moveLeft"><span class="type-signature"></span>moveLeft<span class="signature">(speed)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>If this Body is dynamic then this will move it to the left by setting its x velocity to the given speed.
The speed is represented in pixels per second. So a value of 100 would move 100 pixels in 1 second (1000ms).</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>speed</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>The speed at which it should move to the left, in pixels per second.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
2014-07-10 19:31:11 +00:00
<a href="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-597">line 597</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="moveRight"><span class="type-signature"></span>moveRight<span class="signature">(speed)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>If this Body is dynamic then this will move it to the right by setting its x velocity to the given speed.
The speed is represented in pixels per second. So a value of 100 would move 100 pixels in 1 second (1000ms).</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>speed</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>The speed at which it should move to the right, in pixels per second.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
2014-07-10 19:31:11 +00:00
<a href="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-610">line 610</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="moveUp"><span class="type-signature"></span>moveUp<span class="signature">(speed)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>If this Body is dynamic then this will move it up by setting its y velocity to the given speed.
The speed is represented in pixels per second. So a value of 100 would move 100 pixels in 1 second (1000ms).</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>speed</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>The speed at which it should move up, in pixels per second.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
2014-07-10 19:31:11 +00:00
<a href="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-623">line 623</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="postUpdate"><span class="type-signature">&lt;protected> </span>postUpdate<span class="signature">()</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>Internal method. This is called directly before the sprites are sent to the renderer and after the update function has finished.</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
2014-07-10 19:31:11 +00:00
<a href="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-665">line 665</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="preUpdate"><span class="type-signature">&lt;protected> </span>preUpdate<span class="signature">()</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>Internal method. This is called directly before the sprites are sent to the renderer and after the update function has finished.</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
2014-07-10 19:31:11 +00:00
<a href="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-649">line 649</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="removeFromWorld"><span class="type-signature"></span>removeFromWorld<span class="signature">()</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>Removes this physics body from the world.</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
2014-07-10 19:31:11 +00:00
<a href="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-741">line 741</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="removeShape"><span class="type-signature"></span>removeShape<span class="signature">(shape)</span><span class="type-signature"> &rarr; {boolean}</span></h4>
</dt>
<dd>
<div class="description">
<p>Remove a shape from the body. Will automatically update the mass properties and bounding radius.</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>shape</code></td>
<td class="type">
<span class="param-type">p2.Circle</span>
|
<span class="param-type">p2.Rectangle</span>
|
<span class="param-type">p2.Plane</span>
|
<span class="param-type">p2.Line</span>
|
<span class="param-type">p2.Particle</span>
</td>
<td class="description last"><p>The shape to remove from the body.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
2014-07-18 11:45:51 +00:00
<a href="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-1000">line 1000</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>True if the shape was found and removed, else false.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">boolean</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="reset"><span class="type-signature"></span>reset<span class="signature">(x, y, <span class="optional">resetDamping</span>, <span class="optional">resetMass</span>)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>Resets the Body force, velocity (linear and angular) and rotation. Optionally resets damping and mass.</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 new x position of the 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 new x position of the Body.</p></td>
</tr>
<tr>
<td class="name"><code>resetDamping</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>Resets the linear and angular damping.</p></td>
</tr>
<tr>
<td class="name"><code>resetMass</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>Sets the Body mass back to 1.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
2014-07-10 19:31:11 +00:00
<a href="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-683">line 683</a>
</li></ul></dd>
</dl>
</dd>
<dt>
2014-07-10 19:31:11 +00:00
<h4 class="name" id="reverse"><span class="type-signature"></span>reverse<span class="signature">(speed)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>Applies a force to the Body that causes it to 'thrust' backwards (in reverse), based on its current angle and the given speed.
The speed is represented in pixels per second. So a value of 100 would move 100 pixels in 1 second (1000ms).</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>speed</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>The speed at which it should reverse.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
2014-07-10 19:31:11 +00:00
<a href="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-580">line 580</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="rotateLeft"><span class="type-signature"></span>rotateLeft<span class="signature">(speed)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>This will rotate the Body by the given speed to the left (counter-clockwise).</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>speed</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>The speed at which it should rotate.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
2014-07-10 19:31:11 +00:00
<a href="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-505">line 505</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="rotateRight"><span class="type-signature"></span>rotateRight<span class="signature">(speed)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>This will rotate the Body by the given speed to the left (clockwise).</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>speed</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>The speed at which it should rotate.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
2014-07-10 19:31:11 +00:00
<a href="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-517">line 517</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="setCircle"><span class="type-signature"></span>setCircle<span class="signature">(radius, <span class="optional">offsetX</span>, <span class="optional">offsetY</span>, <span class="optional">rotation</span>)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>Clears any previously set shapes. Then creates a new Circle shape and adds it to this Body.</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>radius</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 radius of this circle (in pixels)</p></td>
</tr>
<tr>
<td class="name"><code>offsetX</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>Local horizontal offset of the shape relative to the body center of mass.</p></td>
</tr>
<tr>
<td class="name"><code>offsetY</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>Local vertical offset of the shape relative to the body center of mass.</p></td>
</tr>
<tr>
<td class="name"><code>rotation</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>Local rotation of the shape relative to the body center of mass, specified in radians.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
2014-07-18 11:45:51 +00:00
<a href="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-1016">line 1016</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="setCollisionGroup"><span class="type-signature"></span>setCollisionGroup<span class="signature">(group, <span class="optional">shape</span>)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>Sets the given CollisionGroup to be the collision group for all shapes in this Body, unless a shape is specified.
This also resets the collisionMask.</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>group</code></td>
<td class="type">
<span class="param-type">Phaser.Physics.CollisionGroup</span>
</td>
<td class="attributes">
</td>
<td class="description last"><p>The Collision Group that this Bodies shapes will use.</p></td>
</tr>
<tr>
<td class="name"><code>shape</code></td>
<td class="type">
<span class="param-type">p2.Shape</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last"><p>An optional Shape. If not provided the collision group will be added to all Shapes in this Body.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
2014-07-10 19:31:11 +00:00
<a href="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-268">line 268</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="setMaterial"><span class="type-signature"></span>setMaterial<span class="signature">(material, <span class="optional">shape</span>)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>Adds the given Material to all Shapes that belong to this Body.
If you only wish to apply it to a specific Shape in this Body then provide that as the 2nd parameter.</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>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="attributes">
</td>
<td class="description last"><p>The Material that will be applied.</p></td>
</tr>
<tr>
<td class="name"><code>shape</code></td>
<td class="type">
<span class="param-type">p2.Shape</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last"><p>An optional Shape. If not provided the Material will be added to all Shapes in this Body.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
2014-07-18 11:45:51 +00:00
<a href="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-1075">line 1075</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="setRectangle"><span class="type-signature"></span>setRectangle<span class="signature">(<span class="optional">width</span>, <span class="optional">height</span>, <span class="optional">offsetX</span>, <span class="optional">offsetY</span>, <span class="optional">rotation</span>)</span><span class="type-signature"> &rarr; {p2.Rectangle}</span></h4>
</dt>
<dd>
<div class="description">
<p>Clears any previously set shapes. The creates a new Rectangle shape at the given size and offset, and adds it to this Body.
If you wish to create a Rectangle to match the size of a Sprite or Image see Body.setRectangleFromSprite.</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>width</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
16
</td>
<td class="description last"><p>The width of the rectangle in pixels.</p></td>
</tr>
<tr>
<td class="name"><code>height</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
16
</td>
<td class="description last"><p>The height of the rectangle in pixels.</p></td>
</tr>
<tr>
<td class="name"><code>offsetX</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>Local horizontal offset of the shape relative to the body center of mass.</p></td>
</tr>
<tr>
<td class="name"><code>offsetY</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>Local vertical offset of the shape relative to the body center of mass.</p></td>
</tr>
<tr>
<td class="name"><code>rotation</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>Local rotation of the shape relative to the body center of mass, specified in radians.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
2014-07-18 11:45:51 +00:00
<a href="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-1033">line 1033</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>The Rectangle shape that was added to the Body.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">p2.Rectangle</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="setRectangleFromSprite"><span class="type-signature"></span>setRectangleFromSprite<span class="signature">(<span class="optional">sprite</span>)</span><span class="type-signature"> &rarr; {p2.Rectangle}</span></h4>
</dt>
<dd>
<div class="description">
<p>Clears any previously set shapes.
Then creates a Rectangle shape sized to match the dimensions and orientation of the Sprite given.
If no Sprite is given it defaults to using the parent of this Body.</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>sprite</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.Image.html">Phaser.Image</a></span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last"><p>The Sprite on which the Rectangle will get its dimensions.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
2014-07-18 11:45:51 +00:00
<a href="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-1056">line 1056</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>The Rectangle shape that was added to the Body.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">p2.Rectangle</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="setZeroDamping"><span class="type-signature"></span>setZeroDamping<span class="signature">()</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>Sets the Body damping and angularDamping to zero.</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
2014-07-10 19:31:11 +00:00
<a href="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-467">line 467</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="setZeroForce"><span class="type-signature"></span>setZeroForce<span class="signature">()</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>Sets the force on the body to zero.</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
2014-07-10 19:31:11 +00:00
<a href="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-433">line 433</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="setZeroRotation"><span class="type-signature"></span>setZeroRotation<span class="signature">()</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>If this Body is dynamic then this will zero its angular velocity.</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
2014-07-10 19:31:11 +00:00
<a href="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-444">line 444</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="setZeroVelocity"><span class="type-signature"></span>setZeroVelocity<span class="signature">()</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>If this Body is dynamic then this will zero its velocity on both axis.</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
2014-07-10 19:31:11 +00:00
<a href="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-455">line 455</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="shapeChanged"><span class="type-signature"></span>shapeChanged<span class="signature">()</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>Updates the debug draw if any body shapes change.</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
2014-07-18 11:45:51 +00:00
<a href="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-1099">line 1099</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="thrust"><span class="type-signature"></span>thrust<span class="signature">(speed)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>Applies a force to the Body that causes it to 'thrust' forwards, based on its current angle and the given speed.
The speed is represented in pixels per second. So a value of 100 would move 100 pixels in 1 second (1000ms).</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>speed</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>The speed at which it should thrust.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
2014-07-10 19:31:11 +00:00
<a href="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-563">line 563</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="toLocalFrame"><span class="type-signature"></span>toLocalFrame<span class="signature">(out, worldPoint)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>Transform a world point to local body frame.</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>out</code></td>
<td class="type">
<span class="param-type">Float32Array</span>
|
<span class="param-type"><a href="Array.html">Array</a></span>
</td>
<td class="description last"><p>The vector to store the result in.</p></td>
</tr>
<tr>
<td class="name"><code>worldPoint</code></td>
<td class="type">
<span class="param-type">Float32Array</span>
|
<span class="param-type"><a href="Array.html">Array</a></span>
</td>
<td class="description last"><p>The input world vector.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
2014-07-10 19:31:11 +00:00
<a href="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-479">line 479</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="toWorldFrame"><span class="type-signature"></span>toWorldFrame<span class="signature">(out, localPoint)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>Transform a local point to world frame.</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>out</code></td>
<td class="type">
<span class="param-type"><a href="Array.html">Array</a></span>
</td>
<td class="description last"><p>The vector to store the result in.</p></td>
</tr>
<tr>
<td class="name"><code>localPoint</code></td>
<td class="type">
<span class="param-type"><a href="Array.html">Array</a></span>
</td>
<td class="description last"><p>The input local vector.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
2014-07-10 19:31:11 +00:00
<a href="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-492">line 492</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="updateCollisionMask"><span class="type-signature"></span>updateCollisionMask<span class="signature">(<span class="optional">shape</span>)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>Updates the collisionMask.</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>shape</code></td>
<td class="type">
<span class="param-type">p2.Shape</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last"><p>An optional Shape. If not provided the collision group will be added to all Shapes in this Body.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
2014-07-10 19:31:11 +00:00
<a href="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-244">line 244</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>
2014-07-18 11:45:51 +00:00
on Fri Jul 18 2014 12:36:49 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( {
2014-04-10 22:13:43 +00:00
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>