Nathan Laing
Member
Greetings,
I have coded a flight formation system. 5 wing men can follow a wing leader around in up to 14 different formations. It works ok, however, there is one problem I am having great difficulty fixing which is best described with the attached image;
When the wing leader turns on an angle, the aircraft on the inside of the arc "bump" or "glitch" around, because they try to get to their formation point which becomes behind them instead of in front of them (when the wing leader turns).
Clearly, to maintain formation, the ships on the inside of the arc need to reduce their speed during a turn, and I am using basic logic with arbitrary values for a slower speed which helps, but it's just not cutting it. I either need "correct' math, or perhaps, I need a way to get them to temporarily ignore their usual flight instructions and maybe smoothly lerp to the new position.
Desperate for any assistance!
I have coded a flight formation system. 5 wing men can follow a wing leader around in up to 14 different formations. It works ok, however, there is one problem I am having great difficulty fixing which is best described with the attached image;
When the wing leader turns on an angle, the aircraft on the inside of the arc "bump" or "glitch" around, because they try to get to their formation point which becomes behind them instead of in front of them (when the wing leader turns).
Clearly, to maintain formation, the ships on the inside of the arc need to reduce their speed during a turn, and I am using basic logic with arbitrary values for a slower speed which helps, but it's just not cutting it. I either need "correct' math, or perhaps, I need a way to get them to temporarily ignore their usual flight instructions and maybe smoothly lerp to the new position.
Desperate for any assistance!
Code:
x += dcos(image_angle) * speed;
y -= dsin(image_angle) * speed;