phaser/docs/Phaser.Physics.P2.Body.html
2016-04-22 15:15:28 +01:00

12416 lines
No EOL
188 KiB
HTML

<!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/default.css">
<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 style="position: absolute; width: 143px; height: 31px; right: 10px; top: 10px; z-index: 1050"><a href="http://phaser.io"><img src="img/phaser.png" border="0" /></a></div>
<div class="navbar-inner">
<a class="brand" href="index.html">Phaser API</a>
<ul class="nav">
<li class="dropdown">
<a href="namespaces.list.html" class="dropdown-toggle" data-toggle="dropdown">Namespaces<b
class="caret"></b></a>
<ul class="dropdown-menu ">
<li class="class-depth-0">
<a href="Phaser.html">Phaser</a>
</li>
<li class="class-depth-0">
<a href="Phaser.KeyCode.html">KeyCode</a>
</li>
<li class="class-depth-0">
<a href="PIXI.html">PIXI</a>
</li>
</ul>
</li>
<li class="dropdown">
<a href="classes.list.html" class="dropdown-toggle" data-toggle="dropdown">Classes<b
class="caret"></b></a>
<ul class="dropdown-menu ">
<li class="class-depth-1">
<a href="Phaser.Animation.html">Animation</a>
</li>
<li class="class-depth-1">
<a href="Phaser.AnimationManager.html">AnimationManager</a>
</li>
<li class="class-depth-1">
<a href="Phaser.AnimationParser.html">AnimationParser</a>
</li>
<li class="class-depth-1">
<a href="Phaser.ArraySet.html">ArraySet</a>
</li>
<li class="class-depth-1">
<a href="Phaser.ArrayUtils.html">ArrayUtils</a>
</li>
<li class="class-depth-1">
<a href="Phaser.AudioSprite.html">AudioSprite</a>
</li>
<li class="class-depth-1">
<a href="Phaser.BitmapData.html">BitmapData</a>
</li>
<li class="class-depth-1">
<a href="Phaser.BitmapText.html">BitmapText</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Button.html">Button</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Cache.html">Cache</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Camera.html">Camera</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Canvas.html">Canvas</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Circle.html">Circle</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Color.html">Color</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Component.Angle.html">Angle</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Component.Animation.html">Animation</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Component.AutoCull.html">AutoCull</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Component.Bounds.html">Bounds</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Component.BringToTop.html">BringToTop</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Component.Core.html">Core</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Component.Crop.html">Crop</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Component.Delta.html">Delta</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Component.Destroy.html">Destroy</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Component.FixedToCamera.html">FixedToCamera</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Component.Health.html">Health</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Component.InCamera.html">InCamera</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Component.InputEnabled.html">InputEnabled</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Component.InWorld.html">InWorld</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Component.LifeSpan.html">LifeSpan</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Component.LoadTexture.html">LoadTexture</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Component.Overlap.html">Overlap</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Component.PhysicsBody.html">PhysicsBody</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Component.Reset.html">Reset</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Component.ScaleMinMax.html">ScaleMinMax</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Component.Smoothed.html">Smoothed</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Create.html">Create</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Creature.html">Creature</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Device.html">Device</a>
</li>
<li class="class-depth-1">
<a href="Phaser.DeviceButton.html">DeviceButton</a>
</li>
<li class="class-depth-1">
<a href="Phaser.DOM.html">DOM</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Easing.html">Easing</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Easing.Back.html">Back</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Easing.Bounce.html">Bounce</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Easing.Circular.html">Circular</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Easing.Cubic.html">Cubic</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Easing.Elastic.html">Elastic</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Easing.Exponential.html">Exponential</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Easing.Linear.html">Linear</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Easing.Quadratic.html">Quadratic</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Easing.Quartic.html">Quartic</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Easing.Quintic.html">Quintic</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Easing.Sinusoidal.html">Sinusoidal</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Ellipse.html">Ellipse</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Events.html">Events</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Filter.html">Filter</a>
</li>
<li class="class-depth-1">
<a href="Phaser.FlexGrid.html">FlexGrid</a>
</li>
<li class="class-depth-1">
<a href="Phaser.FlexLayer.html">FlexLayer</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Frame.html">Frame</a>
</li>
<li class="class-depth-1">
<a href="Phaser.FrameData.html">FrameData</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Game.html">Game</a>
</li>
<li class="class-depth-1">
<a href="Phaser.GameObjectCreator.html">GameObjectCreator</a>
</li>
<li class="class-depth-1">
<a href="Phaser.GameObjectFactory.html">GameObjectFactory</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Gamepad.html">Gamepad</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Graphics.html">Graphics</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Group.html">Group</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Image.html">Image</a>
</li>
<li class="class-depth-1">
<a href="Phaser.ImageCollection.html">ImageCollection</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Input.html">Input</a>
</li>
<li class="class-depth-1">
<a href="Phaser.InputHandler.html">InputHandler</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Key.html">Key</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Keyboard.html">Keyboard</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Line.html">Line</a>
</li>
<li class="class-depth-1">
<a href="Phaser.LinkedList.html">LinkedList</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Loader.html">Loader</a>
</li>
<li class="class-depth-1">
<a href="Phaser.LoaderParser.html">LoaderParser</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Math.html">Math</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Matrix.html">Matrix</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Mouse.html">Mouse</a>
</li>
<li class="class-depth-1">
<a href="Phaser.MSPointer.html">MSPointer</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Net.html">Net</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Particle.html">Particle</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Particles.html">Particles</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Particles.Arcade.html">Arcade</a>
</li>
<li class="class-depth-3">
<a href="Phaser.Particles.Arcade.Emitter.html">Emitter</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Physics.html">Physics</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Physics.Arcade.html">Arcade</a>
</li>
<li class="class-depth-3">
<a href="Phaser.Physics.Arcade.Body.html">Body</a>
</li>
<li class="class-depth-3">
<a href="Phaser.Physics.Arcade.TilemapCollision.html">TilemapCollision</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Physics.Ninja.html">Ninja</a>
</li>
<li class="class-depth-3">
<a href="Phaser.Physics.Ninja.AABB.html">AABB</a>
</li>
<li class="class-depth-3">
<a href="Phaser.Physics.Ninja.Body.html">Body</a>
</li>
<li class="class-depth-3">
<a href="Phaser.Physics.Ninja.Circle.html">Circle</a>
</li>
<li class="class-depth-3">
<a href="Phaser.Physics.Ninja.Tile.html">Tile</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Physics.P2.html">P2</a>
</li>
<li class="class-depth-3">
<a href="Phaser.Physics.P2.Body.html">Body</a>
</li>
<li class="class-depth-3">
<a href="Phaser.Physics.P2.BodyDebug.html">BodyDebug</a>
</li>
<li class="class-depth-3">
<a href="Phaser.Physics.P2.CollisionGroup.html">CollisionGroup</a>
</li>
<li class="class-depth-3">
<a href="Phaser.Physics.P2.ContactMaterial.html">ContactMaterial</a>
</li>
<li class="class-depth-3">
<a href="Phaser.Physics.P2.DistanceConstraint.html">DistanceConstraint</a>
</li>
<li class="class-depth-3">
<a href="Phaser.Physics.P2.FixtureList.html">FixtureList</a>
</li>
<li class="class-depth-3">
<a href="Phaser.Physics.P2.GearConstraint.html">GearConstraint</a>
</li>
<li class="class-depth-3">
<a href="Phaser.Physics.P2.InversePointProxy.html">InversePointProxy</a>
</li>
<li class="class-depth-3">
<a href="Phaser.Physics.P2.LockConstraint.html">LockConstraint</a>
</li>
<li class="class-depth-3">
<a href="Phaser.Physics.P2.Material.html">Material</a>
</li>
<li class="class-depth-3">
<a href="Phaser.Physics.P2.PointProxy.html">PointProxy</a>
</li>
<li class="class-depth-3">
<a href="Phaser.Physics.P2.PrismaticConstraint.html">PrismaticConstraint</a>
</li>
<li class="class-depth-3">
<a href="Phaser.Physics.P2.RevoluteConstraint.html">RevoluteConstraint</a>
</li>
<li class="class-depth-3">
<a href="Phaser.Physics.P2.RotationalSpring.html">RotationalSpring</a>
</li>
<li class="class-depth-3">
<a href="Phaser.Physics.P2.Spring.html">Spring</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Plugin.html">Plugin</a>
</li>
<li class="class-depth-1">
<a href="Phaser.PluginManager.html">PluginManager</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Point.html">Point</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Pointer.html">Pointer</a>
</li>
<li class="class-depth-1">
<a href="Phaser.PointerMode.html">PointerMode</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Polygon.html">Polygon</a>
</li>
<li class="class-depth-1">
<a href="Phaser.QuadTree.html">QuadTree</a>
</li>
<li class="class-depth-1">
<a href="Phaser.RandomDataGenerator.html">RandomDataGenerator</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Rectangle.html">Rectangle</a>
</li>
<li class="class-depth-1">
<a href="Phaser.RenderTexture.html">RenderTexture</a>
</li>
<li class="class-depth-1">
<a href="Phaser.RequestAnimationFrame.html">RequestAnimationFrame</a>
</li>
<li class="class-depth-1">
<a href="Phaser.RetroFont.html">RetroFont</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Rope.html">Rope</a>
</li>
<li class="class-depth-1">
<a href="Phaser.RoundedRectangle.html">RoundedRectangle</a>
</li>
<li class="class-depth-1">
<a href="Phaser.ScaleManager.html">ScaleManager</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Signal.html">Signal</a>
</li>
<li class="class-depth-1">
<a href="Phaser.SignalBinding.html">SignalBinding</a>
</li>
<li class="class-depth-1">
<a href="Phaser.SinglePad.html">SinglePad</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Sound.html">Sound</a>
</li>
<li class="class-depth-1">
<a href="Phaser.SoundManager.html">SoundManager</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Sprite.html">Sprite</a>
</li>
<li class="class-depth-1">
<a href="Phaser.SpriteBatch.html">SpriteBatch</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Stage.html">Stage</a>
</li>
<li class="class-depth-1">
<a href="Phaser.State.html">State</a>
</li>
<li class="class-depth-1">
<a href="Phaser.StateManager.html">StateManager</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Text.html">Text</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Tile.html">Tile</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Tilemap.html">Tilemap</a>
</li>
<li class="class-depth-1">
<a href="Phaser.TilemapLayer.html">TilemapLayer</a>
</li>
<li class="class-depth-1">
<a href="Phaser.TilemapParser.html">TilemapParser</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Tileset.html">Tileset</a>
</li>
<li class="class-depth-1">
<a href="Phaser.TileSprite.html">TileSprite</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Time.html">Time</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Timer.html">Timer</a>
</li>
<li class="class-depth-1">
<a href="Phaser.TimerEvent.html">TimerEvent</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Touch.html">Touch</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Tween.html">Tween</a>
</li>
<li class="class-depth-1">
<a href="Phaser.TweenData.html">TweenData</a>
</li>
<li class="class-depth-1">
<a href="Phaser.TweenManager.html">TweenManager</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Utils.html">Utils</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Utils.Debug.html">Debug</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Video.html">Video</a>
</li>
<li class="class-depth-1">
<a href="Phaser.World.html">World</a>
</li>
<li class="class-depth-1">
<a href="PIXI.AbstractFilter.html">AbstractFilter</a>
</li>
<li class="class-depth-1">
<a href="PIXI.BaseTexture.html">BaseTexture</a>
</li>
<li class="class-depth-1">
<a href="PIXI.CanvasBuffer.html">CanvasBuffer</a>
</li>
<li class="class-depth-1">
<a href="PIXI.CanvasGraphics.html">CanvasGraphics</a>
</li>
<li class="class-depth-1">
<a href="PIXI.CanvasMaskManager.html">CanvasMaskManager</a>
</li>
<li class="class-depth-1">
<a href="PIXI.CanvasPool.html">CanvasPool</a>
</li>
<li class="class-depth-1">
<a href="PIXI.CanvasRenderer.html">CanvasRenderer</a>
</li>
<li class="class-depth-1">
<a href="PIXI.CanvasTinter.html">CanvasTinter</a>
</li>
<li class="class-depth-1">
<a href="PIXI.ComplexPrimitiveShader.html">ComplexPrimitiveShader</a>
</li>
<li class="class-depth-1">
<a href="PIXI.DisplayObject.html">DisplayObject</a>
</li>
<li class="class-depth-1">
<a href="PIXI.DisplayObjectContainer.html">DisplayObjectContainer</a>
</li>
<li class="class-depth-1">
<a href="PIXI.EarCut.html">EarCut</a>
</li>
<li class="class-depth-1">
<a href="PIXI.Event.html">Event</a>
</li>
<li class="class-depth-1">
<a href="PIXI.EventTarget.html">EventTarget</a>
</li>
<li class="class-depth-1">
<a href="PIXI.FilterTexture.html">FilterTexture</a>
</li>
<li class="class-depth-1">
<a href="PIXI.Graphics.html">Graphics</a>
</li>
<li class="class-depth-1">
<a href="PIXI.GraphicsData.html">GraphicsData</a>
</li>
<li class="class-depth-1">
<a href="PIXI.PIXI.html">PIXI</a>
</li>
<li class="class-depth-1">
<a href="PIXI.PixiFastShader.html">PixiFastShader</a>
</li>
<li class="class-depth-1">
<a href="PIXI.PixiShader.html">PixiShader</a>
</li>
<li class="class-depth-1">
<a href="PIXI.PolyK.html">PolyK</a>
</li>
<li class="class-depth-1">
<a href="PIXI.PrimitiveShader.html">PrimitiveShader</a>
</li>
<li class="class-depth-1">
<a href="PIXI.RenderTexture.html">RenderTexture</a>
</li>
<li class="class-depth-1">
<a href="PIXI.Rope.html">Rope</a>
</li>
<li class="class-depth-1">
<a href="PIXI.Sprite.html">Sprite</a>
</li>
<li class="class-depth-1">
<a href="PIXI.SpriteBatch.html">SpriteBatch</a>
</li>
<li class="class-depth-1">
<a href="PIXI.Strip.html">Strip</a>
</li>
<li class="class-depth-1">
<a href="PIXI.StripShader.html">StripShader</a>
</li>
<li class="class-depth-1">
<a href="PIXI.Texture.html">Texture</a>
</li>
<li class="class-depth-1">
<a href="PIXI.TilingSprite.html">TilingSprite</a>
</li>
<li class="class-depth-1">
<a href="PIXI.WebGLBlendModeManager.html">WebGLBlendModeManager</a>
</li>
<li class="class-depth-1">
<a href="PIXI.WebGLFastSpriteBatch.html">WebGLFastSpriteBatch</a>
</li>
<li class="class-depth-1">
<a href="PIXI.WebGLFilterManager.html">WebGLFilterManager</a>
</li>
<li class="class-depth-1">
<a href="PIXI.WebGLRenderer.html">WebGLRenderer</a>
</li>
</ul>
</li>
<li class="dropdown">
<a href="global.html" class="dropdown-toggle" data-toggle="dropdown">Global<b
class="caret"></b></a>
<ul class="dropdown-menu ">
<li class="class-depth-0">
<a href="global.html#AUTO">AUTO</a>
</li>
<li class="class-depth-0">
<a href="global.html#BITMAPDATA">BITMAPDATA</a>
</li>
<li class="class-depth-0">
<a href="global.html#BITMAPTEXT">BITMAPTEXT</a>
</li>
<li class="class-depth-0">
<a href="global.html#blendModes">blendModes</a>
</li>
<li class="class-depth-0">
<a href="global.html#BUTTON">BUTTON</a>
</li>
<li class="class-depth-0">
<a href="global.html#CANVAS">CANVAS</a>
</li>
<li class="class-depth-0">
<a href="global.html#CANVAS_FILTER">CANVAS_FILTER</a>
</li>
<li class="class-depth-0">
<a href="global.html#CIRCLE">CIRCLE</a>
</li>
<li class="class-depth-0">
<a href="global.html#CREATURE">CREATURE</a>
</li>
<li class="class-depth-0">
<a href="global.html#DOWN">DOWN</a>
</li>
<li class="class-depth-0">
<a href="global.html#ELLIPSE">ELLIPSE</a>
</li>
<li class="class-depth-0">
<a href="global.html#EMITTER">EMITTER</a>
</li>
<li class="class-depth-0">
<a href="global.html#GAMES">GAMES</a>
</li>
<li class="class-depth-0">
<a href="global.html#GRAPHICS">GRAPHICS</a>
</li>
<li class="class-depth-0">
<a href="global.html#GROUP">GROUP</a>
</li>
<li class="class-depth-0">
<a href="global.html#HEADLESS">HEADLESS</a>
</li>
<li class="class-depth-0">
<a href="global.html#IMAGE">IMAGE</a>
</li>
<li class="class-depth-0">
<a href="global.html#LEFT">LEFT</a>
</li>
<li class="class-depth-0">
<a href="global.html#LINE">LINE</a>
</li>
<li class="class-depth-0">
<a href="global.html#MATRIX">MATRIX</a>
</li>
<li class="class-depth-0">
<a href="global.html#NONE">NONE</a>
</li>
<li class="class-depth-0">
<a href="global.html#PENDING_ATLAS">PENDING_ATLAS</a>
</li>
<li class="class-depth-0">
<a href="global.html#POINT">POINT</a>
</li>
<li class="class-depth-0">
<a href="global.html#POINTER">POINTER</a>
</li>
<li class="class-depth-0">
<a href="global.html#POLYGON">POLYGON</a>
</li>
<li class="class-depth-0">
<a href="global.html#RECTANGLE">RECTANGLE</a>
</li>
<li class="class-depth-0">
<a href="global.html#RENDERTEXTURE">RENDERTEXTURE</a>
</li>
<li class="class-depth-0">
<a href="global.html#RETROFONT">RETROFONT</a>
</li>
<li class="class-depth-0">
<a href="global.html#RIGHT">RIGHT</a>
</li>
<li class="class-depth-0">
<a href="global.html#ROPE">ROPE</a>
</li>
<li class="class-depth-0">
<a href="global.html#ROUNDEDRECTANGLE">ROUNDEDRECTANGLE</a>
</li>
<li class="class-depth-0">
<a href="global.html#scaleModes">scaleModes</a>
</li>
<li class="class-depth-0">
<a href="global.html#SPRITE">SPRITE</a>
</li>
<li class="class-depth-0">
<a href="global.html#SPRITEBATCH">SPRITEBATCH</a>
</li>
<li class="class-depth-0">
<a href="global.html#TEXT">TEXT</a>
</li>
<li class="class-depth-0">
<a href="global.html#TILEMAP">TILEMAP</a>
</li>
<li class="class-depth-0">
<a href="global.html#TILEMAPLAYER">TILEMAPLAYER</a>
</li>
<li class="class-depth-0">
<a href="global.html#TILESPRITE">TILESPRITE</a>
</li>
<li class="class-depth-0">
<a href="global.html#UP">UP</a>
</li>
<li class="class-depth-0">
<a href="global.html#VERSION">VERSION</a>
</li>
<li class="class-depth-0">
<a href="global.html#VIDEO">VIDEO</a>
</li>
<li class="class-depth-0">
<a href="global.html#WEBGL">WEBGL</a>
</li>
<li class="class-depth-0">
<a href="global.html#WEBGL_FILTER">WEBGL_FILTER</a>
</li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Core<b class="caret"></b></a>
<ul class="dropdown-menu ">
<li class="class-depth-1"><a href="Phaser.Game.html">Game</a></li>
<li class="class-depth-1"><a href="Phaser.Group.html">Group</a></li>
<li class="class-depth-1"><a href="Phaser.World.html">World</a></li>
<li class="class-depth-1"><a href="Phaser.Loader.html">Loader</a></li>
<li class="class-depth-1"><a href="Phaser.Cache.html">Cache</a></li>
<li class="class-depth-1"><a href="Phaser.Time.html">Time</a></li>
<li class="class-depth-1"><a href="Phaser.Camera.html">Camera</a></li>
<li class="class-depth-1"><a href="Phaser.StateManager.html">State Manager</a></li>
<li class="class-depth-1"><a href="Phaser.TweenManager.html">Tween Manager</a></li>
<li class="class-depth-1"><a href="Phaser.SoundManager.html">Sound Manager</a></li>
<li class="class-depth-1"><a href="Phaser.Input.html">Input Manager</a></li>
<li class="class-depth-1"><a href="Phaser.ScaleManager.html">Scale Manager</a></li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Game Objects<b class="caret"></b></a>
<ul class="dropdown-menu ">
<li class="class-depth-1"><a href="Phaser.GameObjectFactory.html">Factory (game.add)</a></li>
<li class="class-depth-1"><a href="Phaser.GameObjectCreator.html">Creator (game.make)</a></li>
<li class="class-depth-1"><a href="Phaser.Sprite.html">Sprite</a></li>
<li class="class-depth-1"><a href="Phaser.Image.html">Image</a></li>
<li class="class-depth-1"><a href="Phaser.Sound.html">Sound</a></li>
<li class="class-depth-1"><a href="Phaser.Video.html">Video</a></li>
<li class="class-depth-1"><a href="Phaser.Particles.Arcade.Emitter.html">Particle Emitter</a></li>
<li class="class-depth-1"><a href="Phaser.Particle.html">Particle</a></li>
<li class="class-depth-1"><a href="Phaser.Text.html">Text</a></li>
<li class="class-depth-1"><a href="Phaser.Tween.html">Tween</a></li>
<li class="class-depth-1"><a href="Phaser.BitmapText.html">BitmapText</a></li>
<li class="class-depth-1"><a href="Phaser.Tilemap.html">Tilemap</a></li>
<li class="class-depth-1"><a href="Phaser.BitmapData.html">BitmapData</a></li>
<li class="class-depth-1"><a href="Phaser.RetroFont.html">RetroFont</a></li>
<li class="class-depth-1"><a href="Phaser.Button.html">Button</a></li>
<li class="class-depth-1"><a href="Phaser.Animation.html">Animation</a></li>
<li class="class-depth-1"><a href="Phaser.Graphics.html">Graphics</a></li>
<li class="class-depth-1"><a href="Phaser.RenderTexture.html">RenderTexture</a></li>
<li class="class-depth-1"><a href="Phaser.TileSprite.html">TileSprite</a></li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Geometry<b class="caret"></b></a>
<ul class="dropdown-menu ">
<li class="class-depth-1"><a href="Phaser.Circle.html">Circle</a></li>
<li class="class-depth-1"><a href="Phaser.Ellipse.html">Ellipse</a></li>
<li class="class-depth-1"><a href="Phaser.Line.html">Line</a></li>
<li class="class-depth-1"><a href="Phaser.Matrix.html">Matrix</a></li>
<li class="class-depth-1"><a href="Phaser.Point.html">Point</a></li>
<li class="class-depth-1"><a href="Phaser.Polygon.html">Polygon</a></li>
<li class="class-depth-1"><a href="Phaser.Rectangle.html">Rectangle</a></li>
<li class="class-depth-1"><a href="Phaser.RoundedRectangle.html">Rounded Rectangle</a></li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Physics<b class="caret"></b></a>
<ul class="dropdown-menu ">
<li class="class-depth-1"><a href="Phaser.Physics.Arcade.html">Arcade Physics</a></li>
<li class="class-depth-2"><a href="Phaser.Physics.Arcade.Body.html">Body</a></li>
<li class="class-depth-1"><a href="Phaser.Physics.P2.html">P2 Physics</a></li>
<li class="class-depth-2"><a href="Phaser.Physics.P2.Body.html">Body</a></li>
<li class="class-depth-2"><a href="Phaser.Physics.P2.Spring.html">Spring</a></li>
<li class="class-depth-2"><a href="Phaser.Physics.P2.CollisionGroup.html">CollisionGroup</a></li>
<li class="class-depth-2"><a href="Phaser.Physics.P2.ContactMaterial.html">ContactMaterial</a></li>
<li class="class-depth-1"><a href="Phaser.Physics.Ninja.html">Ninja Physics</a></li>
<li class="class-depth-2"><a href="Phaser.Physics.Body.html">Body</a></li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Input<b class="caret"></b></a>
<ul class="dropdown-menu ">
<li class="class-depth-1"><a href="Phaser.InputHandler.html">Input Handler</a></li>
<li class="class-depth-1"><a href="Phaser.Pointer.html">Pointer</a></li>
<li class="class-depth-1"><a href="Phaser.DeviceButton.html">Device Button</a></li>
<li class="class-depth-1"><a href="Phaser.Mouse.html">Mouse</a></li>
<li class="class-depth-1"><a href="Phaser.Keyboard.html">Keyboard</a></li>
<li class="class-depth-1"><a href="Phaser.Key.html">Key</a></li>
<li class="class-depth-1"><a href="Phaser.Gamepad.html">Gamepad</a></li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Community<b class="caret"></b></a>
<ul class="dropdown-menu ">
<li class="class-depth-1"><a href="http://phaser.io">Phaser Web Site</a></li>
<li class="class-depth-1"><a href="https://github.com/photonstorm/phaser">Phaser Github</a></li>
<li class="class-depth-1"><a href="http://phaser.io/examples">Phaser Examples</a></li>
<li class="class-depth-1"><a href="https://github.com/photonstorm/phaser-plugins">Phaser Plugins</a></li>
<li class="class-depth-1"><a href="http://www.html5gamedevs.com/forum/14-phaser/">Forum</a></li>
<li class="class-depth-1"><a href="http://stackoverflow.com/questions/tagged/phaser-framework">Stack Overflow</a></li>
<li class="class-depth-1"><a href="http://phaser.io/learn">Tutorials</a></li>
<li class="class-depth-1"><a href="https://confirmsubscription.com/h/r/369DE48E3E86AF1E">Newsletter</a></li>
<li class="class-depth-1"><a href="http://phaser.io/community/twitter">Twitter</a></li>
<li class="class-depth-1"><a href="http://phaser.io/community/irc">IRC</a></li>
<li class="class-depth-1"><a href="https://www.codeandweb.com/texturepacker/phaser">Texture Packer</a></li>
</ul>
</li>
</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>
</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.
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 -
<a href="src_physics_p2_Body.js.html">physics/p2/Body.js</a>, <a href="src_physics_p2_Body.js.html#sunlight-1-line-23">line 23</a>
</dt>
</dl>
</dd>
</div>
<h3 class="subsection-title">Members</h3>
<dl>
<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. Dynamic bodies body can move and respond to collisions and forces.</p>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_physics_p2_Body.js.html">physics/p2/Body.js</a>, <a href="src_physics_p2_Body.js.html#sunlight-1-line-1498">line 1498</a>
</dt>
</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. Kinematic bodies only moves according to its .velocity, and does not respond to collisions or force.</p>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_physics_p2_Body.js.html">physics/p2/Body.js</a>, <a href="src_physics_p2_Body.js.html#sunlight-1-line-1514">line 1514</a>
</dt>
</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. Static bodies do not move, and they do not respond to forces or collision.</p>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_physics_p2_Body.js.html">physics/p2/Body.js</a>, <a href="src_physics_p2_Body.js.html#sunlight-1-line-1506">line 1506</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id="allowSleep"><span class="type-signature"></span>allowSleep<span class="type-signature"> :boolean</span></h4>
</dt>
<dd>
<div class="description">
<p>-</p>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_physics_p2_Body.js.html">physics/p2/Body.js</a>, <a href="src_physics_p2_Body.js.html#sunlight-1-line-1603">line 1603</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id="angle"><span class="type-signature"></span>angle<span class="type-signature"> :number</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. The angle of this Body in degrees.</p>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_physics_p2_Body.js.html">physics/p2/Body.js</a>, <a href="src_physics_p2_Body.js.html#sunlight-1-line-1626">line 1626</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id="angularDamping"><span class="type-signature"></span>angularDamping<span class="type-signature"> :number</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. The angular damping acting acting on the body.</p>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_physics_p2_Body.js.html">physics/p2/Body.js</a>, <a href="src_physics_p2_Body.js.html#sunlight-1-line-1650">line 1650</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id="angularForce"><span class="type-signature"></span>angularForce<span class="type-signature"> :number</span></h4>
</dt>
<dd>
<div class="description">
<p>The angular force acting on the body.</p>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_physics_p2_Body.js.html">physics/p2/Body.js</a>, <a href="src_physics_p2_Body.js.html#sunlight-1-line-1671">line 1671</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id="angularVelocity"><span class="type-signature"></span>angularVelocity<span class="type-signature"> :number</span></h4>
</dt>
<dd>
<div class="description">
<p>The angular velocity of the body.</p>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_physics_p2_Body.js.html">physics/p2/Body.js</a>, <a href="src_physics_p2_Body.js.html#sunlight-1-line-1691">line 1691</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id="collidesWith"><span class="type-signature"></span>collidesWith<span class="type-signature"> :array</span></h4>
</dt>
<dd>
<div class="description">
<p>Array of CollisionGroups that this Bodies shapes collide with.</p>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_physics_p2_Body.js.html">physics/p2/Body.js</a>, <a href="src_physics_p2_Body.js.html#sunlight-1-line-112">line 112</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id="collideWorldBounds"><span class="type-signature"></span>collideWorldBounds<span class="type-signature"> :boolean</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.
Also note that when you set this it will only effect Body shapes that already exist. If you then add further shapes to your Body
after setting this it will <em>not</em> proactively set them to collide with the bounds. Should the Body collide with the World bounds?</p>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_physics_p2_Body.js.html">physics/p2/Body.js</a>, <a href="src_physics_p2_Body.js.html#sunlight-1-line-1949">line 1949</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id="damping"><span class="type-signature"></span>damping<span class="type-signature"> :number</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. The linear damping acting on the body in the velocity direction.</p>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_physics_p2_Body.js.html">physics/p2/Body.js</a>, <a href="src_physics_p2_Body.js.html#sunlight-1-line-1711">line 1711</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id="data"><span class="type-signature">&lt;internal> </span>data<span class="type-signature"> :<a href="p2.Body.html">p2.Body</a></span></h4>
</dt>
<dd>
<div class="description">
<p>The p2 Body data.</p>
</div>
<dl class="details">
<dt class="important tag-deprecated">Internal:</dt>
<dd class="tag-deprecated"><ul>
<li>This member is <em>internal (protected)</em> and may be modified or removed in the future.</li>
</ul></dd>
<dt class="tag-source">Source -
<a href="src_physics_p2_Body.js.html">physics/p2/Body.js</a>, <a href="src_physics_p2_Body.js.html#sunlight-1-line-59">line 59</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id="debug"><span class="type-signature"></span>debug<span class="type-signature"> :boolean</span></h4>
</dt>
<dd>
<div class="description">
<p>Enable or disable debug drawing of this body</p>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_physics_p2_Body.js.html">physics/p2/Body.js</a>, <a href="src_physics_p2_Body.js.html#sunlight-1-line-1920">line 1920</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id="debugBody"><span class="type-signature"></span>debugBody<span class="type-signature"> :<a href="Phaser.Physics.P2.BodyDebug.html">Phaser.Physics.P2.BodyDebug</a></span></h4>
</dt>
<dd>
<div class="description">
<p>Reference to the debug body.</p>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_physics_p2_Body.js.html">physics/p2/Body.js</a>, <a href="src_physics_p2_Body.js.html#sunlight-1-line-122">line 122</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id="dirty"><span class="type-signature"></span>dirty<span class="type-signature"> :boolean</span></h4>
</dt>
<dd>
<div class="description">
<p>Internally used by Sprite.x/y</p>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_physics_p2_Body.js.html">physics/p2/Body.js</a>, <a href="src_physics_p2_Body.js.html#sunlight-1-line-127">line 127</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id="dynamic"><span class="type-signature"></span>dynamic<span class="type-signature"> :boolean</span></h4>
</dt>
<dd>
<div class="description">
<p>Returns true if the Body is dynamic. Setting Body.dynamic to 'false' will make it static.</p>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_physics_p2_Body.js.html">physics/p2/Body.js</a>, <a href="src_physics_p2_Body.js.html#sunlight-1-line-1545">line 1545</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id="fixedRotation"><span class="type-signature"></span>fixedRotation<span class="type-signature"> :boolean</span></h4>
</dt>
<dd>
<div class="description">
<p>-</p>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_physics_p2_Body.js.html">physics/p2/Body.js</a>, <a href="src_physics_p2_Body.js.html#sunlight-1-line-1732">line 1732</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id="force"><span class="type-signature"></span>force<span class="type-signature"> :<a href="Phaser.Physics.P2.InversePointProxy.html">Phaser.Physics.P2.InversePointProxy</a></span></h4>
</dt>
<dd>
<div class="description">
<p>The force applied to the body.</p>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_physics_p2_Body.js.html">physics/p2/Body.js</a>, <a href="src_physics_p2_Body.js.html#sunlight-1-line-71">line 71</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id="game"><span class="type-signature"></span>game<span class="type-signature"> :<a href="Phaser.Game.html">Phaser.Game</a></span></h4>
</dt>
<dd>
<div class="description">
<p>Local reference to game.</p>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_physics_p2_Body.js.html">physics/p2/Body.js</a>, <a href="src_physics_p2_Body.js.html#sunlight-1-line-33">line 33</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id="gravity"><span class="type-signature"></span>gravity<span class="type-signature"> :<a href="Phaser.Point.html">Phaser.Point</a></span></h4>
</dt>
<dd>
<div class="description">
<p>A locally applied gravity force to the Body. Applied directly before the world step. NOTE: Not currently implemented.</p>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_physics_p2_Body.js.html">physics/p2/Body.js</a>, <a href="src_physics_p2_Body.js.html#sunlight-1-line-76">line 76</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id="id"><span class="type-signature">&lt;readonly> </span>id<span class="type-signature"> :number</span></h4>
</dt>
<dd>
<div class="description">
<p>The Body ID. Each Body that has been added to the World has a unique ID.</p>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_physics_p2_Body.js.html">physics/p2/Body.js</a>, <a href="src_physics_p2_Body.js.html#sunlight-1-line-1905">line 1905</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id="inertia"><span class="type-signature"></span>inertia<span class="type-signature"> :number</span></h4>
</dt>
<dd>
<div class="description">
<p>The inertia of the body around the Z axis..</p>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_physics_p2_Body.js.html">physics/p2/Body.js</a>, <a href="src_physics_p2_Body.js.html#sunlight-1-line-1755">line 1755</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id="kinematic"><span class="type-signature"></span>kinematic<span class="type-signature"> :boolean</span></h4>
</dt>
<dd>
<div class="description">
<p>Returns true if the Body is kinematic. Setting Body.kinematic to 'false' will make it static.</p>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_physics_p2_Body.js.html">physics/p2/Body.js</a>, <a href="src_physics_p2_Body.js.html#sunlight-1-line-1574">line 1574</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id="mass"><span class="type-signature"></span>mass<span class="type-signature"> :number</span></h4>
</dt>
<dd>
<div class="description">
<p>The mass of the body.</p>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_physics_p2_Body.js.html">physics/p2/Body.js</a>, <a href="src_physics_p2_Body.js.html#sunlight-1-line-1775">line 1775</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id="motionState"><span class="type-signature"></span>motionState<span class="type-signature"> :number</span></h4>
</dt>
<dd>
<div class="description">
<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>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_physics_p2_Body.js.html">physics/p2/Body.js</a>, <a href="src_physics_p2_Body.js.html#sunlight-1-line-1799">line 1799</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id="offset"><span class="type-signature"></span>offset<span class="type-signature"> :<a href="Phaser.Point.html">Phaser.Point</a></span></h4>
</dt>
<dd>
<div class="description">
<p>The offset of the Physics Body from the Sprite x/y position.</p>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_physics_p2_Body.js.html">physics/p2/Body.js</a>, <a href="src_physics_p2_Body.js.html#sunlight-1-line-53">line 53</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id="onBeginContact"><span class="type-signature"></span>onBeginContact<span class="type-signature"> :<a href="Phaser.Signal.html">Phaser.Signal</a></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.</p>
<p>The event will be sent 5 arguments in this order:</p>
<p>The Phaser.Physics.P2.Body it is in contact with. <em>This might be null</em> if the Body was created directly in the p2 world.
The p2.Body this Body is in contact with.
The Shape from this body that caused the contact.
The Shape from the contact body.
The Contact Equation data array.</p>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_physics_p2_Body.js.html">physics/p2/Body.js</a>, <a href="src_physics_p2_Body.js.html#sunlight-1-line-92">line 92</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id="onEndContact"><span class="type-signature"></span>onEndContact<span class="type-signature"> :<a href="Phaser.Signal.html">Phaser.Signal</a></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.</p>
<p>The event will be sent 4 arguments in this order:</p>
<p>The Phaser.Physics.P2.Body it is in contact with. <em>This might be null</em> if the Body was created directly in the p2 world.
The p2.Body this Body has ended contact with.
The Shape from this body that caused the original contact.
The Shape from the contact body.</p>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_physics_p2_Body.js.html">physics/p2/Body.js</a>, <a href="src_physics_p2_Body.js.html#sunlight-1-line-107">line 107</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id="removeNextStep"><span class="type-signature"></span>removeNextStep<span class="type-signature"> :boolean</span></h4>
</dt>
<dd>
<div class="description">
<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>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_physics_p2_Body.js.html">physics/p2/Body.js</a>, <a href="src_physics_p2_Body.js.html#sunlight-1-line-117">line 117</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id="rotation"><span class="type-signature"></span>rotation<span class="type-signature"> :number</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. The angle of this Body in radians.</p>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_physics_p2_Body.js.html">physics/p2/Body.js</a>, <a href="src_physics_p2_Body.js.html#sunlight-1-line-1822">line 1822</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id="sleepSpeedLimit"><span class="type-signature"></span>sleepSpeedLimit<span class="type-signature"> :number</span></h4>
</dt>
<dd>
<div class="description">
<p>.</p>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_physics_p2_Body.js.html">physics/p2/Body.js</a>, <a href="src_physics_p2_Body.js.html#sunlight-1-line-1845">line 1845</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id="sprite"><span class="type-signature"></span>sprite<span class="type-signature"> :<a href="Phaser.Sprite.html">Phaser.Sprite</a></span></h4>
</dt>
<dd>
<div class="description">
<p>Reference to the parent Sprite.</p>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_physics_p2_Body.js.html">physics/p2/Body.js</a>, <a href="src_physics_p2_Body.js.html#sunlight-1-line-43">line 43</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id="static"><span class="type-signature"></span>static<span class="type-signature"> :boolean</span></h4>
</dt>
<dd>
<div class="description">
<p>Returns true if the Body is static. Setting Body.static to 'false' will make it dynamic.</p>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_physics_p2_Body.js.html">physics/p2/Body.js</a>, <a href="src_physics_p2_Body.js.html#sunlight-1-line-1516">line 1516</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id="type"><span class="type-signature"></span>type<span class="type-signature"> :number</span></h4>
</dt>
<dd>
<div class="description">
<p>The type of physics system this body belongs to.</p>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_physics_p2_Body.js.html">physics/p2/Body.js</a>, <a href="src_physics_p2_Body.js.html#sunlight-1-line-48">line 48</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id="velocity"><span class="type-signature"></span>velocity<span class="type-signature"> :<a href="Phaser.Physics.P2.InversePointProxy.html">Phaser.Physics.P2.InversePointProxy</a></span></h4>
</dt>
<dd>
<div class="description">
<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>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_physics_p2_Body.js.html">physics/p2/Body.js</a>, <a href="src_physics_p2_Body.js.html#sunlight-1-line-66">line 66</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id="world"><span class="type-signature"></span>world<span class="type-signature"> :<a href="Phaser.Physics.P2.html">Phaser.Physics.P2</a></span></h4>
</dt>
<dd>
<div class="description">
<p>Local reference to the P2 World.</p>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_physics_p2_Body.js.html">physics/p2/Body.js</a>, <a href="src_physics_p2_Body.js.html#sunlight-1-line-38">line 38</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id="x"><span class="type-signature"></span>x<span class="type-signature"> :number</span></h4>
</dt>
<dd>
<div class="description">
<p>The x coordinate of this Body.</p>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_physics_p2_Body.js.html">physics/p2/Body.js</a>, <a href="src_physics_p2_Body.js.html#sunlight-1-line-1865">line 1865</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id="y"><span class="type-signature"></span>y<span class="type-signature"> :number</span></h4>
</dt>
<dd>
<div class="description">
<p>The y coordinate of this Body.</p>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_physics_p2_Body.js.html">physics/p2/Body.js</a>, <a href="src_physics_p2_Body.js.html#sunlight-1-line-1885">line 1885</a>
</dt>
</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 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>
<h5>Returns:</h5>
<div class="returns">
<div class="returns-type">
<span class="param-type">p2.Capsule</span>
-
</div>
<div class="returns-desc param-desc">
<p>The Capsule shape that was added to the Body.</p>
</div>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_physics_p2_Body.js.html">physics/p2/Body.js</a>, <a href="src_physics_p2_Body.js.html#sunlight-1-line-1108">line 1108</a>
</dt>
</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>
<h5>Returns:</h5>
<div class="returns">
<div class="returns-type">
<span class="param-type">p2.Circle</span>
-
</div>
<div class="returns-desc param-desc">
<p>The Circle shape that was added to the Body.</p>
</div>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_physics_p2_Body.js.html">physics/p2/Body.js</a>, <a href="src_physics_p2_Body.js.html#sunlight-1-line-1017">line 1017</a>
</dt>
</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">
<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>
<h5>Returns:</h5>
<div class="returns">
<div class="returns-type">
<span class="param-type">array</span>
-
</div>
<div class="returns-desc param-desc">
<p>An array containing the generated shapes for the given polygon.</p>
</div>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_physics_p2_Body.js.html">physics/p2/Body.js</a>, <a href="src_physics_p2_Body.js.html#sunlight-1-line-1350">line 1350</a>
</dt>
</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>
<h5>Returns:</h5>
<div class="returns">
<div class="returns-type">
<span class="param-type">p2.Line</span>
-
</div>
<div class="returns-desc param-desc">
<p>The Line shape that was added to the Body.</p>
</div>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_physics_p2_Body.js.html">physics/p2/Body.js</a>, <a href="src_physics_p2_Body.js.html#sunlight-1-line-1088">line 1088</a>
</dt>
</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>
<h5>Returns:</h5>
<div class="returns">
<div class="returns-type">
<span class="param-type">p2.Particle</span>
-
</div>
<div class="returns-desc param-desc">
<p>The Particle shape that was added to the Body.</p>
</div>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_physics_p2_Body.js.html">physics/p2/Body.js</a>, <a href="src_physics_p2_Body.js.html#sunlight-1-line-1071">line 1071</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id="addPhaserPolygon"><span class="type-signature"></span>addPhaserPolygon<span class="signature">(key, object)</span><span class="type-signature"> &rarr; {Array}</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 output of the
<a href="https://github.com/photonstorm/phaser/tree/master/resources/PhysicsEditor%2520Exporter">custom phaser exporter</a> for
<a href="https://www.codeandweb.com/physicseditor">PhysicsEditor</a></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>
<h5>Returns:</h5>
<div class="returns">
<div class="returns-type">
<span class="param-type">Array</span>
-
</div>
<div class="returns-desc param-desc">
<p>A list of created fixtures to be used with Phaser.Physics.P2.FixtureList</p>
</div>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_physics_p2_Body.js.html">physics/p2/Body.js</a>, <a href="src_physics_p2_Body.js.html#sunlight-1-line-1310">line 1310</a>
</dt>
</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>
<h5>Returns:</h5>
<div class="returns">
<div class="returns-type">
<span class="param-type">p2.Plane</span>
-
</div>
<div class="returns-desc param-desc">
<p>The Plane shape that was added to the Body.</p>
</div>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_physics_p2_Body.js.html">physics/p2/Body.js</a>, <a href="src_physics_p2_Body.js.html#sunlight-1-line-1054">line 1054</a>
</dt>
</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>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
false
</td>
<td class="description last"><p>Set to a number (angle threshold value) to remove collinear points, or false to keep all points.</p></td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td class="name"><code>points</code></td>
<td class="type">
<span class="param-type">Array.&lt;number></span>
|
<span class="param-type">number</span>
</td>
<td class="description last"><p>An array of 2d vectors that form the convex or concave polygon.
Either [[0,0], [0,1],...] or a flat array of numbers that will be interpreted as [x,y, x,y, ...],
or the arguments passed can be flat x,y values e.g. <code>setPolygon(options, x,y, x,y, x,y, ...)</code> where <code>x</code> and <code>y</code> are numbers.</p></td>
</tr>
</tbody>
</table>
<h5>Returns:</h5>
<div class="returns">
<div class="returns-type">
<span class="param-type">boolean</span>
-
</div>
<div class="returns-desc param-desc">
<p>True on success, else false.</p>
</div>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_physics_p2_Body.js.html">physics/p2/Body.js</a>, <a href="src_physics_p2_Body.js.html#sunlight-1-line-1128">line 1128</a>
</dt>
</dl>
</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.Box}</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>
<h5>Returns:</h5>
<div class="returns">
<div class="returns-type">
<span class="param-type">p2.Box</span>
-
</div>
<div class="returns-desc param-desc">
<p>The shape that was added to the Body.</p>
</div>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_physics_p2_Body.js.html">physics/p2/Body.js</a>, <a href="src_physics_p2_Body.js.html#sunlight-1-line-1035">line 1035</a>
</dt>
</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.
If this Body had a previously set Collision Group you will need to re-apply it to the new Shape this creates.</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>
<h5>Returns:</h5>
<div class="returns">
<div class="returns-type">
<span class="param-type">p2.Shape</span>
-
</div>
<div class="returns-desc param-desc">
<p>The shape that was added to the body.</p>
</div>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_physics_p2_Body.js.html">physics/p2/Body.js</a>, <a href="src_physics_p2_Body.js.html#sunlight-1-line-992">line 992</a>
</dt>
</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 -
<a href="src_physics_p2_Body.js.html">physics/p2/Body.js</a>, <a href="src_physics_p2_Body.js.html#sunlight-1-line-904">line 904</a>
</dt>
</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 -
<a href="src_physics_p2_Body.js.html">physics/p2/Body.js</a>, <a href="src_physics_p2_Body.js.html#sunlight-1-line-490">line 490</a>
</dt>
</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 http://code.google.com/p/bullet/issues/detail?id=74 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 -
<a href="src_physics_p2_Body.js.html">physics/p2/Body.js</a>, <a href="src_physics_p2_Body.js.html#sunlight-1-line-516">line 516</a>
</dt>
</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.</p>
<p>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">
<span class="param-type">Float32Array</span>
|
<span class="param-type">Array</span>
</td>
<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 -
<a href="src_physics_p2_Body.js.html">physics/p2/Body.js</a>, <a href="src_physics_p2_Body.js.html#sunlight-1-line-561">line 561</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id="applyImpulse"><span class="type-signature"></span>applyImpulse<span class="signature">(impulse, worldX, worldY)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>Apply impulse to a point relative to the body.
This could for example be a point on the Body surface. An impulse is a force added to a body during a short
period of time (impulse = force * time). Impulses will be added to Body.velocity and Body.angularVelocity.</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>impulse</code></td>
<td class="type">
<span class="param-type">Float32Array</span>
|
<span class="param-type">Array</span>
</td>
<td class="description last"><p>The impulse vector to add, oriented in world space.</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>A point relative to the body in world space. If not given, it is set to zero and all of the impulse will be exerted on the center of mass.</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>A point relative to the body in world space. If not given, it is set to zero and all of the impulse will be exerted on the center of mass.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_physics_p2_Body.js.html">physics/p2/Body.js</a>, <a href="src_physics_p2_Body.js.html#sunlight-1-line-528">line 528</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id="applyImpulseLocal"><span class="type-signature"></span>applyImpulseLocal<span class="signature">(impulse, localX, localY)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>Apply impulse to a point local to the body.</p>
<p>This could for example be a point on the Body surface. An impulse is a force added to a body during a short
period of time (impulse = force * time). Impulses will be added to Body.velocity and Body.angularVelocity.</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>impulse</code></td>
<td class="type">
<span class="param-type">Float32Array</span>
|
<span class="param-type">Array</span>
</td>
<td class="description last"><p>The impulse vector to add, oriented in local space.</p></td>
</tr>
<tr>
<td class="name"><code>localX</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>A local point on the body.</p></td>
</tr>
<tr>
<td class="name"><code>localY</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>A local point on the body.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_physics_p2_Body.js.html">physics/p2/Body.js</a>, <a href="src_physics_p2_Body.js.html#sunlight-1-line-544">line 544</a>
</dt>
</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 -
<a href="src_physics_p2_Body.js.html">physics/p2/Body.js</a>, <a href="src_physics_p2_Body.js.html#sunlight-1-line-323">line 323</a>
</dt>
</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 -
<a href="src_physics_p2_Body.js.html">physics/p2/Body.js</a>, <a href="src_physics_p2_Body.js.html#sunlight-1-line-974">line 974</a>
</dt>
</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 -
<a href="src_physics_p2_Body.js.html">physics/p2/Body.js</a>, <a href="src_physics_p2_Body.js.html#sunlight-1-line-435">line 435</a>
</dt>
</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 -
<a href="src_physics_p2_Body.js.html">physics/p2/Body.js</a>, <a href="src_physics_p2_Body.js.html#sunlight-1-line-180">line 180</a>
</dt>
</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 -
<a href="src_physics_p2_Body.js.html">physics/p2/Body.js</a>, <a href="src_physics_p2_Body.js.html#sunlight-1-line-220">line 220</a>
</dt>
</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 -
<a href="src_physics_p2_Body.js.html">physics/p2/Body.js</a>, <a href="src_physics_p2_Body.js.html#sunlight-1-line-943">line 943</a>
</dt>
</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>
<h5>Returns:</h5>
<div class="returns">
<div class="returns-type">
<span class="param-type">number</span>
-
</div>
<div class="returns-desc param-desc">
<p>The bitmask.</p>
</div>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_physics_p2_Body.js.html">physics/p2/Body.js</a>, <a href="src_physics_p2_Body.js.html#sunlight-1-line-247">line 247</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id="getVelocityAtPoint"><span class="type-signature"></span>getVelocityAtPoint<span class="signature">(result, relativePoint)</span><span class="type-signature"> &rarr; {Array}</span></h4>
</dt>
<dd>
<div class="description">
<p>Gets the velocity of a point in the 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>result</code></td>
<td class="type">
<span class="param-type">Array</span>
</td>
<td class="description last"><p>A vector to store the result in.</p></td>
</tr>
<tr>
<td class="name"><code>relativePoint</code></td>
<td class="type">
<span class="param-type">Array</span>
</td>
<td class="description last"><p>A world oriented vector, indicating the position of the point to get the velocity from.</p></td>
</tr>
</tbody>
</table>
<h5>Returns:</h5>
<div class="returns">
<div class="returns-type">
<span class="param-type">Array</span>
-
</div>
<div class="returns-desc param-desc">
<p>The result vector.</p>
</div>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_physics_p2_Body.js.html">physics/p2/Body.js</a>, <a href="src_physics_p2_Body.js.html#sunlight-1-line-502">line 502</a>
</dt>
</dl>
</dd>
<dt>
<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">
<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>
<p>As well as reading the data from the Cache you can also pass <code>null</code> as the first argument and a
physics data object as the second. When doing this you must ensure the structure of the object is correct in advance.</p>
<p>For more details see the format of the Lime / Corona Physics Editor export.</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. Alternatively set to <code>null</code> and pass the
data as the 2nd argument.</p></td>
</tr>
<tr>
<td class="name"><code>object</code></td>
<td class="type">
<span class="param-type">string</span>
|
<span class="param-type">object</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,
or if key is null pass the actual physics data object itself as this parameter.</p></td>
</tr>
</tbody>
</table>
<h5>Returns:</h5>
<div class="returns">
<div class="returns-type">
<span class="param-type">boolean</span>
-
</div>
<div class="returns-desc param-desc">
<p>True on success, else false.</p>
</div>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_physics_p2_Body.js.html">physics/p2/Body.js</a>, <a href="src_physics_p2_Body.js.html#sunlight-1-line-1422">line 1422</a>
</dt>
</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 -
<a href="src_physics_p2_Body.js.html">physics/p2/Body.js</a>, <a href="src_physics_p2_Body.js.html#sunlight-1-line-691">line 691</a>
</dt>
</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 -
<a href="src_physics_p2_Body.js.html">physics/p2/Body.js</a>, <a href="src_physics_p2_Body.js.html#sunlight-1-line-815">line 815</a>
</dt>
</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 -
<a href="src_physics_p2_Body.js.html">physics/p2/Body.js</a>, <a href="src_physics_p2_Body.js.html#sunlight-1-line-674">line 674</a>
</dt>
</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 -
<a href="src_physics_p2_Body.js.html">physics/p2/Body.js</a>, <a href="src_physics_p2_Body.js.html#sunlight-1-line-776">line 776</a>
</dt>
</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 -
<a href="src_physics_p2_Body.js.html">physics/p2/Body.js</a>, <a href="src_physics_p2_Body.js.html#sunlight-1-line-789">line 789</a>
</dt>
</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 -
<a href="src_physics_p2_Body.js.html">physics/p2/Body.js</a>, <a href="src_physics_p2_Body.js.html#sunlight-1-line-802">line 802</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id="postUpdate"><span class="type-signature">&lt;internal> </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="important tag-deprecated">Internal:</dt>
<dd class="tag-deprecated"><ul>
<li>This member is <em>internal (protected)</em> and may be modified or removed in the future.</li>
</ul></dd>
<dt class="tag-source">Source -
<a href="src_physics_p2_Body.js.html">physics/p2/Body.js</a>, <a href="src_physics_p2_Body.js.html#sunlight-1-line-846">line 846</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id="preUpdate"><span class="type-signature">&lt;internal> </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="important tag-deprecated">Internal:</dt>
<dd class="tag-deprecated"><ul>
<li>This member is <em>internal (protected)</em> and may be modified or removed in the future.</li>
</ul></dd>
<dt class="tag-source">Source -
<a href="src_physics_p2_Body.js.html">physics/p2/Body.js</a>, <a href="src_physics_p2_Body.js.html#sunlight-1-line-828">line 828</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id="removeCollisionGroup"><span class="type-signature"></span>removeCollisionGroup<span class="signature">(group, <span class="optional">clearCallback</span>, <span class="optional">shape</span>)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
<p>Removes the given CollisionGroup, or array of CollisionGroups, from 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>Default</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="default">
</td>
<td class="description last"><p>The Collision Group or Array of Collision Groups that this Bodies shapes should not collide with anymore.</p></td>
</tr>
<tr>
<td class="name"><code>clearCallback</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 callback that will be triggered when this Body impacts with the given Group?</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 updated collision mask will be added to all Shapes in this Body.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_physics_p2_Body.js.html">physics/p2/Body.js</a>, <a href="src_physics_p2_Body.js.html#sunlight-1-line-371">line 371</a>
</dt>
</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 -
<a href="src_physics_p2_Body.js.html">physics/p2/Body.js</a>, <a href="src_physics_p2_Body.js.html#sunlight-1-line-929">line 929</a>
</dt>
</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>
<h5>Returns:</h5>
<div class="returns">
<div class="returns-type">
<span class="param-type">boolean</span>
-
</div>
<div class="returns-desc param-desc">
<p>True if the shape was found and removed, else false.</p>
</div>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_physics_p2_Body.js.html">physics/p2/Body.js</a>, <a href="src_physics_p2_Body.js.html#sunlight-1-line-1194">line 1194</a>
</dt>
</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 -
<a href="src_physics_p2_Body.js.html">physics/p2/Body.js</a>, <a href="src_physics_p2_Body.js.html#sunlight-1-line-871">line 871</a>
</dt>
</dl>
</dd>
<dt>
<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 -
<a href="src_physics_p2_Body.js.html">physics/p2/Body.js</a>, <a href="src_physics_p2_Body.js.html#sunlight-1-line-759">line 759</a>
</dt>
</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 -
<a href="src_physics_p2_Body.js.html">physics/p2/Body.js</a>, <a href="src_physics_p2_Body.js.html#sunlight-1-line-650">line 650</a>
</dt>
</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 -
<a href="src_physics_p2_Body.js.html">physics/p2/Body.js</a>, <a href="src_physics_p2_Body.js.html#sunlight-1-line-662">line 662</a>
</dt>
</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.
If this Body had a previously set Collision Group you will need to re-apply it to the new Shape this creates.</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 -
<a href="src_physics_p2_Body.js.html">physics/p2/Body.js</a>, <a href="src_physics_p2_Body.js.html#sunlight-1-line-1210">line 1210</a>
</dt>
</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 -
<a href="src_physics_p2_Body.js.html">physics/p2/Body.js</a>, <a href="src_physics_p2_Body.js.html#sunlight-1-line-295">line 295</a>
</dt>
</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 -
<a href="src_physics_p2_Body.js.html">physics/p2/Body.js</a>, <a href="src_physics_p2_Body.js.html#sunlight-1-line-1272">line 1272</a>
</dt>
</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.
If this Body had a previously set Collision Group you will need to re-apply it to the new Shape this creates.</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>
<h5>Returns:</h5>
<div class="returns">
<div class="returns-type">
<span class="param-type">p2.Rectangle</span>
-
</div>
<div class="returns-desc param-desc">
<p>The Rectangle shape that was added to the Body.</p>
</div>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_physics_p2_Body.js.html">physics/p2/Body.js</a>, <a href="src_physics_p2_Body.js.html#sunlight-1-line-1228">line 1228</a>
</dt>
</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.
If this Body had a previously set Collision Group you will need to re-apply it to the new Shape this creates.</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>
<h5>Returns:</h5>
<div class="returns">
<div class="returns-type">
<span class="param-type">p2.Rectangle</span>
-
</div>
<div class="returns-desc param-desc">
<p>The Rectangle shape that was added to the Body.</p>
</div>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_physics_p2_Body.js.html">physics/p2/Body.js</a>, <a href="src_physics_p2_Body.js.html#sunlight-1-line-1252">line 1252</a>
</dt>
</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 -
<a href="src_physics_p2_Body.js.html">physics/p2/Body.js</a>, <a href="src_physics_p2_Body.js.html#sunlight-1-line-612">line 612</a>
</dt>
</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 -
<a href="src_physics_p2_Body.js.html">physics/p2/Body.js</a>, <a href="src_physics_p2_Body.js.html#sunlight-1-line-578">line 578</a>
</dt>
</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 -
<a href="src_physics_p2_Body.js.html">physics/p2/Body.js</a>, <a href="src_physics_p2_Body.js.html#sunlight-1-line-589">line 589</a>
</dt>
</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 -
<a href="src_physics_p2_Body.js.html">physics/p2/Body.js</a>, <a href="src_physics_p2_Body.js.html#sunlight-1-line-600">line 600</a>
</dt>
</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 -
<a href="src_physics_p2_Body.js.html">physics/p2/Body.js</a>, <a href="src_physics_p2_Body.js.html#sunlight-1-line-1296">line 1296</a>
</dt>
</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 -
<a href="src_physics_p2_Body.js.html">physics/p2/Body.js</a>, <a href="src_physics_p2_Body.js.html#sunlight-1-line-708">line 708</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id="thrustLeft"><span class="type-signature"></span>thrustLeft<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' to the left, 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 to the left.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_physics_p2_Body.js.html">physics/p2/Body.js</a>, <a href="src_physics_p2_Body.js.html#sunlight-1-line-725">line 725</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id="thrustRight"><span class="type-signature"></span>thrustRight<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' to the right, 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 to the right.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_physics_p2_Body.js.html">physics/p2/Body.js</a>, <a href="src_physics_p2_Body.js.html#sunlight-1-line-742">line 742</a>
</dt>
</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">Array</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">Array</span>
</td>
<td class="description last"><p>The input world vector.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_physics_p2_Body.js.html">physics/p2/Body.js</a>, <a href="src_physics_p2_Body.js.html#sunlight-1-line-624">line 624</a>
</dt>
</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">Array</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">Array</span>
</td>
<td class="description last"><p>The input local vector.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source -
<a href="src_physics_p2_Body.js.html">physics/p2/Body.js</a>, <a href="src_physics_p2_Body.js.html#sunlight-1-line-637">line 637</a>
</dt>
</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 -
<a href="src_physics_p2_Body.js.html">physics/p2/Body.js</a>, <a href="src_physics_p2_Body.js.html#sunlight-1-line-271">line 271</a>
</dt>
</dl>
</dd>
</dl>
</article>
</section>
</div>
<div class="clearfix"></div>
<footer>
<span class="copyright">
Phaser Copyright © 2012-2016 Photon Storm Ltd.
</span>
<br />
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.2</a>
on Fri Apr 22 2016 15:11:52 GMT+0100 (GMT Daylight Time) using the <a href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
</span>
</footer>
</div>
<div class="span3">
<div id="toc"></div>
</div>
<br clear="both">
</div>
</div>
<script src="scripts/sunlight.js"></script>
<script src="scripts/sunlight.javascript.js"></script>
<script src="scripts/sunlight-plugin.doclinks.js"></script>
<script src="scripts/sunlight-plugin.linenumbers.js"></script>
<script src="scripts/sunlight-plugin.menu.js"></script>
<script src="scripts/jquery.min.js"></script>
<script src="scripts/jquery.scrollTo.js"></script>
<script src="scripts/jquery.localScroll.js"></script>
<script src="scripts/bootstrap-dropdown.js"></script>
<script src="scripts/toc.js"></script>
<script> Sunlight.highlightAll({lineNumbers:true, showMenu: true, enableDoclinks :true}); </script>
<script>
$( function () {
$( "#toc" ).toc( {
anchorName : function(i, heading, prefix) {
return $(heading).attr("id") || ( prefix + i );
},
selectors : "h1,h2,h3,h4",
showAndHide : false,
scrollTo : 60
} );
$( "#toc>ul" ).addClass( "nav nav-pills nav-stacked" );
$( "#main span[id^='toc']" ).addClass( "toc-shim" );
} );
</script>
</body>
</html>