Skip to main content

Add Velocity (Entity Action Type)

Adds velocity to the entity in a direction, or replaces its velocity with set.

Type ID: apoli:add_velocity

Fields

FieldTypeDefaultDescription
xFloat or Expression0.0Velocity to add on the X axis.
yFloat or Expression0.0Velocity to add on the Y axis.
zFloat or Expression0.0Velocity to add on the Z axis.
spaceSpace"world"How the direction of the velocity is worked out.
setBooleanfalseWith true, the velocity replaces the entity's current velocity instead of adding to it.

Examples

"entity_action": {
    "type": "apoli:add_velocity",
    "y": 2
}

This adds upward velocity, launching the entity into the air.

"entity_action": {
    "type": "apoli:add_velocity",
    "space": "local",
    "z": "health * 0.5"
}

This launches the entity forward with a strength that follows its current health: 10 blocks per tick at full health (20 × 0.5), and less as it gets hurt. Expressions are evaluated against the entity the velocity is applied to. See Expression for the variables.