Understanding the movement data array of BIS_fnc_UnitCapture

! Check out the gif below to understand what I’m talking about :wink: !

Using “BIS_fnc_unitCapture” to record a flight path and “BIS_fnc_unitPlay” to play it back in a (zeus) mission is an easy way to model awesome helicopter insertions or extractions.
There is plenty of information on youtube how to do this. It becomes more difficult, however, when the flight path needs to be paused to wait for players boarding the helicopter. Especially when the vehicle should remain in a hover state.
I was not able to find any information about this, even if it is an important feature so let me summarize what I’ve learned:


  • BIS_fnc_UnitCapture generates an array with as many rows as samples are recorded.
  • Each row has a time stamp followed by 4 vectors describing the vehicle’s position, orientation, velocity (details later).
  • Short: The array describes the flight path
    Pausing the flight path:

I figured that the easiest way to pause the flight path is to split the array at the location where I want the vehicle to stop.
Before the second half of the array (flight path) is played back, I run the last sample of the first section in a while loop until the players boarded the vehicle.
Note that you need at least two rows in the array to allow arma to recognize the sample time (just copy paste the same row and modify the time stamp by adding delta t)

_movementdata = [[t,[vec1],[vec2],[vec3],[vec4]],[t+dt,[vec1],[vec2],[vec3],[vec4]]];

while {my_trigger} do
_sequence = [my_vehicle, _movementdata] spawn BIS_fnc_UnitPlay;
waitUntil {scriptDone _sequence};

This works great, however there is one problem:

When the vehicle is hovering, it tends to jitter. Sometimes to an extent where it runs over a player that is trying to enter the vehicle.


To solve this issue, we need to understand the information that is contained in the array.
To do this, I drove a vehicle up and down the airstrip and analyzed the recorded data. My conclusion is:

vec1 = Global position of vehicle origin on map
vec2 = Unit vector of heading axis
vec3 = Unit vector normal to vehicle plane
vec4 = Velocity in global frame
(There seems to be no rotational velocity nor acceleration)

The trick is now to overwrite the velocity vector in the while loop with [0,0,0] so there is no “drift” that leads to vehicle jitter.
Now, the vehicle is stable and does not run over the boarding player anymore :smiley:

Note: I still get some vehicle jitter when pausing at higher speed. I do not fully understand if this is because vehicle acceleration is not overwritten by the “BIS_fnc_unitPlay” command or if there is maybe some time delay issue?
Anyway, I don’t see a scenario at the moment where a player has to board a fast moving vehicle :slight_smile:

Hope this helps. Check out the gif of my test case to understand what I’m talking about :wink:

This looks great! But the problem is that in the Zeus server is that we don’t allow the use of scripts. We are working in a way so players can load missions from the editor and make use of certain scripts, but that is still in testing and development. Meanwhile, keep up the good job, that looks awesome.