mirror of
https://github.com/photonstorm/phaser
synced 2024-12-25 12:33:38 +00:00
1 line
No EOL
48 KiB
JSON
1 line
No EOL
48 KiB
JSON
{"class":{"name":"Phaser.Physics.P2","extends":"","static":false,"constructor":true,"parameters":[{"name":"game","type":["Phaser.Game"],"help":"Reference to the current game instance.","optional":false,"default":null},{"name":"config","type":["object"],"help":"Physics configuration object passed in from the game constructor.","optional":true,"default":null}],"help":"This is your main access to the P2 Physics World.\\nFrom here you can create materials, listen for events and add bodies into the physics simulation."},"consts":[],"methods":{"public":[{"name":"addBody","static":false,"returns":{"types":["boolean"],"help":"True if the Body was added successfully, otherwise false."},"help":"Add a body to the world.","line":734,"public":true,"protected":false,"private":false,"parameters":[{"name":"body","type":["Phaser.Physics.P2.Body"],"help":"The Body to add to the World.","optional":false,"default":null}],"inherited":false,"inheritedFrom":""},{"name":"addConstraint","static":false,"returns":{"types":["Phaser.Physics.P2.Constraint"],"help":"The Constraint that was added."},"help":"Adds a Constraint to the world.","line":966,"public":true,"protected":false,"private":false,"parameters":[{"name":"constraint","type":["Phaser.Physics.P2.Constraint"],"help":"The Constraint to add to the World.","optional":false,"default":null}],"inherited":false,"inheritedFrom":""},{"name":"addContactMaterial","static":false,"returns":{"types":["Phaser.Physics.P2.ContactMaterial"],"help":"The Contact Material that was added."},"help":"Adds a Contact Material to the world.","line":1000,"public":true,"protected":false,"private":false,"parameters":[{"name":"material","type":["Phaser.Physics.P2.ContactMaterial"],"help":"The Contact Material to be added to the World.","optional":false,"default":null}],"inherited":false,"inheritedFrom":""},{"name":"addSpring","static":false,"returns":{"types":["Phaser.Physics.P2.Spring"],"help":"The Spring that was added."},"help":"Adds a Spring to the world.","line":778,"public":true,"protected":false,"private":false,"parameters":[{"name":"spring","type":["Phaser.Physics.P2.Spring","p2.LinearSpring","p2.RotationalSpring"],"help":"The Spring to add to the World.","optional":false,"default":null}],"inherited":false,"inheritedFrom":""},{"name":"beginContactHandler","static":false,"returns":null,"help":"Handles a p2 begin contact event.","line":418,"public":true,"protected":false,"private":false,"parameters":[{"name":"event","type":["object"],"help":"The event data.","optional":false,"default":null}],"inherited":false,"inheritedFrom":""},{"name":"clear","static":false,"returns":null,"help":"Clears all bodies from the simulation, resets callbacks and resets the collision bitmask.","line":696,"public":true,"protected":false,"private":false,"parameters":[],"inherited":false,"inheritedFrom":""},{"name":"clearTilemapLayerBodies","static":false,"returns":null,"help":"Clears all physics bodies from the given TilemapLayer that were created with `World.convertTilemap`.","line":1511,"public":true,"protected":false,"private":false,"parameters":[{"name":"map","type":["Phaser.Tilemap"],"help":"The Tilemap to get the map data from.","optional":false,"default":null},{"name":"layer","type":["number","string","Phaser.TilemapLayer"],"help":"The layer to operate on. If not given will default to map.currentLayer.","optional":true,"default":null}],"inherited":false,"inheritedFrom":""},{"name":"convertCollisionObjects","static":false,"returns":{"types":["array"],"help":"An array of the Phaser.Physics.Body objects that have been created."},"help":"Converts all of the polylines objects inside a Tiled ObjectGroup into physics bodies that are added to the world.\\nNote that the polylines must be created in such a way that they can withstand polygon decomposition.","line":1473,"public":true,"protected":false,"private":false,"parameters":[{"name":"map","type":["Phaser.Tilemap"],"help":"The Tilemap to get the map data from.","optional":false,"default":null},{"name":"layer","type":["number","string","Phaser.TilemapLayer"],"help":"The layer to operate on. If not given will default to map.currentLayer.","optional":true,"default":null},{"name":"addToWorld","type":["boolean"],"help":"If true it will automatically add each body to the world.","optional":true,"default":"true"}],"inherited":false,"inheritedFrom":""},{"name":"convertTilemap","static":false,"returns":{"types":["array"],"help":"An array of the Phaser.Physics.P2.Body objects that were created."},"help":"Goes through all tiles in the given Tilemap and TilemapLayer and converts those set to collide into physics bodies.\\nOnly call this *after* you have specified all of the tiles you wish to collide with calls like Tilemap.setCollisionBetween, etc.\\nEvery time you call this method it will destroy any previously created bodies and remove them from the world.\\nTherefore understand it's a very expensive operation and not to be done in a core game update loop.","line":1539,"public":true,"protected":false,"private":false,"parameters":[{"name":"map","type":["Phaser.Tilemap"],"help":"The Tilemap to get the map data from.","optional":false,"default":null},{"name":"layer","type":["number","string","Phaser.TilemapLayer"],"help":"The layer to operate on. If not given will default to map.currentLayer.","optional":true,"default":null},{"name":"addToWorld","type":["boolean"],"help":"If true it will automatically add each body to the world, otherwise it's up to you to do so.","optional":true,"default":"true"},{"name":"optimize","type":["boolean"],"help":"If true adjacent colliding tiles will be combined into a single body to save processing. However it means you cannot perform specific Tile to Body collision responses.","optional":true,"default":"true"}],"inherited":false,"inheritedFrom":""},{"name":"createBody","static":false,"returns":{"types":["Phaser.Physics.P2.Body"],"help":"The body"},"help":"Creates a new Body and adds it to the World.\\n\\nEither [[0,0], [0,1],...] or a flat array of numbers that will be interpreted as [x,y, x,y, ...],\\nor the arguments passed can be flat x,y values e.g. `setPolygon(options, x,y, x,y, x,y, ...)` where `x` and `y` are numbers.","line":1397,"public":true,"protected":false,"private":false,"parameters":[{"name":"x","type":["number"],"help":"The x coordinate of Body.","optional":false,"default":null},{"name":"y","type":["number"],"help":"The y coordinate of Body.","optional":false,"default":null},{"name":"mass","type":["number"],"help":"The mass of the Body. A mass of 0 means a 'static' Body is created.","optional":false,"default":null},{"name":"addToWorld","type":["boolean"],"help":"Automatically add this Body to the world? (usually false as it won't have any shapes on construction).","optional":true,"default":"false"},{"name":"options","type":["object"],"help":"An object containing the build options:","optional":false,"default":null},{"name":"options.optimalDecomp","type":["boolean"],"help":"Set to true if you need optimal decomposition. Warning: very slow for polygons with more than 10 vertices.","optional":true,"default":"false"},{"name":"options.skipSimpleCheck","type":["boolean"],"help":"Set to true if you already know that the path is not intersecting itself.","optional":true,"default":"false"},{"name":"options.removeCollinearPoints","type":["boolean","number"],"help":"Set to a number (angle threshold value) to remove collinear points, or false to keep all points.","optional":true,"default":"false"},{"name":"points","type":["array number","number"],"help":"An array of 2d vectors that form the convex or concave polygon.","optional":false,"default":null}],"inherited":false,"inheritedFrom":""},{"name":"createCollisionGroup","static":false,"returns":null,"help":"Creates a new Collision Group and optionally applies it to the given object.\\nCollision Groups are handled using bitmasks, therefore you have a fixed limit you can create before you need to re-use older groups.","line":1256,"public":true,"protected":false,"private":false,"parameters":[{"name":"object","type":["Phaser.Group","Phaser.Sprite"],"help":"An optional Sprite or Group to apply the Collision Group to. If a Group is given it will be applied to all top-level children.","optional":true,"default":null}],"inherited":false,"inheritedFrom":""},{"name":"createContactMaterial","static":false,"returns":{"types":["Phaser.Physics.P2.ContactMaterial"],"help":"The Contact Material that was created."},"help":"Creates a Contact Material from the two given Materials. You can then edit the properties of the Contact Material directly.","line":1095,"public":true,"protected":false,"private":false,"parameters":[{"name":"materialA","type":["Phaser.Physics.P2.Material"],"help":"The first Material to create the ContactMaterial from. If undefined it will create a new Material object first.","optional":true,"default":null},{"name":"materialB","type":["Phaser.Physics.P2.Material"],"help":"The second Material to create the ContactMaterial from. If undefined it will create a new Material object first.","optional":true,"default":null},{"name":"options","type":["object"],"help":"Material options object.","optional":true,"default":null}],"inherited":false,"inheritedFrom":""},{"name":"createDistanceConstraint","static":false,"returns":{"types":["Phaser.Physics.P2.DistanceConstraint"],"help":"The constraint"},"help":"Creates a constraint that tries to keep the distance between two bodies constant.","line":831,"public":true,"protected":false,"private":false,"parameters":[{"name":"bodyA","type":["Phaser.Sprite","Phaser.Physics.P2.Body","p2.Body"],"help":"First connected body.","optional":false,"default":null},{"name":"bodyB","type":["Phaser.Sprite","Phaser.Physics.P2.Body","p2.Body"],"help":"Second connected body.","optional":false,"default":null},{"name":"distance","type":["number"],"help":"The distance to keep between the bodies.","optional":false,"default":null},{"name":"localAnchorA","type":["array"],"help":"The anchor point for bodyA, defined locally in bodyA frame. Defaults to [0,0].","optional":true,"default":null},{"name":"localAnchorB","type":["array"],"help":"The anchor point for bodyB, defined locally in bodyB frame. Defaults to [0,0].","optional":true,"default":null},{"name":"maxForce","type":["number"],"help":"The maximum force that should be applied to constrain the bodies.","optional":true,"default":null}],"inherited":false,"inheritedFrom":""},{"name":"createGearConstraint","static":false,"returns":{"types":["Phaser.Physics.P2.GearConstraint"],"help":"The constraint"},"help":"Creates a constraint that tries to keep the distance between two bodies constant.","line":857,"public":true,"protected":false,"private":false,"parameters":[{"name":"bodyA","type":["Phaser.Sprite","Phaser.Physics.P2.Body","p2.Body"],"help":"First connected body.","optional":false,"default":null},{"name":"bodyB","type":["Phaser.Sprite","Phaser.Physics.P2.Body","p2.Body"],"help":"Second connected body.","optional":false,"default":null},{"name":"angle","type":["number"],"help":"The relative angle","optional":true,"default":"0"},{"name":"ratio","type":["number"],"help":"The gear ratio.","optional":true,"default":"1"}],"inherited":false,"inheritedFrom":""},{"name":"createLockConstraint","static":false,"returns":{"types":["Phaser.Physics.P2.LockConstraint"],"help":"The constraint"},"help":"Locks the relative position between two bodies.","line":913,"public":true,"protected":false,"private":false,"parameters":[{"name":"bodyA","type":["Phaser.Sprite","Phaser.Physics.P2.Body","p2.Body"],"help":"First connected body.","optional":false,"default":null},{"name":"bodyB","type":["Phaser.Sprite","Phaser.Physics.P2.Body","p2.Body"],"help":"Second connected body.","optional":false,"default":null},{"name":"offset","type":["array"],"help":"The offset of bodyB in bodyA's frame. The value is an array with 2 elements matching x and y, i.e: [32, 32].","optional":true,"default":null},{"name":"angle","type":["number"],"help":"The angle of bodyB in bodyA's frame.","optional":true,"default":"0"},{"name":"maxForce","type":["number"],"help":"The maximum force that should be applied to constrain the bodies.","optional":true,"default":null}],"inherited":false,"inheritedFrom":""},{"name":"createMaterial","static":false,"returns":{"types":["Phaser.Physics.P2.Material"],"help":"The Material that was created. This is also stored in Phaser.Physics.P2.materials."},"help":"Creates a Material. Materials are applied to Shapes owned by a Body and can be set with Body.setMaterial().\\nMaterials are a way to control what happens when Shapes collide. Combine unique Materials together to create Contact Materials.\\nContact Materials have properties such as friction and restitution that allow for fine-grained collision control between different Materials.","line":1069,"public":true,"protected":false,"private":false,"parameters":[{"name":"name","type":["string"],"help":"Optional name of the Material. Each Material has a unique ID but string names are handy for debugging.","optional":true,"default":null},{"name":"body","type":["Phaser.Physics.P2.Body"],"help":"Optional Body. If given it will assign the newly created Material to the Body shapes.","optional":true,"default":null}],"inherited":false,"inheritedFrom":""},{"name":"createParticle","static":false,"returns":null,"help":"Creates a new Particle and adds it to the World.\\n\\nEither [[0,0], [0,1],...] or a flat array of numbers that will be interpreted as [x,y, x,y, ...],\\nor the arguments passed can be flat x,y values e.g. `setPolygon(options, x,y, x,y, x,y, ...)` where `x` and `y` are numbers.","line":1438,"public":true,"protected":false,"private":false,"parameters":[{"name":"x","type":["number"],"help":"The x coordinate of Body.","optional":false,"default":null},{"name":"y","type":["number"],"help":"The y coordinate of Body.","optional":false,"default":null},{"name":"mass","type":["number"],"help":"The mass of the Body. A mass of 0 means a 'static' Body is created.","optional":false,"default":null},{"name":"addToWorld","type":["boolean"],"help":"Automatically add this Body to the world? (usually false as it won't have any shapes on construction).","optional":true,"default":"false"},{"name":"options","type":["object"],"help":"An object containing the build options:","optional":false,"default":null},{"name":"options.optimalDecomp","type":["boolean"],"help":"Set to true if you need optimal decomposition. Warning: very slow for polygons with more than 10 vertices.","optional":true,"default":"false"},{"name":"options.skipSimpleCheck","type":["boolean"],"help":"Set to true if you already know that the path is not intersecting itself.","optional":true,"default":"false"},{"name":"options.removeCollinearPoints","type":["boolean","number"],"help":"Set to a number (angle threshold value) to remove collinear points, or false to keep all points.","optional":true,"default":"false"},{"name":"points","type":["array number","number"],"help":"An array of 2d vectors that form the convex or concave polygon.","optional":false,"default":null}],"inherited":false,"inheritedFrom":""},{"name":"createPrismaticConstraint","static":false,"returns":{"types":["Phaser.Physics.P2.PrismaticConstraint"],"help":"The constraint"},"help":"Constraint that only allows bodies to move along a line, relative to each other.\\nSee http:\/\/www.iforce2d.net\/b2dtut\/joints-prismatic","line":943,"public":true,"protected":false,"private":false,"parameters":[{"name":"bodyA","type":["Phaser.Sprite","Phaser.Physics.P2.Body","p2.Body"],"help":"First connected body.","optional":false,"default":null},{"name":"bodyB","type":["Phaser.Sprite","Phaser.Physics.P2.Body","p2.Body"],"help":"Second connected body.","optional":false,"default":null},{"name":"lockRotation","type":["boolean"],"help":"If set to false, bodyB will be free to rotate around its anchor point.","optional":true,"default":"true"},{"name":"anchorA","type":["array"],"help":"Body A's anchor point, defined in its own local frame. The value is an array with 2 elements matching x and y, i.e: [32, 32].","optional":true,"default":null},{"name":"anchorB","type":["array"],"help":"Body A's anchor point, defined in its own local frame. The value is an array with 2 elements matching x and y, i.e: [32, 32].","optional":true,"default":null},{"name":"axis","type":["array"],"help":"An axis, defined in body A frame, that body B's anchor point may slide along. The value is an array with 2 elements matching x and y, i.e: [32, 32].","optional":true,"default":null},{"name":"maxForce","type":["number"],"help":"The maximum force that should be applied to constrain the bodies.","optional":true,"default":null}],"inherited":false,"inheritedFrom":""},{"name":"createRevoluteConstraint","static":false,"returns":{"types":["Phaser.Physics.P2.RevoluteConstraint"],"help":"The constraint"},"help":"Connects two bodies at given offset points, letting them rotate relative to each other around this point.\\nThe pivot points are given in world (pixel) coordinates.","line":886,"public":true,"protected":false,"private":false,"parameters":[{"name":"bodyA","type":["Phaser.Sprite","Phaser.Physics.P2.Body","p2.Body"],"help":"First connected body.","optional":false,"default":null},{"name":"pivotA","type":["array"],"help":"The point relative to the center of mass of bodyA which bodyA is constrained to. The value is an array with 2 elements matching x and y, i.e: [32, 32].","optional":false,"default":null},{"name":"bodyB","type":["Phaser.Sprite","Phaser.Physics.P2.Body","p2.Body"],"help":"Second connected body.","optional":false,"default":null},{"name":"pivotB","type":["array"],"help":"The point relative to the center of mass of bodyB which bodyB is constrained to. The value is an array with 2 elements matching x and y, i.e: [32, 32].","optional":false,"default":null},{"name":"maxForce","type":["number"],"help":"The maximum force that should be applied to constrain the bodies.","optional":true,"default":"0"},{"name":"worldPivot","type":["Float32Array"],"help":"A pivot point given in world coordinates. If specified, localPivotA and localPivotB are automatically computed from this value.","optional":true,"default":"null"}],"inherited":false,"inheritedFrom":""},{"name":"createRotationalSpring","static":false,"returns":{"types":["Phaser.Physics.P2.RotationalSpring"],"help":"The spring"},"help":"Creates a rotational spring, connecting two bodies. A spring can have a resting length, a stiffness and damping.","line":1364,"public":true,"protected":false,"private":false,"parameters":[{"name":"bodyA","type":["Phaser.Sprite","Phaser.Physics.P2.Body","p2.Body"],"help":"First connected body.","optional":false,"default":null},{"name":"bodyB","type":["Phaser.Sprite","Phaser.Physics.P2.Body","p2.Body"],"help":"Second connected body.","optional":false,"default":null},{"name":"restAngle","type":["number"],"help":"The relative angle of bodies at which the spring is at rest. If not given, it's set to the current relative angle between the bodies.","optional":true,"default":null},{"name":"stiffness","type":["number"],"help":"Stiffness of the spring. A number >= 0.","optional":true,"default":"100"},{"name":"damping","type":["number"],"help":"Damping of the spring. A number >= 0.","optional":true,"default":"1"}],"inherited":false,"inheritedFrom":""},{"name":"createSpring","static":false,"returns":{"types":["Phaser.Physics.P2.Spring"],"help":"The spring"},"help":"Creates a linear spring, connecting two bodies. A spring can have a resting length, a stiffness and damping.","line":1337,"public":true,"protected":false,"private":false,"parameters":[{"name":"bodyA","type":["Phaser.Sprite","Phaser.Physics.P2.Body","p2.Body"],"help":"First connected body.","optional":false,"default":null},{"name":"bodyB","type":["Phaser.Sprite","Phaser.Physics.P2.Body","p2.Body"],"help":"Second connected body.","optional":false,"default":null},{"name":"restLength","type":["number"],"help":"Rest length of the spring. A number > 0.","optional":true,"default":"1"},{"name":"stiffness","type":["number"],"help":"Stiffness of the spring. A number >= 0.","optional":true,"default":"100"},{"name":"damping","type":["number"],"help":"Damping of the spring. A number >= 0.","optional":true,"default":"1"},{"name":"worldA","type":["array"],"help":"Where to hook the spring to body A in world coordinates. This value is an array by 2 elements, x and y, i.e: [32, 32].","optional":true,"default":null},{"name":"worldB","type":["array"],"help":"Where to hook the spring to body B in world coordinates. This value is an array by 2 elements, x and y, i.e: [32, 32].","optional":true,"default":null},{"name":"localA","type":["array"],"help":"Where to hook the spring to body A in local body coordinates. This value is an array by 2 elements, x and y, i.e: [32, 32].","optional":true,"default":null},{"name":"localB","type":["array"],"help":"Where to hook the spring to body B in local body coordinates. This value is an array by 2 elements, x and y, i.e: [32, 32].","optional":true,"default":null}],"inherited":false,"inheritedFrom":""},{"name":"destroy","static":false,"returns":null,"help":"Clears all bodies from the simulation and unlinks World from Game. Should only be called on game shutdown. Call `clear` on a State change.","line":719,"public":true,"protected":false,"private":false,"parameters":[],"inherited":false,"inheritedFrom":""},{"name":"enable","static":false,"returns":null,"help":"This will create a P2 Physics body on the given game object or array of game objects.\\nA game object can only have 1 physics body active at any one time, and it can't be changed until the object is destroyed.\\nNote: When the game object is enabled for P2 physics it has its anchor x\/y set to 0.5 so it becomes centered.","line":235,"public":true,"protected":false,"private":false,"parameters":[{"name":"object","type":["object","array","Phaser.Group"],"help":"The game object to create the physics body on. Can also be an array or Group of objects, a body will be created on every child that has a `body` property.","optional":false,"default":null},{"name":"debug","type":["boolean"],"help":"Create a debug object to go with this body?","optional":true,"default":"false"},{"name":"children","type":["boolean"],"help":"Should a body be created on all children of this object? If true it will recurse down the display list as far as it can go.","optional":true,"default":"true"}],"inherited":false,"inheritedFrom":""},{"name":"enableBody","static":false,"returns":null,"help":"Creates a P2 Physics body on the given game object.\\nA game object can only have 1 physics body active at any one time, and it can't be changed until the body is nulled.","line":292,"public":true,"protected":false,"private":false,"parameters":[{"name":"object","type":["object"],"help":"The game object to create the physics body on. A body will only be created if this object has a null `body` property.","optional":false,"default":null},{"name":"debug","type":["boolean"],"help":"Create a debug object to go with this body?","optional":false,"default":null}],"inherited":false,"inheritedFrom":""},{"name":"endContactHandler","static":false,"returns":null,"help":"Handles a p2 end contact event.","line":440,"public":true,"protected":false,"private":false,"parameters":[{"name":"event","type":["object"],"help":"The event data.","optional":false,"default":null}],"inherited":false,"inheritedFrom":""},{"name":"getBodies","static":false,"returns":{"types":["array Phaser.Physics.P2.Body"],"help":"An array containing all current Bodies in the world."},"help":"Populates and returns an array with references to of all current Bodies in the world.","line":1112,"public":true,"protected":false,"private":false,"parameters":[],"inherited":false,"inheritedFrom":""},{"name":"getBody","static":false,"returns":{"types":["p2.Body"],"help":"The p2.Body, or null if not found."},"help":"Checks the given object to see if it has a p2.Body and if so returns it.","line":1133,"public":true,"protected":false,"private":false,"parameters":[{"name":"object","type":["object"],"help":"The object to check for a p2.Body on.","optional":false,"default":null}],"inherited":false,"inheritedFrom":""},{"name":"getConstraints","static":false,"returns":{"types":["array Phaser.Physics.P2.Constraint"],"help":"An array containing all current Constraints in the world."},"help":"Populates and returns an array of all current Constraints in the world.","line":1181,"public":true,"protected":false,"private":false,"parameters":[],"inherited":false,"inheritedFrom":""},{"name":"getContactMaterial","static":false,"returns":{"types":["Phaser.Physics.P2.ContactMaterial","boolean"],"help":"The Contact Material or false if none was found matching the Materials given."},"help":"Gets a Contact Material based on the two given Materials.","line":1035,"public":true,"protected":false,"private":false,"parameters":[{"name":"materialA","type":["Phaser.Physics.P2.Material"],"help":"The first Material to search for.","optional":false,"default":null},{"name":"materialB","type":["Phaser.Physics.P2.Material"],"help":"The second Material to search for.","optional":false,"default":null}],"inherited":false,"inheritedFrom":""},{"name":"getSprings","static":false,"returns":{"types":["array Phaser.Physics.P2.Spring"],"help":"An array containing all current Springs in the world."},"help":"Populates and returns an array of all current Springs in the world.","line":1161,"public":true,"protected":false,"private":false,"parameters":[],"inherited":false,"inheritedFrom":""},{"name":"hitTest","static":false,"returns":{"types":["array"],"help":"Array of bodies that overlap the point."},"help":"Test if a world point overlaps bodies. You will get an array of actual P2 bodies back. You can find out which Sprite a Body belongs to\\n(if any) by checking the Body.parent.sprite property. Body.parent is a Phaser.Physics.P2.Body property.","line":1206,"public":true,"protected":false,"private":false,"parameters":[{"name":"worldPoint","type":["Phaser.Point"],"help":"Point to use for intersection tests. The points values must be in world (pixel) coordinates.","optional":false,"default":null},{"name":"bodies","type":["array Phaser.Physics.P2.Bod","Phaser.Sprite","p2.Body>"],"help":"A list of objects to check for intersection. If not given it will check Phaser.Physics.P2.world.bodies (i.e. all world bodies)","optional":true,"default":null},{"name":"precision","type":["number"],"help":"Used for matching against particles and lines. Adds some margin to these infinitesimal objects.","optional":true,"default":"5"},{"name":"filterStatic","type":["boolean"],"help":"If true all Static objects will be removed from the results array.","optional":true,"default":"false"}],"inherited":false,"inheritedFrom":""},{"name":"mpx","static":false,"returns":{"types":["number"],"help":"The scaled value."},"help":"Convert p2 physics value (meters) to pixel scale.\\nBy default Phaser uses a scale of 20px per meter.\\nIf you need to modify this you can over-ride these functions via the Physics Configuration object.","line":1624,"public":true,"protected":false,"private":false,"parameters":[{"name":"v","type":["number"],"help":"The value to convert.","optional":false,"default":null}],"inherited":false,"inheritedFrom":""},{"name":"mpxi","static":false,"returns":{"types":["number"],"help":"The scaled value."},"help":"Convert p2 physics value (meters) to pixel scale and inverses it.\\nBy default Phaser uses a scale of 20px per meter.\\nIf you need to modify this you can over-ride these functions via the Physics Configuration object.","line":1654,"public":true,"protected":false,"private":false,"parameters":[{"name":"v","type":["number"],"help":"The value to convert.","optional":false,"default":null}],"inherited":false,"inheritedFrom":""},{"name":"pause","static":false,"returns":null,"help":"Pauses the P2 World independent of the game pause state.","line":650,"public":true,"protected":false,"private":false,"parameters":[],"inherited":false,"inheritedFrom":""},{"name":"preUpdate","static":false,"returns":null,"help":"Called at the start of the core update loop. Purges flagged bodies from the world.","line":212,"public":true,"protected":false,"private":false,"parameters":[],"inherited":false,"inheritedFrom":""},{"name":"pxm","static":false,"returns":{"types":["number"],"help":"The scaled value."},"help":"Convert pixel value to p2 physics scale (meters).\\nBy default Phaser uses a scale of 20px per meter.\\nIf you need to modify this you can over-ride these functions via the Physics Configuration object.","line":1639,"public":true,"protected":false,"private":false,"parameters":[{"name":"v","type":["number"],"help":"The value to convert.","optional":false,"default":null}],"inherited":false,"inheritedFrom":""},{"name":"pxmi","static":false,"returns":{"types":["number"],"help":"The scaled value."},"help":"Convert pixel value to p2 physics scale (meters) and inverses it.\\nBy default Phaser uses a scale of 20px per meter.\\nIf you need to modify this you can over-ride these functions via the Physics Configuration object.","line":1669,"public":true,"protected":false,"private":false,"parameters":[{"name":"v","type":["number"],"help":"The value to convert.","optional":false,"default":null}],"inherited":false,"inheritedFrom":""},{"name":"removeBody","static":false,"returns":{"types":["Phaser.Physics.P2.Body"],"help":"The Body that was removed."},"help":"Removes a body from the world. This will silently fail if the body wasn't part of the world to begin with.","line":758,"public":true,"protected":false,"private":false,"parameters":[{"name":"body","type":["Phaser.Physics.P2.Body"],"help":"The Body to remove from the World.","optional":false,"default":null}],"inherited":false,"inheritedFrom":""},{"name":"removeBodyNextStep","static":false,"returns":null,"help":"This will add a P2 Physics body into the removal list for the next step.","line":201,"public":true,"protected":false,"private":false,"parameters":[{"name":"body","type":["Phaser.Physics.P2.Body"],"help":"The body to remove at the start of the next step.","optional":false,"default":null}],"inherited":false,"inheritedFrom":""},{"name":"removeConstraint","static":false,"returns":{"types":["Phaser.Physics.P2.Constraint"],"help":"The Constraint that was removed."},"help":"Removes a Constraint from the world.","line":983,"public":true,"protected":false,"private":false,"parameters":[{"name":"constraint","type":["Phaser.Physics.P2.Constraint"],"help":"The Constraint to be removed from the World.","optional":false,"default":null}],"inherited":false,"inheritedFrom":""},{"name":"removeContactMaterial","static":false,"returns":{"types":["Phaser.Physics.P2.ContactMaterial"],"help":"The Contact Material that was removed."},"help":"Removes a Contact Material from the world.","line":1017,"public":true,"protected":false,"private":false,"parameters":[{"name":"material","type":["Phaser.Physics.P2.ContactMaterial"],"help":"The Contact Material to be removed from the World.","optional":false,"default":null}],"inherited":false,"inheritedFrom":""},{"name":"removeSpring","static":false,"returns":{"types":["Phaser.Physics.P2.Spring"],"help":"The Spring that was removed."},"help":"Removes a Spring from the world.","line":802,"public":true,"protected":false,"private":false,"parameters":[{"name":"spring","type":["Phaser.Physics.P2.Spring"],"help":"The Spring to remove from the World.","optional":false,"default":null}],"inherited":false,"inheritedFrom":""},{"name":"resume","static":false,"returns":null,"help":"Resumes a paused P2 World.","line":661,"public":true,"protected":false,"private":false,"parameters":[],"inherited":false,"inheritedFrom":""},{"name":"setBounds","static":false,"returns":null,"help":"Sets the bounds of the Physics world to match the given world pixel dimensions.\\nYou can optionally set which 'walls' to create: left, right, top or bottom.","line":563,"public":true,"protected":false,"private":false,"parameters":[{"name":"x","type":["number"],"help":"The x coordinate of the top-left corner of the bounds.","optional":false,"default":null},{"name":"y","type":["number"],"help":"The y coordinate of the top-left corner of the bounds.","optional":false,"default":null},{"name":"width","type":["number"],"help":"The width of the bounds.","optional":false,"default":null},{"name":"height","type":["number"],"help":"The height of the bounds.","optional":false,"default":null},{"name":"left","type":["boolean"],"help":"If true will create the left bounds wall.","optional":true,"default":"true"},{"name":"right","type":["boolean"],"help":"If true will create the right bounds wall.","optional":true,"default":"true"},{"name":"top","type":["boolean"],"help":"If true will create the top bounds wall.","optional":true,"default":"true"},{"name":"bottom","type":["boolean"],"help":"If true will create the bottom bounds wall.","optional":true,"default":"true"},{"name":"setCollisionGroup","type":["boolean"],"help":"If true the Bounds will be set to use its own Collision Group.","optional":true,"default":"true"}],"inherited":false,"inheritedFrom":""},{"name":"setBoundsToWorld","static":false,"returns":null,"help":"Sets the bounds of the Physics world to match the Game.World dimensions.\\nYou can optionally set which 'walls' to create: left, right, top or bottom.","line":467,"public":true,"protected":false,"private":false,"parameters":[{"name":"left","type":["boolean"],"help":"If true will create the left bounds wall.","optional":true,"default":"true"},{"name":"right","type":["boolean"],"help":"If true will create the right bounds wall.","optional":true,"default":"true"},{"name":"top","type":["boolean"],"help":"If true will create the top bounds wall.","optional":true,"default":"true"},{"name":"bottom","type":["boolean"],"help":"If true will create the bottom bounds wall.","optional":true,"default":"true"},{"name":"setCollisionGroup","type":["boolean"],"help":"If true the Bounds will be set to use its own Collision Group.","optional":true,"default":"true"}],"inherited":false,"inheritedFrom":""},{"name":"setCollisionGroup","static":false,"returns":null,"help":"Sets the given CollisionGroup to be the collision group for all shapes in this Body, unless a shape is specified.\\nNote that this resets the collisionMask and any previously set groups. See Body.collides() for appending them.","line":1303,"public":true,"protected":false,"private":false,"parameters":[{"name":"object","type":["Phaser.Group","Phaser.Sprite"],"help":"A Sprite or Group to apply the Collision Group to. If a Group is given it will be applied to all top-level children.","optional":false,"default":null},{"name":"group","type":["Phaser.Physics.CollisionGroup"],"help":"The Collision Group that this Bodies shapes will use.","optional":false,"default":null}],"inherited":false,"inheritedFrom":""},{"name":"setImpactEvents","static":false,"returns":null,"help":"Impact event handling is disabled by default. Enable it before any impact events will be dispatched.\\nIn a busy world hundreds of impact events can be generated every step, so only enable this if you cannot do what you need via beginContact or collision masks.","line":310,"public":true,"protected":false,"private":false,"parameters":[{"name":"state","type":["boolean"],"help":"Set to true to enable impact events, or false to disable.","optional":false,"default":null}],"inherited":false,"inheritedFrom":""},{"name":"setMaterial","static":false,"returns":null,"help":"Sets the given Material against all Shapes owned by all the Bodies in the given array.","line":1048,"public":true,"protected":false,"private":false,"parameters":[{"name":"material","type":["Phaser.Physics.P2.Material"],"help":"The Material to be applied to the given Bodies.","optional":false,"default":null},{"name":"bodies","type":["array Phaser.Physics.P2.Body"],"help":"An Array of Body objects that the given Material will be set on.","optional":false,"default":null}],"inherited":false,"inheritedFrom":""},{"name":"setPostBroadphaseCallback","static":false,"returns":null,"help":"Sets a callback to be fired after the Broadphase has collected collision pairs in the world.\\nJust because a pair exists it doesn't mean they *will* collide, just that they potentially could do.\\nIf your calback returns `false` the pair will be removed from the narrowphase. This will stop them testing for collision this step.\\nReturning `true` from the callback will ensure they are checked in the narrowphase.","line":333,"public":true,"protected":false,"private":false,"parameters":[{"name":"callback","type":["function"],"help":"The callback that will receive the postBroadphase event data. It must return a boolean. Set to null to disable an existing callback.","optional":false,"default":null},{"name":"context","type":["object"],"help":"The context under which the callback will be fired.","optional":false,"default":null}],"inherited":false,"inheritedFrom":""},{"name":"setWorldMaterial","static":false,"returns":null,"help":"Sets the given material against the 4 bounds of this World.","line":483,"public":true,"protected":false,"private":false,"parameters":[{"name":"material","type":["Phaser.Physics.P2.Material"],"help":"The material to set.","optional":false,"default":null},{"name":"left","type":["boolean"],"help":"If true will set the material on the left bounds wall.","optional":true,"default":"true"},{"name":"right","type":["boolean"],"help":"If true will set the material on the right bounds wall.","optional":true,"default":"true"},{"name":"top","type":["boolean"],"help":"If true will set the material on the top bounds wall.","optional":true,"default":"true"},{"name":"bottom","type":["boolean"],"help":"If true will set the material on the bottom bounds wall.","optional":true,"default":"true"}],"inherited":false,"inheritedFrom":""},{"name":"toJSON","static":false,"returns":{"types":["object"],"help":"A JSON representation of the world."},"help":"Converts the current world into a JSON object.","line":1243,"public":true,"protected":false,"private":false,"parameters":[],"inherited":false,"inheritedFrom":""},{"name":"update","static":false,"returns":null,"help":"Internal P2 update loop.","line":672,"public":true,"protected":false,"private":false,"parameters":[],"inherited":false,"inheritedFrom":""},{"name":"updateBoundsCollisionGroup","static":false,"returns":null,"help":"By default the World will be set to collide everything with everything. The bounds of the world is a Body with 4 shapes, one for each face.\\nIf you start to use your own collision groups then your objects will no longer collide with the bounds.\\nTo fix this you need to adjust the bounds to use its own collision group first BEFORE changing your Sprites collision group.","line":520,"public":true,"protected":false,"private":false,"parameters":[{"name":"setCollisionGroup","type":["boolean"],"help":"If true the Bounds will be set to use its own Collision Group.","optional":true,"default":"true"}],"inherited":false,"inheritedFrom":""}],"protected":[],"private":[{"name":"impactHandler","static":false,"returns":null,"help":"Handles a p2 impact event.","line":380,"public":false,"protected":false,"private":true,"parameters":[{"name":"event","type":["object"],"help":"The event data.","optional":false,"default":null}],"inherited":false,"inheritedFrom":""},{"name":"postBroadphaseHandler","static":false,"returns":null,"help":"Internal handler for the postBroadphase event.","line":356,"public":false,"protected":false,"private":true,"parameters":[{"name":"event","type":["object"],"help":"The event data.","optional":false,"default":null}],"inherited":false,"inheritedFrom":""}],"static":[]},"properties":{"public":[{"name":"applyDamping","type":["boolean"],"help":"","inlineHelp":"Enable to automatically apply body damping each step.","line":1761,"default":null,"public":true,"protected":false,"private":false,"readOnly":false},{"name":"applyGravity","type":["boolean"],"help":"","inlineHelp":"Enable to automatically apply gravity each step.","line":1781,"default":null,"public":true,"protected":false,"private":false,"readOnly":false},{"name":"applySpringForces","type":["boolean"],"help":"","inlineHelp":"Enable to automatically apply spring forces each step.","line":1741,"default":null,"public":true,"protected":false,"private":false,"readOnly":false},{"name":"boundsCollidesWith","type":["array"],"help":"","inlineHelp":"An array of the bodies the world bounds collides with.","line":174,"default":null,"public":true,"protected":false,"private":false,"readOnly":false},{"name":"boundsCollisionGroup","type":["Phaser.Physics.P2.CollisionGroup"],"help":"","inlineHelp":"A default collision group.","line":164,"default":null,"public":true,"protected":false,"private":false,"readOnly":false},{"name":"callbackContext","type":["object"],"help":"","inlineHelp":"The context under which the callbacks are fired.","line":126,"default":null,"public":true,"protected":false,"private":false,"readOnly":false},{"name":"collisionGroups","type":["array"],"help":"","inlineHelp":"An array containing the collision groups that have been defined in the World.","line":154,"default":null,"public":true,"protected":false,"private":false,"readOnly":false},{"name":"contactMaterial","type":["p2.ContactMaterial"],"help":"","inlineHelp":"The default Contact Material being used by the World.","line":1721,"default":null,"public":true,"protected":false,"private":false,"readOnly":false},{"name":"emitImpactEvent","type":["boolean"],"help":"","inlineHelp":"Set to true if you want to the world to emit the \"impact\" event. Turning this off could improve performance.","line":1836,"default":null,"public":true,"protected":false,"private":false,"readOnly":false},{"name":"everythingCollisionGroup","type":["Phaser.Physics.P2.CollisionGroup"],"help":"","inlineHelp":"A default collision group.","line":169,"default":null,"public":true,"protected":false,"private":false,"readOnly":false},{"name":"frameRate","type":["number"],"help":"","inlineHelp":"The frame rate the world will be stepped at. Defaults to 1 \/ 60, but you can change here. Also see useElapsedTime property.","line":48,"default":"1 \/ 60","public":true,"protected":false,"private":false,"readOnly":false},{"name":"friction","type":["number"],"help":"","inlineHelp":"Friction between colliding bodies. This value is used if no matching ContactMaterial is found for a Material pair.","line":1681,"default":null,"public":true,"protected":false,"private":false,"readOnly":false},{"name":"game","type":["Phaser.Game"],"help":"","inlineHelp":"Local reference to game.","line":25,"default":null,"public":true,"protected":false,"private":false,"readOnly":false},{"name":"gravity","type":["Phaser.Physics.P2.InversePointProxy"],"help":"","inlineHelp":"The gravity applied to all bodies each step.","line":71,"default":null,"public":true,"protected":false,"private":false,"readOnly":false},{"name":"nothingCollisionGroup","type":["Phaser.Physics.P2.CollisionGroup"],"help":"","inlineHelp":"A default collision group.","line":159,"default":null,"public":true,"protected":false,"private":false,"readOnly":false},{"name":"onBeginContact","type":["Phaser.Signal"],"help":"","inlineHelp":"Dispatched when a first contact is created between two bodies. This event is fired before the step has been done.","line":131,"default":null,"public":true,"protected":false,"private":false,"readOnly":false},{"name":"onBodyAdded","type":["Phaser.Signal"],"help":"","inlineHelp":"Dispatched when a new Body is added to the World.","line":81,"default":null,"public":true,"protected":false,"private":false,"readOnly":false},{"name":"onBodyRemoved","type":["Phaser.Signal"],"help":"","inlineHelp":"Dispatched when a Body is removed from the World.","line":86,"default":null,"public":true,"protected":false,"private":false,"readOnly":false},{"name":"onConstraintAdded","type":["Phaser.Signal"],"help":"","inlineHelp":"Dispatched when a new Constraint is added to the World.","line":101,"default":null,"public":true,"protected":false,"private":false,"readOnly":false},{"name":"onConstraintRemoved","type":["Phaser.Signal"],"help":"","inlineHelp":"Dispatched when a Constraint is removed from the World.","line":106,"default":null,"public":true,"protected":false,"private":false,"readOnly":false},{"name":"onContactMaterialAdded","type":["Phaser.Signal"],"help":"","inlineHelp":"Dispatched when a new ContactMaterial is added to the World.","line":111,"default":null,"public":true,"protected":false,"private":false,"readOnly":false},{"name":"onContactMaterialRemoved","type":["Phaser.Signal"],"help":"","inlineHelp":"Dispatched when a ContactMaterial is removed from the World.","line":116,"default":null,"public":true,"protected":false,"private":false,"readOnly":false},{"name":"onEndContact","type":["Phaser.Signal"],"help":"","inlineHelp":"Dispatched when final contact occurs between two bodies. This event is fired before the step has been done.","line":136,"default":null,"public":true,"protected":false,"private":false,"readOnly":false},{"name":"onSpringAdded","type":["Phaser.Signal"],"help":"","inlineHelp":"Dispatched when a new Spring is added to the World.","line":91,"default":null,"public":true,"protected":false,"private":false,"readOnly":false},{"name":"onSpringRemoved","type":["Phaser.Signal"],"help":"","inlineHelp":"Dispatched when a Spring is removed from the World.","line":96,"default":null,"public":true,"protected":false,"private":false,"readOnly":false},{"name":"paused","type":["boolean"],"help":"","inlineHelp":"The paused state of the P2 World.","line":60,"default":"false","public":true,"protected":false,"private":false,"readOnly":false},{"name":"postBroadphaseCallback","type":["function"],"help":"","inlineHelp":"A postBroadphase callback.","line":121,"default":null,"public":true,"protected":false,"private":false,"readOnly":false},{"name":"restitution","type":["number"],"help":"","inlineHelp":"Default coefficient of restitution between colliding bodies. This value is used if no matching ContactMaterial is found for a Material pair.","line":1701,"default":null,"public":true,"protected":false,"private":false,"readOnly":false},{"name":"sleepMode","type":["number"],"help":"How to deactivate bodies during simulation. Possible modes are: World.NO_SLEEPING, World.BODY_SLEEPING and World.ISLAND_SLEEPING.\\nIf sleeping is enabled, you might need to wake up the bodies if they fall asleep when they shouldn't. If you want to enable sleeping in the world, but want to disable it for a particular body, see Body.allowSleep.","inlineHelp":"","line":1858,"default":null,"public":true,"protected":false,"private":false,"readOnly":false},{"name":"solveConstraints","type":["boolean"],"help":"","inlineHelp":"Enable\/disable constraint solving in each step.","line":1801,"default":null,"public":true,"protected":false,"private":false,"readOnly":false},{"name":"time","type":["boolean"],"help":"","inlineHelp":"The World time.","line":1822,"default":null,"public":true,"protected":false,"private":false,"readOnly":true},{"name":"total","type":["number"],"help":"","inlineHelp":"The total number of bodies in the world.","line":1879,"default":null,"public":true,"protected":false,"private":false,"readOnly":true},{"name":"useElapsedTime","type":["boolean"],"help":"","inlineHelp":"If true the frameRate value will be ignored and instead p2 will step with the value of Game.Time.physicsElapsed, which is a delta time value.","line":54,"default":"false","public":true,"protected":false,"private":false,"readOnly":false},{"name":"walls","type":["object"],"help":"","inlineHelp":"An object containing the 4 wall bodies that bound the physics world.","line":76,"default":null,"public":true,"protected":false,"private":false,"readOnly":false}],"protected":[{"name":"config","type":["object"],"help":"","inlineHelp":"The p2 World configuration object.","line":36,"default":null,"public":false,"protected":true,"private":false,"readOnly":false},{"name":"materials","type":["array Phaser.Physics.P2.Material"],"help":"","inlineHelp":"A local array of all created Materials.","line":66,"default":null,"public":false,"protected":true,"private":false,"readOnly":false},{"name":"world","type":["p2.World"],"help":"","inlineHelp":"The p2 World in which the simulation is run.","line":42,"default":null,"public":false,"protected":true,"private":false,"readOnly":false}],"private":[{"name":"_collisionGroupID","type":["number"],"help":"","inlineHelp":"Internal var.","line":186,"default":null,"public":false,"protected":false,"private":true,"readOnly":false},{"name":"_toRemove","type":["array"],"help":"","inlineHelp":"Internal var used to hold references to bodies to remove from the world on the next step.","line":180,"default":null,"public":false,"protected":false,"private":true,"readOnly":false}]}} |