Difference between revisions of "UTIL AngleMod"

From Valve Developer Community
Jump to: navigation, search
m (link)
m
 
Line 19: Line 19:
 
GetMotor()->SetIdealYaw( UTIL_AngleMod( flCurrentYaw + flDeltaYaw ) );
 
GetMotor()->SetIdealYaw( UTIL_AngleMod( flCurrentYaw + flDeltaYaw ) );
 
</source>
 
</source>
 +
 +
[[Category:Programming]]

Latest revision as of 21:36, 24 May 2012

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 ) );