UTIL AngleMod: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(Created page with 'UTIL_AngleMod is a UTIL provided in the source code for normalizing a floating point angle, so that any returned angle is between 0 and 359.999. Function is mostly just a complic…')
 
No edit summary
Line 1: Line 1:
UTIL_AngleMod is a UTIL provided in the source code for normalizing a floating point angle, so that any returned angle is between 0 and 359.999. Function is mostly just a complicated way of writing  
UTIL_AngleMod is a UTIL provided in the source code for normalizing a floating point angle, so that any returned angle is between 0 and 359.999. Function is mostly just a complicated way of writing  
<source>
<source lang=cpp>
return angle % 360.0;
return angle % 360.0;
</source>
</source>

Revision as of 17:41, 9 April 2011

UTIL_AngleMod is a UTIL provided in the source code for normalizing a floating point angle, so that any returned angle is between 0 and 359.999. Function is mostly just a complicated way of writing

return angle % 360.0;

Usage

//-----------------------------------------------------------------------------
// Purpose: Returns a floating point normalized angle between 0 and 359.999
// Input  : Angle that might need to be normalized
// Output : float - A normalized angle value
//-----------------------------------------------------------------------------
inline float UTIL_AngleMod( float a )

Examples

GetMotor()->SetIdealYaw( UTIL_AngleMod( flCurrentYaw + flDeltaYaw ) );