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 of bodies at which the spring is at rest. If not given, it's set to the current relative angle between the bodies.

stiffness number <optional>
100

Stiffness of the spring. A number >= 0.

damping number <optional>
1

Damping of the spring. A number >= 0.

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

Please login to continue.