Code archives/3D Graphics - Misc/Return Entity Angle 0-360

This code has been declared by its author to be Public Domain code.

Download source code

Return Entity Angle 0-360 by Chroma2002
Useful for sending an angle as one byte in a net packet.
;-------------------------------------;
;-=Return Entity Angle from 0 to 360=-;
;-------------------------------------;
Function Angle360(entity)
     Local TempYaw
     TempYaw=EntityYaw(entity)
     If TempYaw<0 Then TempYaw=TempYaw+360
     Return TempYaw
End Function

Comments

_PJ_2009
Kind of a waste assigning the vars, wouldn't it be more efficient just to push onto the stack?

Return (360.0-(EntityYaw(entity)))Mod 360.0



Mikorians2014
This one worked even better:

Function AngTrm#(Ang#)
Return (360.0+(Ang# Mod 360)) Mod 360.0
End Function


Code Archives Forum