MovementComponent - acrimi/Raven GitHub Wiki

MovementComponent defines an entity's ability to move on its own without external force. In practice, it provides a layer of abstraction to easily move an entity in a given direction in conjuction with the PhysicsComponent.

Configuration

When used inside the components block, the initial state of the component can be configured with the following parameters:

Key Type Description
baseMovementForce float The default force, that will be applied to move the entity. The force is expressed relative to gl units (mass * glUnits/seconds^2). Defaults to 500.
maxSpeed float The absolute maximum speed the entity should move itself. Once reached, no more force will be applied by the movement sytem.

Example:

"MovementComponent": {
  "maxSpeed": 100,
  "baseMovementForce": 30000
}

Properties

The following properties are readable by property accessors (eg render state and persistence definitions):

Key Type Description
isMoving boolean Whether or not a movement force was applied as a result of the component on the last physics update.