API Docs for:
Show:

GroundedMovement Class

A component class which allows an entity to move horizontally while on the ground or in the air.

Constructor

GroundedMovement

(
  • groundMovementImpulseMagnitude
  • airMovementImpulseMagnitude
  • groundSpeedLimit
  • airSpeedLimit
  • onGroundTime
  • idleFriction
)

Parameters:

  • groundMovementImpulseMagnitude Number

    The magnitude of an impulse that will be applied to move an entity while it's on the ground.

  • airMovementImpulseMagnitude Number

    The magnitude of an impulse that will be applied to move an entity while it's in the air.

  • groundSpeedLimit Number

    Maximum velocity on the x axis that the entity can achieve while on the ground.

  • airSpeedLimit Number

    Maximum velocity on the x axis that the entity can achieve while in the air.

  • onGroundTime Number

    This is the time, in seconds, that the entity remains on ground after it physically is no longer touching the ground. This, for example, gives a time window for an entity to jump after it left the ground by running off of a platform.

  • idleFriction Number

    Each entity that has this component will have its friction set to 0 to ensure smooth movement. Entity's friction will be set to this value when its trying to stop while on the ground or while it's standing idly.

Methods

getAirMovementImpulseMagnitude

() Number

Returns:

Number:

getAirSpeedLimit

() Number

Returns:

Number:

getGroundMovementImpulseMagnitude

() Number

Returns:

Number:

getGroundRightTangent

(
  • vector
)

Returns a normalized vector that goes along the ground surface this entity was last standing on, pointing to the right.

Parameters:

  • vector Vector2D

    Vector to which the tangent will be copied.

getGroundSpeedLimit

() Number

Returns:

Number:

getIdleFriction

() Number

Returns:

Number:

getOnGroundTime

() Number

Returns:

Number:

isOnGround

() Number

Returns:

Number:

setAirMovementImpulseMagnitude

(
  • airMovementImpulseMagnitude
)

Parameters:

  • airMovementImpulseMagnitude Number

    The magnitude of an impulse that will be applied to move an entity while it's in the air.

setAirSpeedLimit

(
  • airSpeedLimit
)

Parameters:

  • airSpeedLimit Number

    Maximum velocity on the x axis that the entity can achieve while in the air.

setGroundMovementImpulseMagnitude

(
  • groundMovementImpulseMagnitude
)

Parameters:

  • groundMovementImpulseMagnitude Number

    The magnitude of an impulse that will be applied to move an entity while it's on the ground.

setGroundSpeedLimit

(
  • groundSpeedLimit
)

Parameters:

  • groundSpeedLimit Number

    Maximum velocity on the x axis that the entity can achieve while on the ground.

setIdleFriction

(
  • idleFriction
)

Parameters:

  • idleFriction Number

    Each entity that has this component will have its friction set to 0 to ensure smooth movement. Entity's friction will be set to this value when its trying to stop while on the ground or while it's standing idly.

setOnGroundTime

(
  • onGroundTime
)

Parameters:

  • onGroundTime Number

    This is the time, in seconds, that the entity remains on ground after it physically is no longer touching the ground. This, for example, gives a time window for an entity to jump after it left the ground by running off of a platform.