Physics.P2#createRotationalSpring()

createRotationalSpring(bodyA, bodyB, restAngle, stiffness, damping) → {Phaser.Physics.P2.RotationalSpring} Creates a rotational spring, connecting two bodies. A spring can have a resting length, a stiffness and damping. Parameters Name Type Argument Default Description bodyA Phaser.Sprite | Phaser.Physics.P2.Body | p2.Body First connected body. bodyB Phaser.Sprite | Phaser.Physics.P2.Body | p2.Body Second connected body. restAngle number <optional> The relative angle o

Physics.P2#createRevoluteConstraint()

createRevoluteConstraint(bodyA, pivotA, bodyB, pivotB, maxForce, worldPivot) → {Phaser.Physics.P2.RevoluteConstraint} Connects two bodies at given offset points, letting them rotate relative to each other around this point.The pivot points are given in world (pixel) coordinates. Parameters Name Type Argument Default Description bodyA Phaser.Sprite | Phaser.Physics.P2.Body | p2.Body First connected body. pivotA Array The point relative to the center of mass of bodyA which bodyA is

Physics.P2#createPrismaticConstraint()

createPrismaticConstraint(bodyA, bodyB, lockRotation, anchorA, anchorB, axis, maxForce) → {Phaser.Physics.P2.PrismaticConstraint} Constraint that only allows bodies to move along a line, relative to each other.See http://www.iforce2d.net/b2dtut/joints-prismatic Parameters Name Type Argument Default Description bodyA Phaser.Sprite | Phaser.Physics.P2.Body | p2.Body First connected body. bodyB Phaser.Sprite | Phaser.Physics.P2.Body | p2.Body Second connected body. lockRotation boo

Physics.P2#createParticle()

createParticle(x, y, mass, addToWorld, options, points) Creates a new Particle and adds it to the World. Parameters Name Type Argument Default Description x number The x coordinate of Body. y number The y coordinate of Body. mass number The mass of the Body. A mass of 0 means a 'static' Body is created. addToWorld boolean <optional> false Automatically add this Body to the world? (usually false as it won't have any shapes on construction). options object A

Physics.P2#createMaterial()

createMaterial(name, body) → {Phaser.Physics.P2.Material} Creates a Material. Materials are applied to Shapes owned by a Body and can be set with Body.setMaterial().Materials are a way to control what happens when Shapes collide. Combine unique Materials together to create Contact Materials.Contact Materials have properties such as friction and restitution that allow for fine-grained collision control between different Materials. Parameters Name Type Argument Description name string <o

Physics.P2#createLockConstraint()

createLockConstraint(bodyA, bodyB, offset, angle, maxForce) → {Phaser.Physics.P2.LockConstraint} Locks the relative position between two bodies. Parameters Name Type Argument Default Description bodyA Phaser.Sprite | Phaser.Physics.P2.Body | p2.Body First connected body. bodyB Phaser.Sprite | Phaser.Physics.P2.Body | p2.Body Second connected body. offset Array <optional> The offset of bodyB in bodyA's frame. The value is an array with 2 elements matching x and y, i.e:

Physics.P2#createGearConstraint()

createGearConstraint(bodyA, bodyB, angle, ratio) → {Phaser.Physics.P2.GearConstraint} Creates a constraint that tries to keep the distance between two bodies constant. Parameters Name Type Argument Default Description bodyA Phaser.Sprite | Phaser.Physics.P2.Body | p2.Body First connected body. bodyB Phaser.Sprite | Phaser.Physics.P2.Body | p2.Body Second connected body. angle number <optional> 0 The relative angle ratio number <optional> 1 The gear ratio.

Physics.P2#createDistanceConstraint()

createDistanceConstraint(bodyA, bodyB, distance, localAnchorA, localAnchorB, maxForce) → {Phaser.Physics.P2.DistanceConstraint} Creates a constraint that tries to keep the distance between two bodies constant. Parameters Name Type Argument Description bodyA Phaser.Sprite | Phaser.Physics.P2.Body | p2.Body First connected body. bodyB Phaser.Sprite | Phaser.Physics.P2.Body | p2.Body Second connected body. distance number The distance to keep between the bodies. localAnchorA Array

Physics.P2#createContactMaterial()

createContactMaterial(materialA, materialB, options) → {Phaser.Physics.P2.ContactMaterial} Creates a Contact Material from the two given Materials. You can then edit the properties of the Contact Material directly. Parameters Name Type Argument Description materialA Phaser.Physics.P2.Material <optional> The first Material to create the ContactMaterial from. If undefined it will create a new Material object first. materialB Phaser.Physics.P2.Material <optional> The second Ma

Physics.P2#createCollisionGroup()

createCollisionGroup(object) Creates a new Collision Group and optionally applies it to the given object.Collision Groups are handled using bitmasks, therefore you have a fixed limit you can create before you need to re-use older groups. Parameters Name Type Argument Description object Phaser.Group | Phaser.Sprite <optional> 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. Source code: physics/p2/World.j