GetTargetPitch
(Redirected from Gettargetpitch)
Jump to navigation
Jump to search
This function acts as an extension to VectorAngle, it returns the relative pitch of a thing with tid2, from a thing with tid1.
function int GetTargetPitch (int tid1, int tid2) { int x, y, z, xy, a; x = GetActorX(tid2) - GetActorX(tid1); y = GetActorY(tid2) - GetActorY(tid1); z = GetActorZ(tid2) - GetActorZ(tid1); a = VectorAngle(x, y); if ((a + 0.125) % 0.5 > 0.25) xy = FixedDiv(y, sin(a)); else xy = FixedDiv(x, cos(a)); return -VectorAngle(xy, z); }