API Docs for:
Show:

GravityGenerator Class

This generator applies a force to the entity that gives it the specified acceleration.

Constructor

GravityGenerator

(
  • gravityX
  • gravityY
)

Parameters:

  • gravityX Number

    The x component of the acceleration vector.

  • gravityY Number

    The y component of the acceleration 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.

getGravityVector

(
  • vector
)

Retrieves the gravity acceleration vector.

Parameters:

  • vector Vector2D

    The vector to which the gravity vector will be copied.

setGravityVector

(
  • gravityX
  • gravityY
)

Sets new values for the gravity acceleration vector.

Parameters:

  • gravityX Number

    The x component of the new acceleration vector.

  • gravityY Number

    The y component of the new acceleration vector.