mirror of
https://github.com/photonstorm/phaser
synced 2024-12-21 10:33:35 +00:00
1 line
41 KiB
JSON
1 line
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,"d
|