Skip to content

Add Velocity

Entity Action Type

Adds or sets velocity towards a specific direction and also allows you to modify said velocity using modifiers.

Type ID: apugli:add_velocity

Note

If the entity action type behaves unexpectedly, try setting either the client (should always work) or server (might not work) boolean fields to false. Here are some examples.

Fields

Field Type Default Description
x Float 0.0 The amount of velocity to add on the x-axis.
y Float 0.0 The amount of velocity to add on the y-axis.
z Float 0.0 The amount of velocity to add on the z-axis.
horizontal_modifier Attribute Modifier optional If set, a modifier to apply to the horizontal velocity of this actio prior to adding the velocity of the entity.
horizontal_modifiers Array of Attribute Modifiers optional If set, modifiers to apply to the horizontal velocity of this action prior to adding the velocity of the entity..
vertical_modifier Attribute Modifier optional If set, a modifier to apply to the vertical velocity of this action prior to adding the velocity of the entity.
vertical_modifiers Array of Attribute Modifiers optional If set, modifiers to apply to the vertical velocity of this action prior to adding the velocity of the entity.
horizontal_post_modifier Attribute Modifier optional If set, a modifier to apply to the horizontal velocity of this action after adding the velocity of the entity.
horizontal_post_modifiers Array of Attribute Modifiers optional If set, modifiers to apply to the horizontal velocity of this action after adding the velocity of the entity..
vertical_post_modifier Attribute Modifier optional If set, a modifier to apply to the vertical velocity of this action after adding the velocity of the entity.
vertical_post_modifiers Array of Attribute Modifiers optional If set, modifiers to apply to the vertical velocity of this action after adding the velocity of the entity.
space Space "world" The space to perform the addition/setting of velocity in.
client Boolean true If this is false, the action will not execute on the client.
server Boolean true If this is false, the action will not execute on the server.
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": "origins:add_velocity",
    "z": 2,
    "space": "LOCAL",
    "horizontal_post_modifiers": [
        {
            "operation": "min_total",
            "value": -2.2
        },
        {
            "operation": "max_total",
            "value": 2.2
        }
    ]
}

This example will add velocity to the entity's positive Z axis in the local space, making the entity go towards the direction they are looking. It is also modified to make sure that the entity is capped between -2.2 and 2.2 on the horizontal axes (x, z).