I use the follwoing to get the "correct" direction for the PUSH in relation to how far left or right the attacker is facing the target.
But once in a while the target is thrown TOWARD the attacker and not away. I suspect the AngleZ is getting recorded at a bad time sometimes because the attacker can get spun 180 degrees around while attacking ... er, sometimes.
AngleZ = Attacker.GetAngleZ() + Attacker.GetHeadingAngle(Target)
Attacker.PushActoraway(Target, 0)
Target.ApplyHavokImpulse(Math.Sin(AngleZ), Math.Cos(AngleZ), (Impulse * 0.002), Impulse)
Is there some simple way using math to limit AngleZ and thus limit the push to directions that are "away" from the attacker?
I could use this :
Float X = Attacker.GetHeadingAngle(Target)
if math.abs(X) > 80
AngleZ = Attacker.GetAngleZ()
else
AngleZ = Attacker.GetAngleZ() + X
endif
But I am hoping for something a little better than that.