All pastes #778878 Raw Edit

Anonymous

public cpp v1 · immutable
·published 2007-11-18 00:26 UTC
rendered paste body
void VectorAngles( const float *forward, float *angles ){	float tmp, yaw, pitch;	if (forward[1] == 0 && forward[0] == 0)	{		yaw = 0;		pitch = 0;	}	else	{		yaw = atan2(forward[1], forward[0]) * 180 / M_PI;		if (yaw < 0)			yaw += 360;		tmp = sqrt(forward[0] * forward[0] + forward[1] * forward[1]);		pitch = atan2(forward[2], tmp) * 180 / M_PI;	}	angles[0] = pitch;	angles[1] = yaw;	angles[2] = 0;}