HomeWildfire Games

Fix units sometimes turning around when fleeing (introduced by D1987/rP22431)

Description

Fix units sometimes turning around when fleeing (introduced by D1987/rP22431)

D1987/rP22431 introduced logic to predict the target movement, which fixed unit chasing. However, sometimes fleeing units would then predict that their target will end up in front of them, so they turned around towards the attacker.

This is fixed by not anticipating the position when it would cause the vector towards to target to change direction.

Reported By: Freagarach

Tested By: Freagarach

Fixes #5541

Differential Revision: https://code.wildfiregames.com/D2275