Quite an interesting conundrum. There is special param “FLY” in createVehicle that spawns vehicle flying. But since there is no way to set direction to a vehicle before it is spawned, the flying vehicle will always face North (direction 0). Trying to set direction after spawn or on any moving vehicle will reset vehicle velocity. I don’t know if this is a bug or intended. In any case you need to set velocity back if you want vehicle to continue moving.

But velocity is a vector, and so it has own direction. If you simply store velocity and restore it after you set new vehicle direction, your plane may end up flying backwards or sideways, pretty funny actually. So what to do? The velocity needs to be adjusted to the new direction, in other words, velocity vector needs to be rotated to face new direction. So I’ve constructed this little function, specifically for turning vehicles after they are spawned with “FLY” param. It takes 2 params, vehicle object and new direction number:

KK_fnc_setDirFLY = { private ["_veh","_dir","_v"]; _veh = _this select 0; _dir = _this select 1; _v = velocity _veh; _veh setDir _dir; _veh setVelocity [ (_v select 1) * sin _dir - (_v select 0) * cos _dir, (_v select 0) * sin _dir + (_v select 1) * cos _dir, _v select 2 ]; };

Try this on an airplane:

_plane = createVehicle ["O_Plane_CAS_02_F", position player, [], 0, "FLY"]; [_plane, -45] call KK_fnc_setDirFLY; createVehicleCrew _plane;

Enjoy,
KK