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 constrained to. The value is an array with 2 elements matching x and y, i.e: [32, 32]. | ||
bodyB | Phaser.Sprite | Phaser.Physics.P2.Body | p2.Body | Second connected body. | ||
pivotB | Array | The point relative to the center of mass of bodyB which bodyB is constrained to. The value is an array with 2 elements matching x and y, i.e: [32, 32]. | ||
maxForce | number | <optional> | 0 | The maximum force that should be applied to constrain the bodies. |
worldPivot | Float32Array | <optional> | null | A pivot point given in world coordinates. If specified, localPivotA and localPivotB are automatically computed from this value. |
Returns
The constraint
- Source code: physics/p2/World.js (Line 1033)
Please login to continue.