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 <optional>

The anchor point for bodyA, defined locally in bodyA frame. Defaults to [0,0].

localAnchorB Array <optional>

The anchor point for bodyB, defined locally in bodyB frame. Defaults to [0,0].

maxForce number <optional>

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

Returns
Source code: physics/p2/World.js (Line 979)
doc_phaser
2017-02-14 11:00:57
Comments
Leave a Comment

Please login to continue.