Add Velocity (Entity Action Type)
Adds or sets velocity towards a specific direction.
Adds or sets velocity towards a specific direction.
Type ID: apoli:add_velocity
Fields
| Field | Type | Default | Description |
|---|---|---|---|
x | Float or Expression | 0.0 | The amount of velocity to add on the x-axis. |
y | Float or Expression | 0.0 | The amount of velocity to add on the y-axis. |
z | Float or Expression | 0.0 | The amount of velocity to add on the z-axis. |
space | Space | "world" | Determines how the direction of the velocity to add/set will be calculated. |
set | Boolean | false | If this is true, the action will act as a “set” velocity action, overriding the entity’s current velocity instead of adding to it. |
Examples
"entity_action": {
"type": "apoli:add_velocity",
"y": 2
} This example will add velocity to the entity’s positive Y axis, essentially launching the entity up in the air.
"entity_action": {
"type": "apoli:add_velocity",
"space": "local",
"z": "health * 0.5"
} This example launches the entity forward with a strength scaled by its current health — 10 blocks/tick of velocity at full health (20 × 0.5), less as it gets hurt. Expressions are evaluated against the entity the velocity is applied to; see Expression for the variable list.