phaser/docs/Phaser.Physics.P2.Body.html
2014-12-04 11:33:42 +00:00

11193 lines
No EOL
166 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="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.ArrayList.html">ArrayList</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-1">
<a href="Phaser.Device.html">Device</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-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.GamepadButton.html">GamepadButton</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Graphics.html">Graphics</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Group.html">Group</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Image.html">Image</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Input.html">Input</a>
</li>
<li class="class-depth-1">
<a href="Phaser.InputHandler.html">InputHandler</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Key.html">Key</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Keyboard.html">Keyboard</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Line.html">Line</a>
</li>
<li class="class-depth-1">
<a href="Phaser.LinkedList.html">LinkedList</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Loader.html">Loader</a>
</li>
<li class="class-depth-1">
<a href="Phaser.LoaderParser.html">LoaderParser</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Math.html">Math</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Mouse.html">Mouse</a>
</li>
<li class="class-depth-1">
<a href="Phaser.MSPointer.html">MSPointer</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Net.html">Net</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Particle.html">Particle</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Particles.html">Particles</a>
</li>
<li class="class-depth-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-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.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.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.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.AjaxRequest.html">AjaxRequest</a>
</li>
<li class="class-depth-1">
<a href="PIXI.AlphaMaskFilter.html">AlphaMaskFilter</a>
</li>
<li class="class-depth-1">
<a href="PIXI.AsciiFilter.html">AsciiFilter</a>
</li>
<li class="class-depth-1">
<a href="PIXI.AssetLoader.html">AssetLoader</a>
</li>
<li class="class-depth-1">
<a href="PIXI.AtlasLoader.html">AtlasLoader</a>
</li>
<li class="class-depth-1">
<a href="PIXI.BaseTexture.html">BaseTexture</a>
</li>
<li class="class-depth-1">
<a href="PIXI.BitmapFontLoader.html">BitmapFontLoader</a>
</li>
<li class="class-depth-1">
<a href="PIXI.BitmapText.html">BitmapText</a>
</li>
<li class="class-depth-1">
<a href="PIXI.BlurFilter.html">BlurFilter</a>
</li>
<li class="class-depth-1">
<a href="PIXI.BlurXFilter.html">BlurXFilter</a>
</li>
<li class="class-depth-1">
<a href="PIXI.BlurYFilter.html">BlurYFilter</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.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.Circle.html">Circle</a>
</li>
<li class="class-depth-1">
<a href="PIXI.ColorMatrixFilter.html">ColorMatrixFilter</a>
</li>
<li class="class-depth-1">
<a href="PIXI.ColorStepFilter.html">ColorStepFilter</a>
</li>
<li class="class-depth-1">
<a href="PIXI.ComplexPrimitiveShader.html">ComplexPrimitiveShader</a>
</li>
<li class="class-depth-1">
<a href="PIXI.ConvolutionFilter.html">ConvolutionFilter</a>
</li>
<li class="class-depth-1">
<a href="PIXI.CrossHatchFilter.html">CrossHatchFilter</a>
</li>
<li class="class-depth-1">
<a href="PIXI.DisplacementFilter.html">DisplacementFilter</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.DotScreenFilter.html">DotScreenFilter</a>
</li>
<li class="class-depth-1">
<a href="PIXI.Ellipse.html">Ellipse</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.FilterBlock.html">FilterBlock</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.GrayFilter.html">GrayFilter</a>
</li>
<li class="class-depth-1">
<a href="PIXI.ImageLoader.html">ImageLoader</a>
</li>
<li class="class-depth-1">
<a href="PIXI.InteractionData.html">InteractionData</a>
</li>
<li class="class-depth-1">
<a href="PIXI.InteractionManager.html">InteractionManager</a>
</li>
<li class="class-depth-1">
<a href="PIXI.InvertFilter.html">InvertFilter</a>
</li>
<li class="class-depth-1">
<a href="PIXI.JsonLoader.html">JsonLoader</a>
</li>
<li class="class-depth-1">
<a href="PIXI.Matrix.html">Matrix</a>
</li>
<li class="class-depth-1">
<a href="PIXI.MovieClip.html">MovieClip</a>
</li>
<li class="class-depth-1">
<a href="PIXI.NoiseFilter.html">NoiseFilter</a>
</li>
<li class="class-depth-1">
<a href="PIXI.NormalMapFilter.html">NormalMapFilter</a>
</li>
<li class="class-depth-1">
<a href="PIXI.PixelateFilter.html">PixelateFilter</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.Point.html">Point</a>
</li>
<li class="class-depth-1">
<a href="PIXI.Polygon.html">Polygon</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.Rectangle.html">Rectangle</a>
</li>
<li class="class-depth-1">
<a href="PIXI.RenderTexture.html">RenderTexture</a>
</li>
<li class="class-depth-1">
<a href="PIXI.RGBSplitFilter.html">RGBSplitFilter</a>
</li>
<li class="class-depth-1">
<a href="PIXI.Rope.html">Rope</a>
</li>
<li class="class-depth-1">
<a href="PIXI.RoundedRectangle.html">RoundedRectangle</a>
</li>
<li class="class-depth-1">
<a href="PIXI.SepiaFilter.html">SepiaFilter</a>
</li>
<li class="class-depth-1">
<a href="PIXI.SmartBlurFilter.html">SmartBlurFilter</a>
</li>
<li class="class-depth-1">
<a href="PIXI.Spine.html">Spine</a>
</li>
<li class="class-depth-1">
<a href="PIXI.SpineLoader.html">SpineLoader</a>
</li>
<li class="class-depth-1">
<a href="PIXI.SpineTextureLoader.html">SpineTextureLoader</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.SpriteSheetLoader.html">SpriteSheetLoader</a>
</li>
<li class="class-depth-1">
<a href="PIXI.Stage.html">Stage</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.Text.html">Text</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.TiltShiftFilter.html">TiltShiftFilter</a>
</li>
<li class="class-depth-1">
<a href="PIXI.TiltShiftXFilter.html">TiltShiftXFilter</a>
</li>
<li class="class-depth-1">
<a href="PIXI.TiltShiftYFilter.html">TiltShiftYFilter</a>
</li>
<li class="class-depth-1">
<a href="PIXI.TwistFilter.html">TwistFilter</a>
</li>
<li class="class-depth-1">
<a href="PIXI.VideoTexture.html">VideoTexture</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="#" 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.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.InputManager.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.Emitter.html">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.Rectangle.html">Rectangle</a></li>
<li class="class-depth-1"><a href="Phaser.Point.html">Point</a></li>
<li class="class-depth-1"><a href="Phaser.Line.html">Line</a></li>
<li class="class-depth-1"><a href="Phaser.Ellipse.html">Ellipse</a></li>
<li class="class-depth-1"><a href="Phaser.Polygon.html">Polygon</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.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="https://github.com/photonstorm/phaser">Phaser Github</a></li>
<li class="class-depth-1"><a href="http://examples.phaser.io">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="https://confirmsubscription.com/h/r/369DE48E3E86AF1E">Newsletter</a></li>
<li class="class-depth-1"><a href="https://twitter.com/photonstorm">Twitter</a></li>
<li class="class-depth-1"><a href="http://www.html5gamedevs.com/topic/4470-official-phaserio-irc-channel-phaserio-on-freenode/">IRC</a></li>
<li class="class-depth-1"><a href="https://leanpub.com/u/photonstorm">Phaser Books</a></li>
<li class="class-depth-1"><a href="https://www.gittip.com/photonstorm/">GitTip</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="Body.js__.html">physics/p2/Body.js</a>, <a href="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="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-1289">line 1289</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="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-1305">line 1305</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="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-1297">line 1297</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="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-1402">line 1402</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="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-1425">line 1425</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="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-1449">line 1449</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="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-1470">line 1470</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="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-1490">line 1490</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="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-95">line 95</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="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-1748">line 1748</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="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-1510">line 1510</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="Body.js__.html">physics/p2/Body.js</a>, <a href="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="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-1719">line 1719</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="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-105">line 105</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="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-1340">line 1340</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="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-1531">line 1531</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="Body.js__.html">physics/p2/Body.js</a>, <a href="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="Body.js__.html">physics/p2/Body.js</a>, <a href="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="Body.js__.html">physics/p2/Body.js</a>, <a href="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="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-1704">line 1704</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="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-1554">line 1554</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="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-1373">line 1373</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>-</p>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-1574">line 1574</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="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-1598">line 1598</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="Body.js__.html">physics/p2/Body.js</a>, <a href="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.
The event will be sent 4 parameters: The body it is in contact with, the shape from this body that caused the contact, the shape from the contact body and the contact equation data array.</p>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-83">line 83</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.
The event will be sent 3 parameters: The body it is in contact with, the shape from this body that caused the contact and the shape from the contact body.</p>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-90">line 90</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="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-100">line 100</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="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-1621">line 1621</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="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-1644">line 1644</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="Body.js__.html">physics/p2/Body.js</a>, <a href="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="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-1307">line 1307</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="Body.js__.html">physics/p2/Body.js</a>, <a href="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="Body.js__.html">physics/p2/Body.js</a>, <a href="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="Body.js__.html">physics/p2/Body.js</a>, <a href="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="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-1664">line 1664</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="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-1684">line 1684</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="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-919">line 919</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="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-828">line 828</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="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-1155">line 1155</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="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-899">line 899</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="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-882">line 882</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"></span></h4>
</dt>
<dd>
<div class="description">
<p>Reads the shape data from a physics data file stored in the Game.Cache and adds it as a polygon to this Body.
The shape data format is based on the custom phaser export in.</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>key</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last"><p>The key of the Physics Data file as stored in Game.Cache.</p></td>
</tr>
<tr>
<td class="name"><code>object</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last"><p>The key of the object within the Physics data file that you wish to load the shape data from.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source -
<a href="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-1118">line 1118</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="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-865">line 865</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="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-939">line 939</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.Rectangle}</span></h4>
</dt>
<dd>
<div class="description">
<p>Adds a Rectangle shape to this Body. You can control the offset from the center of the body and the rotation.</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Argument</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>width</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"><p>The width of the rectangle in pixels.</p></td>
</tr>
<tr>
<td class="name"><code>height</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"><p>The height of the rectangle in pixels.</p></td>
</tr>
<tr>
<td class="name"><code>offsetX</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
0
</td>
<td class="description last"><p>Local horizontal offset of the shape relative to the body center of mass.</p></td>
</tr>
<tr>
<td class="name"><code>offsetY</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
0
</td>
<td class="description last"><p>Local vertical offset of the shape relative to the body center of mass.</p></td>
</tr>
<tr>
<td class="name"><code>rotation</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
0
</td>
<td class="description last"><p>Local rotation of the shape relative to the body center of mass, specified in radians.</p></td>
</tr>
</tbody>
</table>
<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="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-846">line 846</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.</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="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-804">line 804</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="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-720">line 720</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="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-395">line 395</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 <a href="http://code.google.com/p/bullet/issues/detail?id=74">http://code.google.com/p/bullet/issues/detail?id=74</a> for details.</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>dt</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>Current time step.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source -
<a href="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-406">line 406</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. 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="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-418">line 418</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="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-295">line 295</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="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-786">line 786</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="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-340">line 340</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="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-152">line 152</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="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-192">line 192</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="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-759">line 759</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="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-219">line 219</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>
</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">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="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-1227">line 1227</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="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-545">line 545</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="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-635">line 635</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="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-528">line 528</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="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-596">line 596</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="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-609">line 609</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="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-622">line 622</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="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-664">line 664</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="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-648">line 648</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="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-745">line 745</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="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-1005">line 1005</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="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-687">line 687</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="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-579">line 579</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="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-504">line 504</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="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-516">line 516</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.</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="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-1021">line 1021</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="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-267">line 267</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="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-1080">line 1080</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.</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="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-1038">line 1038</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.</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="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-1061">line 1061</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="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-466">line 466</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="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-432">line 432</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="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-443">line 443</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="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-454">line 454</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="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-1104">line 1104</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="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-562">line 562</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="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-478">line 478</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="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-491">line 491</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="Body.js__.html">physics/p2/Body.js</a>, <a href="Body.js__.html#sunlight-1-line-243">line 243</a>
</dt>
</dl>
</dd>
</dl>
</article>
</section>
</div>
<div class="clearfix"></div>
<footer>
<span class="copyright">
Phaser Copyright © 2012-2014 Photon Storm Ltd.
</span>
<br />
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-dev</a>
on Thu Dec 04 2014 11:32:45 GMT-0000 (GMT) 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>