Spring Class
A spring, connecting two bodies.
Constructor
Spring
(
-
bodyA
-
bodyB
-
[options]
Parameters:
-
bodyA
Body -
bodyB
Body -
[options]
Object optional-
restLength
NumberA number > 0. Default: 1
-
stiffness
NumberA number >= 0. Default: 100
-
damping
NumberA number >= 0. Default: 1
-
worldAnchorA
ArrayWhere to hook the spring to body A, in world coordinates.
-
worldAnchorB
Array -
localAnchorA
ArrayWhere to hook the spring to body A, in local body coordinates.
-
localAnchorB
Array
-
Item Index
Properties
Methods
applyForce
()
Apply the spring force to the connected bodies.
getWorldAnchorA
(
-
result
Get the anchor point on body A, in world coordinates.
Parameters:
-
result
ArrayThe vector to store the result in.
getWorldAnchorB
(
-
result
Get the anchor point on body B, in world coordinates.
Parameters:
-
result
ArrayThe vector to store the result in.
setWorldAnchorA
(
-
worldAnchorA
Set the anchor point on body A, using world coordinates.
Parameters:
-
worldAnchorA
Array
setWorldAnchorB
(
-
worldAnchorB
Set the anchor point on body B, using world coordinates.
Parameters:
-
worldAnchorB
Array
Properties
damping
Number
Damping of the spring.
localAnchorA
Array
Anchor for bodyA in local bodyA coordinates.
localAnchorB
Array
Anchor for bodyB in local bodyB coordinates.
restLength
Number
Rest length of the spring.
stiffness
Number
Stiffness of the spring.