AnchoredSpringGenerator Class
This generator simulates a spring with one end attached to a fixed point in space and the other to an entity.
Constructor
AnchoredSpringGenerator
(
-
anchorPointX
-
anchorPointY
-
restLength
-
stiffness
Parameters:
-
anchorPointX
NumberThe x component of the fixed point.
-
anchorPointY
NumberThe y component of the fixed point.
-
restLength
Number -
stiffness
Number
Item Index
Methods
applyForce
(
-
entity
Parameters:
-
entity
EntityThe entity the spring force should be applied to. It's required that the entity has the Movable and Position components.
getAnchorPoint
(
-
vector
Retrieves the position of the anchor point.
Parameters:
-
vector
Vector2DThe vector to which the anchor point's position will be copied.
getRestLength
()
Number
Returns:
Number:
getStiffness
()
Number
Returns:
Number:
setAnchorPoint
(
-
anchorPointX
-
anchorPointY
Sets a new position for the anchor point.
Parameters:
-
anchorPointX
NumberThe x component of the new anchor point.
-
anchorPointY
NumberThe y component of the new anchor point.
setRestLength
(
-
restLength
Parameters:
-
restLength
Number
setStiffness
(
-
stiffness
Parameters:
-
stiffness
Number