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:
Try this on an airplane: