---
name: "setVelocityTransformation"
type: command
status: ok
groups: ["Object Manipulation"]
arma3_since: "0.50"
locality: {"argument": "local", "effect": "global", "server_exec": false}
source: https://community.bistudio.com/wiki/setVelocityTransformation
revid: 377448
updated: 2026-01-02T06:47:04Z
---

# setVelocityTransformation

*Command · Object Manipulation · Arma 3 v0.50 · introduced in Arma 2: Operation Arrowhead v1.50*

Locality: arguments **local** · effect **global**

## Description

Interpolates and applies [PositionASL](../topics/Position.md#positionasl), [velocity](../commands/velocity.md), [vectorDir](../commands/vectorDir.md) and [vectorUp](../commands/vectorUp.md) to the given object based on the interval value.

When interval is 0 the "fromXXX" values are used for the beginning of the interpolation. When interval is 1, the "toXXX" values are used for the end of interpolation.
When interval value is in between, interpolated values are used (see diagram below). The interpolation is linear and along straight line between "from" and "to" positions.
If curve is needed, then it should be constructed from multiple straight sections or by dynamically changing value of position params during the interpolation cycle, similar to [Quadratic Curve animation](https://en.wikipedia.org/wiki/B%C3%A9zier_curve#Quadratic_curves) (see [#Example 3](../commands/setVelocityTransformation.md#example-3)).

The [velocity](../commands/velocity.md) param does not do much in SP, but in MP, provided the velocity component is set correctly, it helps the engine to figure out what the next position of the moving object should be on other clients.

The actual approximate interpolation formula for this command is:

```sqf
_vecCurrent = _vecFrom vectorAdd (_vecTo vectorDiff _vecFrom vectorMultiply _interval);
```

> [!NOTE]
> For continuous movement this command should be executed each frame while changing the interval value.
> For example to apply interpolation for 10 seconds one could use the following command to translate 10 seconds into 0..1 interval:
>
> ```sqf
> t1 = time;
> t2 = time + 10;
> ```
>
> Later inside some on frame event...
>
> ```sqf
> _interval = linearConversion [t1, t2, time, 0, 1];
> ```

## Syntax

```sqf
object setVelocityTransformation [fromPosASL, toPosASL, fromVelocity, toVelocity, fromVectorDir, toVectorDir, fromVectorUp, toVectorUp, interval, customCenter]
```

**Parameters:**

- `object`: [Object](../topics/Object.md) - object to be interpolated
- `fromPosASL`: [PositionASL](../topics/Position.md#positionasl) - starting [getPosASL](../commands/getPosASL.md) of the object
- `toPosASL`: [PositionASL](../topics/Position.md#positionasl) - ending [getPosASL](../commands/getPosASL.md) of the object
- `fromVelocity`: [Vector3D](../topics/Vector3D.md) - starting [velocity](../commands/velocity.md) of the object
- `toVelocity`: [Vector3D](../topics/Vector3D.md) - ending [velocity](../commands/velocity.md) of the object
- `fromVectorDir`: [Vector3D](../topics/Vector3D.md) - starting [vectorDir](../commands/vectorDir.md) of the object
- `toVectorDir`: [Vector3D](../topics/Vector3D.md) - ending [vectorDir](../commands/vectorDir.md) of the object
- `fromVectorUp`: [Vector3D](../topics/Vector3D.md) - starting [vectorUp](../commands/vectorUp.md) of the object
- `toVectorUp`: [Vector3D](../topics/Vector3D.md) - ending [vectorUp](../commands/vectorUp.md) of the object
- `interval`: [Number](../topics/Number.md) - interpolation interval (variable value, normally between 0 and 1)
- `customCenter`: [PositionRelative](../topics/Position.md#positionrelative) - (Optional, default placing point of the model (see [getModelInfo](../commands/getModelInfo.md))) custom center [x, y, z] to which transformation would be applied in model coordinates *(since arma3 2.08)*

**Returns:** [Nothing](../topics/Nothing.md)

## Examples

### Example 1

```sqf
_tracker setVelocityTransformation
[
    _currentPos,
    _nextPos,
    _currentVelocity,
    _nextVelocity,
    _currentVectorDir,
    _nextVectorDir,
    _currentVectorUp,
    _nextVectorUp,
    _interval
];
```

### Example 2

Bob on imaginary stairway to heaven:

```sqf
bob = createAgent ["C_man_1", player getRelPos [5, 0], [], 0, "CAN_COLLIDE"];
bob switchMove "ladderCivilUpLoop";
pos1 = getPosASL bob;
pos2 = pos1 vectorAdd [0,0,0.75];
bob addEventHandler ["AnimDone",
{
    pos1 = pos2;
    pos2 = pos2 vectorAdd [0,0,0.75]
}];

onEachFrame
{
    if (!alive bob) then
    {
        onEachFrame {};
        bob switchMove "";
        bob removeAllEventHandlers "AnimDone";
    };
    bob setVelocityTransformation [
        pos1,
        pos2,
        [0,0,0],
        [0,0,0],
        [0,1,0],
        [0,1,0],
        [0,0,1],
        [0,0,1],
        moveTime bob
    ];
};
```

### Example 3

Advanced trickery with curved movement. The curve is controlled with one control point (controlPointASL), just like quadratic Bézier curve:

```sqf
disableSerialization;
player setDir 0;
interval = 0;
_disp = findDisplay 46 createDisplay "RscDisplayEmpty";
_ctrl = _disp ctrlCreate ["RscSlider", -1];
_ctrl ctrlSetPosition [safeZoneX + 0.1, 1, safeZoneW - 0.2, 0.1];
_ctrl ctrlSetActiveColor [1,0,0,1];
_ctrl ctrlCommit 0;
_ctrl sliderSetPosition 0;
_ctrl sliderSetRange [0,1];
_ctrl sliderSetSpeed [0.1,0.5];
_ctrl ctrlAddEventHandler ["SliderPosChanged", {interval = _this select 1}];
ctrlSetFocus _ctrl;
box = "Land_VR_Shape_01_cube_1m_F" createVehicle [0,0,0];
controlPointASL = AGLToASL (player getRelPos [70, -30]) vectorAdd [0, 0, 30];
fromPosASL = AGLToASL (player getRelPos [10, -45]);
toPosASL = AGLToASL (player getRelPos [10, 45]);
fromControlPointOffset = controlPointASL vectorDiff fromPosASL;
toControlPointOffset = toPosASL vectorDiff controlPointASL;
onEachFrame
{
    hintSilent format ["Interval: %1", interval];
    box setVelocityTransformation
    [
        fromPosASL vectorAdd (fromControlPointOffset vectorMultiply interval),
        controlPointASL vectorAdd (toControlPointOffset vectorMultiply interval),
        [0,0,0],
        [0,0,0],
        [0,1,0],
        [1,0,0],
        [0,0,1],
        [0,1,0],
        interval
    ];
};
```

## See also

[velocity](../commands/velocity.md) · [setVelocity](../commands/setVelocity.md) · [velocityModelSpace](../commands/velocityModelSpace.md) · [setVelocityModelSpace](../commands/setVelocityModelSpace.md) · [speed](../commands/speed.md) · [moveTime](../commands/moveTime.md) · [disableBrakes](../commands/disableBrakes.md) · [brakesDisabled](../commands/brakesDisabled.md) · [getModelInfo](../commands/getModelInfo.md)

## Community notes

**ffur2007slx2_5** — 2014-08-04

(A3 1.24) Generally speaking [setVelocityTransformation](../commands/setVelocityTransformation.md) is more likely a combination of [setPosASL](../commands/setPosASL.md), [setVectorDirAndUp](../commands/setVectorDirAndUp.md) (or [BIS_fnc_setPitchBank](../functions/BIS_fnc_setPitchBank.md)) and time multiplier.
It can be used as a position tracker with all necessary information collected, copied and then released within one function. Here’s a simple reproduction on how [setVelocityTransformation](../commands/setVelocityTransformation.md) works in game:

```sqf
private ["_dataOld","_dataNext","_capturedData","_obj","_fps","_startTrackingTime","_stepOld","_stepNext","_tracker","_tempTime"];
_stepOld = 0;
_tempTime = 0;
_stepNext = 1;
while {true} do
{
    _capturedData = _capturedData + [[getPosASL _obj,velocity _obj,vectorDir _obj,vectorUp _obj]];
    sleep _fps;
    _tempTime = _tempTime + _fps;
    if (_tempTime >= _startTrackingTime) then
    {
        _dataOld = _capturedData select _stepOld;
        _dataNext = _capturedData select _stepNext;
        _stepOld = _stepOld + 1;
        _stepNext = if (_stepNext >= (count _capturedData)) then { _stepOld } else { _stepNext + 1 };
        _tracker setVelocityTransformation [
            _dataOld select 0,
            _dataNext select 0,
            _dataOld select 1,
            _dataNext select 1,
            _dataOld select 2,
            _dataNext select 2,
            _dataOld select 3,
            _dataNext select 3,
            1
        ];
    };
};
```

Tracker starts coping the route and stance from the object when time start counting. TimeDiff determines the distance multiply between the current position and the next position.

---

**DrSova** — 2020-07-04

You can't apply this command to the dead body in ragdoll.

<sub>Source: [BI Community Wiki — setVelocityTransformation](https://community.bistudio.com/wiki/setVelocityTransformation) (revision 377448).</sub>
