Skip to content

Apply Velocity

Apply Velocity

Applies an instantaneous velocity impulse to a physics object in the specified X, Y, and Z directions.

Properties

System

Name Explanation Type
Target The physics object to target with this command. Physics Object Reference
X The X component of the velocity to apply. Variable or Value
Y The Y component of the velocity to apply. Variable or Value
Z The Z component of the velocity to apply. Variable or Value

Examples

Apply Upward Velocity to an Entity

Applies an upward velocity impulse of 5 units to entity 0 along the Y axis.

apply_velocity(entity(0), 0, 5, 0);
{"Data":{"X":{"IsGlobalVariable":false,"IsLocalVariable":false,"IsValue":true,"Value":"0","VariableIndex":0,"Metadata":null},"Y":{"IsGlobalVariable":false,"IsLocalVariable":false,"IsValue":true,"Value":"5","VariableIndex":0,"Metadata":null},"Z":{"IsGlobalVariable":false,"IsLocalVariable":false,"IsValue":true,"Value":"0","VariableIndex":0,"Metadata":null},"Target":{"IsSelf":false,"IsPartyMember":false,"IsEntity":true,"IsUniqueID":false,"IsDoodad":false,"Identifier":{"IsGlobalVariable":false,"IsLocalVariable":false,"IsValue":true,"Value":"0","VariableIndex":0,"Metadata":null}},"Metadata":null},"TypeName":"MAR.Game.RPGCore.Models.Scripts.Commands.ApplyVelocityCommand"}

Apply Velocity from Variables

Applies a velocity impulse to entity 0 using values from global variables for each axis.

apply_velocity(entity(0), $gv[0], $gv[1], $gv[2]);
{"Data":{"X":{"IsGlobalVariable":true,"IsLocalVariable":false,"IsValue":false,"Value":"0","VariableIndex":0,"Metadata":null},"Y":{"IsGlobalVariable":true,"IsLocalVariable":false,"IsValue":false,"Value":"0","VariableIndex":1,"Metadata":null},"Z":{"IsGlobalVariable":true,"IsLocalVariable":false,"IsValue":false,"Value":"0","VariableIndex":2,"Metadata":null},"Target":{"IsSelf":false,"IsPartyMember":false,"IsEntity":true,"IsUniqueID":false,"IsDoodad":false,"Identifier":{"IsGlobalVariable":false,"IsLocalVariable":false,"IsValue":true,"Value":"0","VariableIndex":0,"Metadata":null}},"Metadata":null},"TypeName":"MAR.Game.RPGCore.Models.Scripts.Commands.ApplyVelocityCommand"}

Apply Velocity to a Doodad

Applies a forward velocity impulse of 3 units to doodad 0 along the Z axis.

apply_velocity(doodad(0), 0, 0, 3);
{"Data":{"X":{"IsGlobalVariable":false,"IsLocalVariable":false,"IsValue":true,"Value":"0","VariableIndex":0,"Metadata":null},"Y":{"IsGlobalVariable":false,"IsLocalVariable":false,"IsValue":true,"Value":"0","VariableIndex":0,"Metadata":null},"Z":{"IsGlobalVariable":false,"IsLocalVariable":false,"IsValue":true,"Value":"3","VariableIndex":0,"Metadata":null},"Target":{"IsSelf":false,"IsPartyMember":false,"IsEntity":false,"IsUniqueID":false,"IsDoodad":true,"Identifier":{"IsGlobalVariable":false,"IsLocalVariable":false,"IsValue":true,"Value":"0","VariableIndex":0,"Metadata":null}},"Metadata":null},"TypeName":"MAR.Game.RPGCore.Models.Scripts.Commands.ApplyVelocityCommand"}