W3cubDocs

/Phaser

Class: Phaser.Physics.P2.PrismaticConstraint

Constructor

new PrismaticConstraint(world, bodyA, bodyB, lockRotation, anchorA, anchorB, axis, maxForce)

Connects two bodies at given offset points, letting them rotate relative to each other around this point.

Parameters
Name Type Argument Default Description
world Phaser.Physics.P2

A reference to the P2 World.

bodyA p2.Body

First connected body.

bodyB p2.Body

Second connected body.

lockRotation boolean <optional>
true

If set to false, bodyB will be free to rotate around its anchor point.

anchorA Array <optional>

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].

anchorB Array <optional>

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].

axis Array <optional>

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].

maxForce number <optional>

The maximum force that should be applied to constrain the bodies.

Source code: physics/p2/PrismaticConstraint.js (Line 21)

Public Properties

game : Phaser.Game

Local reference to game.

Source code: physics/p2/PrismaticConstraint.js (Line 32)

world : Phaser.Physics.P2

Local reference to P2 World.

Source code: physics/p2/PrismaticConstraint.js (Line 37)

© 2016 Richard Davey, Photon Storm Ltd.
Licensed under the MIT License.
http://phaser.io/docs/2.6.2/Phaser.Physics.P2.PrismaticConstraint.html