Hi I Need Help.It's about auto facing which will turn the helper to face the direction his going to according to his velocity.I have a missile helper that follows the opponent with no fix velocity since he will follow the opponent.Like when my helper have a velocity of x=9,y=-9, he will face to upright direction.Please help. thanks.
[State ProjEsp ]Type = AngleDrawtrigger1 = 1value = atan((-1* vel Y) / (vel X))*57.2957795scale = 1.0,1.0
Frederika Bernkastel~ said, June 25, 2009, 05:40:31 pm[State ProjEsp ]Type = AngleDrawtrigger1 = 1value = atan((-1* vel Y) / (vel X))*57.2957795scale = 1.0,1.0This will only work if you use positive X velocities because atan is limited to values between Pi/2 (90°) and -Pi/2 (-90°).For negative velocities you have to extend it:[mcode]value = -atan(vel Y/vel X)*57.2957795 + 180*(Vel X < 0)[/mcode]Also keep in mind that you will get warnings if vel X = 0 because of division by zero.