engine/EngineClientView.c
/*	Adds a delay to the view model (such as a weapon) in the players view.
*/
Adds a delay to the view model (such as a weapon) in the players view.
Adds a delay to the view model ( such as a weapon ) in the players view .
void View_ModelDrift(vec3_t vOrigin,vec3_t vAngles,vec3_t vOldAngles)
{
	int				i;
	float			fScale,fSpeed,fDifference;
	static	vec3_t	svLastFacing;
	vec3_t			vForward,vRight,vUp,
					vDifference;
	Math_AngleVectors(vAngles,vForward,vRight,vUp);
	if(host_frametime != 0.0f)
	{
		Math_VectorSubtract(vForward,svLastFacing,vDifference);
		fSpeed = 3.0f;
		fDifference = Math_Lengthf(vDifference);
		if((fDifference > cViewModelLag.value) && (cViewModelLag.value > 0.0f ))
			fSpeed *= fScale = fDifference/cViewModelLag.value;
		for(i = 0; i < 3; i++)
			svLastFacing[i] += vDifference[i]*(fSpeed*host_frametime);
		Math_VectorNormalize(svLastFacing);
		for(i = 0; i < 3; i++)
		{
			vOrigin[i] += (vDifference[i]*-1.0f)*5.0f;
			vAngles[ROLL] += vDifference[YAW];
		}
	}
}
void View_ModelDrift ( vec3_t vOrigin , vec3_t vAngles , vec3_t vOldAngles ) { int i ; float fScale , fSpeed , fDifference ; static vec3_t svLastFacing ; vec3_t vForward , vRight , vUp , vDifference ; Math_AngleVectors ( vAngles , vForward , vRight , vUp ) ; if ( host_frametime != 0.0f ) { Math_VectorSubtract ( vForward , svLastFacing , vDifference ) ; fSpeed = 3.0f ; fDifference = Math_Lengthf ( vDifference ) ; if ( ( fDifference > cViewModelLag . value ) && ( cViewModelLag . value > 0.0f ) ) fSpeed *= fScale = fDifference / cViewModelLag . value ; for ( i = 0 ; i < 3 ; i ++ ) svLastFacing [ i ] += vDifference [ i ] * ( fSpeed * host_frametime ) ; Math_VectorNormalize ( svLastFacing ) ; for ( i = 0 ; i < 3 ; i ++ ) { vOrigin [ i ] += ( vDifference [ i ] * -1.0f ) * 5.0f ; vAngles [ ROLL ] += vDifference [ YAW ] ; } } }
Adds a delay to the view model (such as a weapon) in the players view.
Adds a delay to the view model ( such as a weapon ) in the players view .
//	r_refdef.viewangles[ROLL] += vDifference[YAW];