API Docs for:
Show:

SpringGenerator Class

This generator simulates a spring with both ends attached to entities.

Constructor

SpringGenerator

(
  • entity
  • restLength
  • stiffness
)

Parameters:

  • entity Entity

    This entity should have the Position and Movable components.

  • restLength Number
  • stiffness Number

Methods

applyForce

(
  • entity
)

Parameters:

  • entity Entity

    The other entity the spring force should be applied to. This entity should have the Position and Movable components.

getEntity

() Entity

Returns:

getRestLength

() Number

Returns:

Number:

getStiffness

() Number

Returns:

Number:

setEntity

(
  • entity
)

Parameters:

  • entity Entity

    This entity should have the Position and Movable components.

setRestLength

(
  • restLength
)

Parameters:

  • restLength Number

setStiffness

(
  • stiffness
)

Parameters:

  • stiffness Number