mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-29 07:12:36 +00:00
Added PitchTo Function
This commit is contained in:
parent
eb97346b0e
commit
ef456a4901
1 changed files with 14 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue