API Docs for:
Show:

ForceGenerator Class

A generic force generator. It applies the specified force directly to the entity.

Constructor

ForceGenerator

(
  • forceX
  • forceY
)

Parameters:

  • forceX Number

    The x component of the force vector.

  • forceY Number

    The y component of the force vector.

Methods

applyForce

(
  • entity
)

Parameters:

  • entity Entity

    The entity this force should be applied to. It's required that the entity has the Movable component.

getForceVector

(
  • vector
)

Retrieves the force vector.

Parameters:

  • vector Vector2D

    The vector to which the force vector will be copied.

setForceVector

(
  • forceX
  • forceY
)

Sets new values for the force vector.

Parameters:

  • forceX Number

    The x component of the new force vector.

  • forceY Number

    The y component of the new force vector.