ZComponent - acrimi/Raven GitHub Wiki

ZComponent defines the position and size of an entity along the z axis. Without this component, entities will function in purely 2D space. It also stores the physics properties for the entity along the z axis such as velocity, acceleration, and external forces being applied.

Configuration

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

Key Type Description
position float The entity's initial position on the z axis. Defaults to 0.
depth float The entity's size in the z axis. Defaults to 0.
dragCoefficient float The coefficient that will be used to calculate the entity's drag due to air resistance when moving on the z axis. Defaults to 0.

Example:

"ZComponent": {
  "position": 16,
  "depth": 16,
  "dragCoefficient": 0.7
}

Properties

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

Key Type Description
position float The entity's current position on the z axis