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

Returns
Source code: physics/p2/World.js (Line 1089)
doc_phaser
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.