Added PitchTo Function

This commit is contained in:
Boondorl 2022-11-17 19:04:19 -05:00 committed by Christoph Oelckers
parent eb97346b0e
commit ef456a4901

View file

@ -810,6 +810,20 @@ class Actor : Thinker native
native void DoMissileDamage(Actor target);
native void PlayPushSound();
clearscope double PitchTo(Actor target, double zOfs = 0, double targZOfs = 0, bool absolute = false) const
{
Vector3 origin = (pos.xy, pos.z - floorClip + zOfs);
Vector3 dest = (target.pos.xy, target.pos.z - target.floorClip + targZOfs);
Vector3 diff;
if (!absolute)
diff = level.Vec3Diff(origin, dest);
else
diff = dest - origin;
return -atan2(diff.z, diff.xy.Length());
}
//==========================================================================
//
// AActor :: GetLevelSpawnTime