Spring Class
A spring, connecting two bodies.
Constructor
Spring
(
-
bodyA
-
bodyB
-
[options]
Parameters:
-
bodyA
Body -
bodyB
Body -
[options]
Object optional-
[restLength]
Number optionalA number > 0. Default: 1
-
[stiffness]
Number optionalA number >= 0. Default: 100
-
[damping]
Number optionalA number >= 0. Default: 1
-
[worldAnchorA]
Vec3 optionalWhere to hook the spring to body A, in world coordinates.
-
[worldAnchorB]
Vec3 optional -
[localAnchorA]
Vec3 optionalWhere to hook the spring to body A, in local body coordinates.
-
[localAnchorB]
Vec3 optional
-
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
Vec3The vector to store the result in.
getWorldAnchorB
(
-
result
Get the anchor point on body B, in world coordinates.
Parameters:
-
result
Vec3The vector to store the result in.
setWorldAnchorA
(
-
worldAnchorA
Set the anchor point on body A, using world coordinates.
Parameters:
-
worldAnchorA
Vec3
setWorldAnchorB
(
-
worldAnchorB
Set the anchor point on body B, using world coordinates.
Parameters:
-
worldAnchorB
Vec3
Properties
damping
Number
Damping of the spring.
restLength
Number
Rest length of the spring.
stiffness
Number
Stiffness of the spring.