mirror of
https://github.com/photonstorm/phaser
synced 2024-12-22 19:13:37 +00:00
1 line
No EOL
41 KiB
JSON
1 line
No EOL
41 KiB
JSON
{"class":{"name":"Phaser.Physics.P2.Body","extends":"","static":false,"constructor":true,"parameters":[{"name":"game","type":["Phaser.Game"],"help":"Game reference to the currently running game.","optional":false,"default":null},{"name":"sprite","type":["Phaser.Sprite"],"help":"The Sprite object this physics body belongs to.","optional":true,"default":null},{"name":"x","type":["number"],"help":"The x coordinate of this Body.","optional":true,"default":"0"},{"name":"y","type":["number"],"help":"The y coordinate of this Body.","optional":true,"default":"0"},{"name":"mass","type":["number"],"help":"The default mass of this Body (0 = static).","optional":true,"default":"1"}],"help":"The Physics Body is typically linked to a single Sprite and defines properties that determine how the physics body is simulated.\\nThese 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.\\nIn 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.\\nBy 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.\\nNote: 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.\\nNote: When a game object is given a P2 body it has its anchor x\/y set to 0.5, so it becomes centered."},"consts":[],"methods":{"public":[{"name":"addCapsule","static":false,"returns":{"types":["p2.Capsule"],"help":"The Capsule shape that was added to the Body."},"help":"Adds a Capsule shape to this Body.\\nYou can control the offset from the center of the body and the rotation.","line":926,"public":true,"protected":false,"private":false,"parameters":[{"name":"length","type":["number"],"help":"The distance between the end points in pixels.","optional":false,"default":null},{"name":"radius","type":["number"],"help":"Radius of the capsule in pixels.","optional":false,"default":null},{"name":"offsetX","type":["number"],"help":"Local horizontal offset of the shape relative to the body center of mass.","optional":true,"default":"0"},{"name":"offsetY","type":["number"],"help":"Local vertical offset of the shape relative to the body center of mass.","optional":true,"default":"0"},{"name":"rotation","type":["number"],"help":"Local rotation of the shape relative to the body center of mass, specified in radians.","optional":true,"default":"0"}],"inherited":false,"inheritedFrom":""},{"name":"addCircle","static":false,"returns":{"types":["p2.Circle"],"help":"The Circle shape that was added to the Body."},"help":"Adds a Circle shape to this Body. You can control the offset from the center of the body and the rotation.","line":833,"public":true,"protected":false,"private":false,"parameters":[{"name":"radius","type":["number"],"help":"The radius of this circle (in pixels)","optional":false,"default":null},{"name":"offsetX","type":["number"],"help":"Local horizontal offset of the shape relative to the body center of mass.","optional":true,"default":"0"},{"name":"offsetY","type":["number"],"help":"Local vertical offset of the shape relative to the body center of mass.","optional":true,"default":"0"},{"name":"rotation","type":["number"],"help":"Local rotation of the shape relative to the body center of mass, specified in radians.","optional":true,"default":"0"}],"inherited":false,"inheritedFrom":""},{"name":"addFixture","static":false,"returns":{"types":["array"],"help":"An array containing the generated shapes for the given polygon."},"help":"Add a polygon fixture. This is used during #loadPolygon.","line":1157,"public":true,"protected":false,"private":false,"parameters":[{"name":"fixtureData","type":["string"],"help":"The data for the fixture. It contains: isSensor, filter (collision) and the actual polygon shapes.","optional":false,"default":null}],"inherited":false,"inheritedFrom":""},{"name":"addLine","static":false,"returns":{"types":["p2.Line"],"help":"The Line shape that was added to the Body."},"help":"Adds a Line shape to this Body.\\nThe line shape is along the x direction, and stretches from [-length\/2, 0] to [length\/2,0].\\nYou can control the offset from the center of the body and the rotation.","line":906,"public":true,"protected":false,"private":false,"parameters":[{"name":"length","type":["number"],"help":"The length of this line (in pixels)","optional":false,"default":null},{"name":"offsetX","type":["number"],"help":"Local horizontal offset of the shape relative to the body center of mass.","optional":true,"default":"0"},{"name":"offsetY","type":["number"],"help":"Local vertical offset of the shape relative to the body center of mass.","optional":true,"default":"0"},{"name":"rotation","type":["number"],"help":"Local rotation of the shape relative to the body center of mass, specified in radians.","optional":true,"default":"0"}],"inherited":false,"inheritedFrom":""},{"name":"addParticle","static":false,"returns":{"types":["p2.Particle"],"help":"The Particle shape that was added to the Body."},"help":"Adds a Particle shape to this Body. You can control the offset from the center of the body and the rotation.","line":886,"public":true,"protected":false,"private":false,"parameters":[{"name":"offsetX","type":["number"],"help":"Local horizontal offset of the shape relative to the body center of mass.","optional":true,"default":"0"},{"name":"offsetY","type":["number"],"help":"Local vertical offset of the shape relative to the body center of mass.","optional":true,"default":"0"},{"name":"rotation","type":["number"],"help":"Local rotation of the shape relative to the body center of mass, specified in radians.","optional":true,"default":"0"}],"inherited":false,"inheritedFrom":""},{"name":"addPhaserPolygon","static":false,"returns":null,"help":"Reads the shape data from a physics data file stored in the Game.Cache and adds it as a polygon to this Body.\\nThe shape data format is based on the custom phaser export in.","line":1121,"public":true,"protected":false,"private":false,"parameters":[{"name":"key","type":["string"],"help":"The key of the Physics Data file as stored in Game.Cache.","optional":false,"default":null},{"name":"object","type":["string"],"help":"The key of the object within the Physics data file that you wish to load the shape data from.","optional":false,"default":null}],"inherited":false,"inheritedFrom":""},{"name":"addPlane","static":false,"returns":{"types":["p2.Plane"],"help":"The Plane shape that was added to the Body."},"help":"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.","line":869,"public":true,"protected":false,"private":false,"parameters":[{"name":"offsetX","type":["number"],"help":"Local horizontal offset of the shape relative to the body center of mass.","optional":true,"default":"0"},{"name":"offsetY","type":["number"],"help":"Local vertical offset of the shape relative to the body center of mass.","optional":true,"default":"0"},{"name":"rotation","type":["number"],"help":"Local rotation of the shape relative to the body center of mass, specified in radians.","optional":true,"default":"0"}],"inherited":false,"inheritedFrom":""},{"name":"addPolygon","static":false,"returns":{"types":["boolean"],"help":"True on success, else false."},"help":"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.\\nThis 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.\\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":948,"public":true,"protected":false,"private":false,"parameters":[{"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":"addRectangle","static":false,"returns":{"types":["p2.Rectangle"],"help":"The Rectangle shape that was added to the Body."},"help":"Adds a Rectangle shape to this Body. You can control the offset from the center of the body and the rotation.","line":852,"public":true,"protected":false,"private":false,"parameters":[{"name":"width","type":["number"],"help":"The width of the rectangle in pixels.","optional":false,"default":null},{"name":"height","type":["number"],"help":"The height of the rectangle in pixels.","optional":false,"default":null},{"name":"offsetX","type":["number"],"help":"Local horizontal offset of the shape relative to the body center of mass.","optional":true,"default":"0"},{"name":"offsetY","type":["number"],"help":"Local vertical offset of the shape relative to the body center of mass.","optional":true,"default":"0"},{"name":"rotation","type":["number"],"help":"Local rotation of the shape relative to the body center of mass, specified in radians.","optional":true,"default":"0"}],"inherited":false,"inheritedFrom":""},{"name":"addShape","static":false,"returns":{"types":["p2.Shape"],"help":"The shape that was added to the body."},"help":"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.\\nWill automatically update the mass properties and bounding radius.","line":810,"public":true,"protected":false,"private":false,"parameters":[{"name":"shape","type":["p2.Shape"],"help":"The shape to add to the body.","optional":false,"default":null},{"name":"offsetX","type":["number"],"help":"Local horizontal offset of the shape relative to the body center of mass.","optional":true,"default":"0"},{"name":"offsetY","type":["number"],"help":"Local vertical offset of the shape relative to the body center of mass.","optional":true,"default":"0"},{"name":"rotation","type":["number"],"help":"Local rotation of the shape relative to the body center of mass, specified in radians.","optional":true,"default":"0"}],"inherited":false,"inheritedFrom":""},{"name":"addToWorld","static":false,"returns":null,"help":"Adds this physics body to the world.","line":720,"public":true,"protected":false,"private":false,"parameters":[],"inherited":false,"inheritedFrom":""},{"name":"adjustCenterOfMass","static":false,"returns":null,"help":"Moves the shape offsets so their center of mass becomes the body center of mass.","line":400,"public":true,"protected":false,"private":false,"parameters":[],"inherited":false,"inheritedFrom":""},{"name":"applyDamping","static":false,"returns":null,"help":"Apply damping, see http:\/\/code.google.com\/p\/bullet\/issues\/detail?id=74 for details.","line":412,"public":true,"protected":false,"private":false,"parameters":[{"name":"dt","type":["number"],"help":"Current time step.","optional":false,"default":null}],"inherited":false,"inheritedFrom":""},{"name":"applyForce","static":false,"returns":null,"help":"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.","line":426,"public":true,"protected":false,"private":false,"parameters":[{"name":"force","type":["Float32Array","array"],"help":"The force vector to add.","optional":false,"default":null},{"name":"worldX","type":["number"],"help":"The world x point to apply the force on.","optional":false,"default":null},{"name":"worldY","type":["number"],"help":"The world y point to apply the force on.","optional":false,"default":null}],"inherited":false,"inheritedFrom":""},{"name":"clearCollision","static":false,"returns":null,"help":"Clears the collision data from the shapes in this Body. Optionally clears Group and\/or Mask.","line":303,"public":true,"protected":false,"private":false,"parameters":[{"name":"clearGroup","type":["boolean"],"help":"Clear the collisionGroup value from the shape\/s?","optional":true,"default":"true"},{"name":"clearMask","type":["boolean"],"help":"Clear the collisionMask value from the shape\/s?","optional":true,"default":"true"},{"name":"shape","type":["p2.Shape"],"help":"An optional Shape. If not provided the collision data will be cleared from all Shapes in this Body.","optional":true,"default":null}],"inherited":false,"inheritedFrom":""},{"name":"clearShapes","static":false,"returns":null,"help":"Removes all Shapes from this Body.","line":786,"public":true,"protected":false,"private":false,"parameters":[],"inherited":false,"inheritedFrom":""},{"name":"collides","static":false,"returns":null,"help":"Adds the given CollisionGroup, or array of CollisionGroups, to the list of groups that this body will collide with and updates the collision masks.","line":349,"public":true,"protected":false,"private":false,"parameters":[{"name":"group","type":["Phaser.Physics.CollisionGroup","array"],"help":"The Collision Group or Array of Collision Groups that this Bodies shapes will collide with.","optional":false,"default":null},{"name":"callback","type":["function"],"help":"Optional callback that will be triggered when this Body impacts with the given Group.","optional":true,"default":null},{"name":"callbackContext","type":["object"],"help":"The context under which the callback will be called.","optional":true,"default":null},{"name":"shape","type":["p2.Shape"],"help":"An optional Shape. If not provided the collision mask will be added to all Shapes in this Body.","optional":true,"default":null}],"inherited":false,"inheritedFrom":""},{"name":"createBodyCallback","static":false,"returns":null,"help":"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.\\nThe callback will be sent 4 parameters: This body, the body that impacted, the Shape in this body and the shape in the impacting body.\\nNote that the impact event happens after collision resolution, so it cannot be used to prevent a collision from happening.\\nIt 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.","line":163,"public":true,"protected":false,"private":false,"parameters":[{"name":"object","type":["Phaser.Sprite","Phaser.TileSprite","Phaser.Physics.P2.Body","p2.Body"],"help":"The object to send impact events for.","optional":false,"default":null},{"name":"callback","type":["function"],"help":"The callback to fire on impact. Set to null to clear a previously set callback.","optional":false,"default":null},{"name":"callbackContext","type":["object"],"help":"The context under which the callback will fire.","optional":false,"default":null}],"inherited":false,"inheritedFrom":""},{"name":"createGroupCallback","static":false,"returns":null,"help":"Sets a callback to be fired any time this Body impacts with the given Group. The impact test is performed against shape.collisionGroup values.\\nThe callback will be sent 4 parameters: This body, the body that impacted, the Shape in this body and the shape in the impacting body.\\nThis callback will only fire if this Body has been assigned a collision group.\\nNote that the impact event happens after collision resolution, so it cannot be used to prevent a collision from happening.\\nIt 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.","line":204,"public":true,"protected":false,"private":false,"parameters":[{"name":"group","type":["Phaser.Physics.CollisionGroup"],"help":"The Group to send impact events for.","optional":false,"default":null},{"name":"callback","type":["function"],"help":"The callback to fire on impact. Set to null to clear a previously set callback.","optional":false,"default":null},{"name":"callbackContext","type":["object"],"help":"The context under which the callback will fire.","optional":false,"default":null}],"inherited":false,"inheritedFrom":""},{"name":"destroy","static":false,"returns":null,"help":"Destroys this Body and all references it holds to other objects.","line":759,"public":true,"protected":false,"private":false,"parameters":[],"inherited":false,"inheritedFrom":""},{"name":"getCollisionMask","static":false,"returns":{"types":["number"],"help":"The bitmask."},"help":"Gets the collision bitmask from the groups this body collides with.","line":225,"public":true,"protected":false,"private":false,"parameters":[],"inherited":false,"inheritedFrom":""},{"name":"loadPolygon","static":false,"returns":{"types":["boolean"],"help":"True on success, else false."},"help":"Reads the shape data from a physics data file stored in the Game.Cache and adds it as a polygon to this Body.","line":1230,"public":true,"protected":false,"private":false,"parameters":[{"name":"key","type":["string"],"help":"The key of the Physics Data file as stored in Game.Cache.","optional":false,"default":null},{"name":"object","type":["string"],"help":"The key of the object within the Physics data file that you wish to load the shape data from.","optional":false,"default":null}],"inherited":false,"inheritedFrom":""},{"name":"moveBackward","static":false,"returns":null,"help":"Moves the Body backwards based on its current angle and the given speed.\\nThe speed is represented in pixels per second. So a value of 100 would move 100 pixels in 1 second (1000ms).","line":552,"public":true,"protected":false,"private":false,"parameters":[{"name":"speed","type":["number"],"help":"The speed at which it should move backwards.","optional":false,"default":null}],"inherited":false,"inheritedFrom":""},{"name":"moveDown","static":false,"returns":null,"help":"If this Body is dynamic then this will move it down by setting its y velocity to the given speed.\\nThe speed is represented in pixels per second. So a value of 100 would move 100 pixels in 1 second (1000ms).","line":642,"public":true,"protected":false,"private":false,"parameters":[{"name":"speed","type":["number"],"help":"The speed at which it should move down, in pixels per second.","optional":false,"default":null}],"inherited":false,"inheritedFrom":""},{"name":"moveForward","static":false,"returns":null,"help":"Moves the Body forwards based on its current angle and the given speed.\\nThe speed is represented in pixels per second. So a value of 100 would move 100 pixels in 1 second (1000ms).","line":535,"public":true,"protected":false,"private":false,"parameters":[{"name":"speed","type":["number"],"help":"The speed at which it should move forwards.","optional":false,"default":null}],"inherited":false,"inheritedFrom":""},{"name":"moveLeft","static":false,"returns":null,"help":"If this Body is dynamic then this will move it to the left by setting its x velocity to the given speed.\\nThe speed is represented in pixels per second. So a value of 100 would move 100 pixels in 1 second (1000ms).","line":603,"public":true,"protected":false,"private":false,"parameters":[{"name":"speed","type":["number"],"help":"The speed at which it should move to the left, in pixels per second.","optional":false,"default":null}],"inherited":false,"inheritedFrom":""},{"name":"moveRight","static":false,"returns":null,"help":"If this Body is dynamic then this will move it to the right by setting its x velocity to the given speed.\\nThe speed is represented in pixels per second. So a value of 100 would move 100 pixels in 1 second (1000ms).","line":616,"public":true,"protected":false,"private":false,"parameters":[{"name":"speed","type":["number"],"help":"The speed at which it should move to the right, in pixels per second.","optional":false,"default":null}],"inherited":false,"inheritedFrom":""},{"name":"moveUp","static":false,"returns":null,"help":"If this Body is dynamic then this will move it up by setting its y velocity to the given speed.\\nThe speed is represented in pixels per second. So a value of 100 would move 100 pixels in 1 second (1000ms).","line":629,"public":true,"protected":false,"private":false,"parameters":[{"name":"speed","type":["number"],"help":"The speed at which it should move up, in pixels per second.","optional":false,"default":null}],"inherited":false,"inheritedFrom":""},{"name":"removeFromWorld","static":false,"returns":null,"help":"Removes this physics body from the world.","line":745,"public":true,"protected":false,"private":false,"parameters":[],"inherited":false,"inheritedFrom":""},{"name":"removeShape","static":false,"returns":{"types":["boolean"],"help":"True if the shape was found and removed, else false."},"help":"Remove a shape from the body. Will automatically update the mass properties and bounding radius.","line":1007,"public":true,"protected":false,"private":false,"parameters":[{"name":"shape","type":["p2.Circle","p2.Rectangle","p2.Plane","p2.Line","p2.Particle"],"help":"The shape to remove from the body.","optional":false,"default":null}],"inherited":false,"inheritedFrom":""},{"name":"reset","static":false,"returns":null,"help":"Resets the Body force, velocity (linear and angular) and rotation. Optionally resets damping and mass.","line":691,"public":true,"protected":false,"private":false,"parameters":[{"name":"x","type":["number"],"help":"The new x position of the Body.","optional":false,"default":null},{"name":"y","type":["number"],"help":"The new x position of the Body.","optional":false,"default":null},{"name":"resetDamping","type":["boolean"],"help":"Resets the linear and angular damping.","optional":true,"default":"false"},{"name":"resetMass","type":["boolean"],"help":"Sets the Body mass back to 1.","optional":true,"default":"false"}],"inherited":false,"inheritedFrom":""},{"name":"reverse","static":false,"returns":null,"help":"Applies a force to the Body that causes it to 'thrust' backwards (in reverse), based on its current angle and the given speed.\\nThe speed is represented in pixels per second. So a value of 100 would move 100 pixels in 1 second (1000ms).","line":586,"public":true,"protected":false,"private":false,"parameters":[{"name":"speed","type":["number"],"help":"The speed at which it should reverse.","optional":false,"default":null}],"inherited":false,"inheritedFrom":""},{"name":"rotateLeft","static":false,"returns":null,"help":"This will rotate the Body by the given speed to the left (counter-clockwise).","line":510,"public":true,"protected":false,"private":false,"parameters":[{"name":"speed","type":["number"],"help":"The speed at which it should rotate.","optional":false,"default":null}],"inherited":false,"inheritedFrom":""},{"name":"rotateRight","static":false,"returns":null,"help":"This will rotate the Body by the given speed to the left (clockwise).","line":522,"public":true,"protected":false,"private":false,"parameters":[{"name":"speed","type":["number"],"help":"The speed at which it should rotate.","optional":false,"default":null}],"inherited":false,"inheritedFrom":""},{"name":"setCircle","static":false,"returns":null,"help":"Clears any previously set shapes. Then creates a new Circle shape and adds it to this Body.","line":1025,"public":true,"protected":false,"private":false,"parameters":[{"name":"radius","type":["number"],"help":"The radius of this circle (in pixels)","optional":false,"default":null},{"name":"offsetX","type":["number"],"help":"Local horizontal offset of the shape relative to the body center of mass.","optional":true,"default":"0"},{"name":"offsetY","type":["number"],"help":"Local vertical offset of the shape relative to the body center of mass.","optional":true,"default":"0"},{"name":"rotation","type":["number"],"help":"Local rotation of the shape relative to the body center of mass, specified in radians.","optional":true,"default":"0"}],"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.\\nThis also resets the collisionMask.","line":275,"public":true,"protected":false,"private":false,"parameters":[{"name":"group","type":["Phaser.Physics.CollisionGroup"],"help":"The Collision Group that this Bodies shapes will use.","optional":false,"default":null},{"name":"shape","type":["p2.Shape"],"help":"An optional Shape. If not provided the collision group will be added to all Shapes in this Body.","optional":true,"default":null}],"inherited":false,"inheritedFrom":""},{"name":"setMaterial","static":false,"returns":null,"help":"Adds the given Material to all Shapes that belong to this Body.\\nIf you only wish to apply it to a specific Shape in this Body then provide that as the 2nd parameter.","line":1083,"public":true,"protected":false,"private":false,"parameters":[{"name":"material","type":["Phaser.Physics.P2.Material"],"help":"The Material that will be applied.","optional":false,"default":null},{"name":"shape","type":["p2.Shape"],"help":"An optional Shape. If not provided the Material will be added to all Shapes in this Body.","optional":true,"default":null}],"inherited":false,"inheritedFrom":""},{"name":"setRectangle","static":false,"returns":{"types":["p2.Rectangle"],"help":"The Rectangle shape that was added to the Body."},"help":"Clears any previously set shapes. The creates a new Rectangle shape at the given size and offset, and adds it to this Body.\\nIf you wish to create a Rectangle to match the size of a Sprite or Image see Body.setRectangleFromSprite.","line":1045,"public":true,"protected":false,"private":false,"parameters":[{"name":"width","type":["number"],"help":"The width of the rectangle in pixels.","optional":true,"default":"16"},{"name":"height","type":["number"],"help":"The height of the rectangle in pixels.","optional":true,"default":"16"},{"name":"offsetX","type":["number"],"help":"Local horizontal offset of the shape relative to the body center of mass.","optional":true,"default":"0"},{"name":"offsetY","type":["number"],"help":"Local vertical offset of the shape relative to the body center of mass.","optional":true,"default":"0"},{"name":"rotation","type":["number"],"help":"Local rotation of the shape relative to the body center of mass, specified in radians.","optional":true,"default":"0"}],"inherited":false,"inheritedFrom":""},{"name":"setRectangleFromSprite","static":false,"returns":{"types":["p2.Rectangle"],"help":"The Rectangle shape that was added to the Body."},"help":"Clears any previously set shapes.\\nThen creates a Rectangle shape sized to match the dimensions and orientation of the Sprite given.\\nIf no Sprite is given it defaults to using the parent of this Body.","line":1065,"public":true,"protected":false,"private":false,"parameters":[{"name":"sprite","type":["Phaser.Sprite","Phaser.Image"],"help":"The Sprite on which the Rectangle will get its dimensions.","optional":true,"default":null}],"inherited":false,"inheritedFrom":""},{"name":"setZeroDamping","static":false,"returns":null,"help":"Sets the Body damping and angularDamping to zero.","line":471,"public":true,"protected":false,"private":false,"parameters":[],"inherited":false,"inheritedFrom":""},{"name":"setZeroForce","static":false,"returns":null,"help":"Sets the force on the body to zero.","line":437,"public":true,"protected":false,"private":false,"parameters":[],"inherited":false,"inheritedFrom":""},{"name":"setZeroRotation","static":false,"returns":null,"help":"If this Body is dynamic then this will zero its angular velocity.","line":448,"public":true,"protected":false,"private":false,"parameters":[],"inherited":false,"inheritedFrom":""},{"name":"setZeroVelocity","static":false,"returns":null,"help":"If this Body is dynamic then this will zero its velocity on both axis.","line":459,"public":true,"protected":false,"private":false,"parameters":[],"inherited":false,"inheritedFrom":""},{"name":"shapeChanged","static":false,"returns":null,"help":"Updates the debug draw if any body shapes change.","line":1104,"public":true,"protected":false,"private":false,"parameters":[],"inherited":false,"inheritedFrom":""},{"name":"thrust","static":false,"returns":null,"help":"Applies a force to the Body that causes it to 'thrust' forwards, based on its current angle and the given speed.\\nThe speed is represented in pixels per second. So a value of 100 would move 100 pixels in 1 second (1000ms).","line":569,"public":true,"protected":false,"private":false,"parameters":[{"name":"speed","type":["number"],"help":"The speed at which it should thrust.","optional":false,"default":null}],"inherited":false,"inheritedFrom":""},{"name":"toLocalFrame","static":false,"returns":null,"help":"Transform a world point to local body frame.","line":485,"public":true,"protected":false,"private":false,"parameters":[{"name":"out","type":["Float32Array","array"],"help":"The vector to store the result in.","optional":false,"default":null},{"name":"worldPoint","type":["Float32Array","array"],"help":"The input world vector.","optional":false,"default":null}],"inherited":false,"inheritedFrom":""},{"name":"toWorldFrame","static":false,"returns":null,"help":"Transform a local point to world frame.","line":498,"public":true,"protected":false,"private":false,"parameters":[{"name":"out","type":["array"],"help":"The vector to store the result in.","optional":false,"default":null},{"name":"localPoint","type":["array"],"help":"The input local vector.","optional":false,"default":null}],"inherited":false,"inheritedFrom":""},{"name":"updateCollisionMask","static":false,"returns":null,"help":"Updates the collisionMask.","line":249,"public":true,"protected":false,"private":false,"parameters":[{"name":"shape","type":["p2.Shape"],"help":"An optional Shape. If not provided the collision group will be added to all Shapes in this Body.","optional":true,"default":null}],"inherited":false,"inheritedFrom":""}],"protected":[{"name":"postUpdate","static":false,"returns":null,"help":"Internal method. This is called directly before the sprites are sent to the renderer and after the update function has finished.","line":670,"public":false,"protected":true,"private":false,"parameters":[],"inherited":false,"inheritedFrom":""},{"name":"preUpdate","static":false,"returns":null,"help":"Internal method. This is called directly before the sprites are sent to the renderer and after the update function has finished.","line":654,"public":false,"protected":true,"private":false,"parameters":[],"inherited":false,"inheritedFrom":""}],"private":[],"static":[]},"properties":{"public":[{"name":"DYNAMIC","type":["number"],"help":"Dynamic body. Dynamic bodies body can move and respond to collisions and forces.","inlineHelp":"","line":1284,"default":null,"public":true,"protected":false,"private":false,"readOnly":false},{"name":"KINEMATIC","type":["number"],"help":"Kinematic body. Kinematic bodies only moves according to its .velocity, and does not respond to collisions or force.","inlineHelp":"","line":1300,"default":null,"public":true,"protected":false,"private":false,"readOnly":false},{"name":"STATIC","type":["number"],"help":"Static body. Static bodies do not move, and they do not respond to forces or collision.","inlineHelp":"","line":1292,"default":null,"public":true,"protected":false,"private":false,"readOnly":false},{"name":"allowSleep","type":["boolean"],"help":"","inlineHelp":"","line":1401,"default":null,"public":true,"protected":false,"private":false,"readOnly":false},{"name":"angle","type":["number"],"help":"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.\\nValues 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.\\nIf 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.","inlineHelp":"The angle of this Body in degrees.","line":1428,"default":null,"public":true,"protected":false,"private":false,"readOnly":false},{"name":"angularDamping","type":["number"],"help":"Damping is specified as a value between 0 and 1, which is the proportion of velocity lost per second.","inlineHelp":"The angular damping acting acting on the body.","line":1449,"default":null,"public":true,"protected":false,"private":false,"readOnly":false},{"name":"angularForce","type":["number"],"help":"","inlineHelp":"The angular force acting on the body.","line":1469,"default":null,"public":true,"protected":false,"private":false,"readOnly":false},{"name":"angularVelocity","type":["number"],"help":"","inlineHelp":"The angular velocity of the body.","line":1489,"default":null,"public":true,"protected":false,"private":false,"readOnly":false},{"name":"collideWorldBounds","type":["boolean"],"help":"A Body can be set to collide against the World bounds automatically if this is set to true. Otherwise it will leave the World.\\nNote that this only applies if your World has bounds! The response to the collision should be managed via CollisionMaterials.\\nAlso note that when you set this it will only effect Body shapes that already exist. If you then add further shapes to your Body\\nafter setting this it will *not* proactively set them to collide with the bounds.","inlineHelp":"Should the Body collide with the World bounds?","line":1752,"default":null,"public":true,"protected":false,"private":false,"readOnly":false},{"name":"collidesWith","type":["array"],"help":"","inlineHelp":"Array of CollisionGroups that this Bodies shapes collide with.","line":95,"default":null,"public":true,"protected":false,"private":false,"readOnly":false},{"name":"damping","type":["number"],"help":"Damping is specified as a value between 0 and 1, which is the proportion of velocity lost per second.","inlineHelp":"The linear damping acting on the body in the velocity direction.","line":1510,"default":null,"public":true,"protected":false,"private":false,"readOnly":false},{"name":"debug","type":["boolean"],"help":"","inlineHelp":"Enable or disable debug drawing of this body","line":1718,"default":null,"public":true,"protected":false,"private":false,"readOnly":false},{"name":"debugBody","type":["Phaser.Physics.P2.BodyDebug"],"help":"","inlineHelp":"Reference to the debug body.","line":105,"default":null,"public":true,"protected":false,"private":false,"readOnly":false},{"name":"dynamic","type":["boolean"],"help":"","inlineHelp":"Returns true if the Body is dynamic. Setting Body.dynamic to 'false' will make it static.","line":1339,"default":null,"public":true,"protected":false,"private":false,"readOnly":false},{"name":"fixedRotation","type":["boolean"],"help":"","inlineHelp":"","line":1530,"default":null,"public":true,"protected":false,"private":false,"readOnly":false},{"name":"force","type":["Phaser.Physics.P2.InversePointProxy"],"help":"","inlineHelp":"The force applied to the body.","line":71,"default":null,"public":true,"protected":false,"private":false,"readOnly":false},{"name":"game","type":["Phaser.Game"],"help":"","inlineHelp":"Local reference to game.","line":33,"default":null,"public":true,"protected":false,"private":false,"readOnly":false},{"name":"gravity","type":["Phaser.Point"],"help":"","inlineHelp":"A locally applied gravity force to the Body. Applied directly before the world step. NOTE: Not currently implemented.","line":76,"default":null,"public":true,"protected":false,"private":false,"readOnly":false},{"name":"id","type":["number"],"help":"","inlineHelp":"The Body ID. Each Body that has been added to the World has a unique ID.","line":1704,"default":null,"public":true,"protected":false,"private":false,"readOnly":true},{"name":"inertia","type":["number"],"help":"","inlineHelp":"The inertia of the body around the Z axis..","line":1553,"default":null,"public":true,"protected":false,"private":false,"readOnly":false},{"name":"kinematic","type":["boolean"],"help":"","inlineHelp":"Returns true if the Body is kinematic. Setting Body.kinematic to 'false' will make it static.","line":1372,"default":null,"public":true,"protected":false,"private":false,"readOnly":false},{"name":"mass","type":["number"],"help":"","inlineHelp":"","line":1573,"default":null,"public":true,"protected":false,"private":false,"readOnly":false},{"name":"motionState","type":["number"],"help":"","inlineHelp":"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).","line":1597,"default":null,"public":true,"protected":false,"private":false,"readOnly":false},{"name":"offset","type":["Phaser.Point"],"help":"","inlineHelp":"The offset of the Physics Body from the Sprite x\/y position.","line":53,"default":null,"public":true,"protected":false,"private":false,"readOnly":false},{"name":"onBeginContact","type":["Phaser.Signal"],"help":"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.\\nThe 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.","inlineHelp":"","line":83,"default":null,"public":true,"protected":false,"private":false,"readOnly":false},{"name":"onEndContact","type":["Phaser.Signal"],"help":"Dispatched when contact ends between shapes in two bodies. This event is fired during the step, so collision has already taken place.\\nThe 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.","inlineHelp":"","line":90,"default":null,"public":true,"protected":false,"private":false,"readOnly":false},{"name":"removeNextStep","type":["boolean"],"help":"","inlineHelp":"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.","line":100,"default":null,"public":true,"protected":false,"private":false,"readOnly":false},{"name":"rotation","type":["number"],"help":"The angle of the Body in radians.\\nIf 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.","inlineHelp":"The angle of this Body in radians.","line":1623,"default":null,"public":true,"protected":false,"private":false,"readOnly":false},{"name":"sleepSpeedLimit","type":["number"],"help":"","inlineHelp":".","line":1643,"default":null,"public":true,"protected":false,"private":false,"readOnly":false},{"name":"sprite","type":["Phaser.Sprite"],"help":"","inlineHelp":"Reference to the parent Sprite.","line":43,"default":null,"public":true,"protected":false,"private":false,"readOnly":false},{"name":"static","type":["boolean"],"help":"","inlineHelp":"Returns true if the Body is static. Setting Body.static to 'false' will make it dynamic.","line":1306,"default":null,"public":true,"protected":false,"private":false,"readOnly":false},{"name":"type","type":["number"],"help":"","inlineHelp":"The type of physics system this body belongs to.","line":48,"default":null,"public":true,"protected":false,"private":false,"readOnly":false},{"name":"velocity","type":["Phaser.Physics.P2.InversePointProxy"],"help":"","inlineHelp":"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.","line":66,"default":null,"public":true,"protected":false,"private":false,"readOnly":false},{"name":"world","type":["Phaser.Physics.P2"],"help":"","inlineHelp":"Local reference to the P2 World.","line":38,"default":null,"public":true,"protected":false,"private":false,"readOnly":false},{"name":"x","type":["number"],"help":"","inlineHelp":"The x coordinate of this Body.","line":1663,"default":null,"public":true,"protected":false,"private":false,"readOnly":false},{"name":"y","type":["number"],"help":"","inlineHelp":"The y coordinate of this Body.","line":1683,"default":null,"public":true,"protected":false,"private":false,"readOnly":false}],"protected":[{"name":"data","type":["p2.Body"],"help":"","inlineHelp":"The p2 Body data.","line":59,"default":null,"public":false,"protected":true,"private":false,"readOnly":false}],"private":[{"name":"_bodyCallbackContext","type":["object"],"help":"","inlineHelp":"Array of Grouo callback contexts.","line":135,"default":null,"public":false,"protected":false,"private":true,"readOnly":false},{"name":"_bodyCallbacks","type":["object"],"help":"","inlineHelp":"Array of Body callbacks.","line":117,"default":null,"public":false,"protected":false,"private":true,"readOnly":false},{"name":"_collideWorldBounds","type":["boolean"],"help":"","inlineHelp":"Internal var that determines if this Body collides with the world bounds or not.","line":111,"default":null,"public":false,"protected":false,"private":true,"readOnly":false},{"name":"_groupCallbacks","type":["object"],"help":"","inlineHelp":"Array of Group callbacks.","line":129,"default":null,"public":false,"protected":false,"private":true,"readOnly":false}]}} |