本文整理汇总了C++中C_TFPlayer::CalcView方法的典型用法代码示例。如果您正苦于以下问题:C++ C_TFPlayer::CalcView方法的具体用法?C++ C_TFPlayer::CalcView怎么用?C++ C_TFPlayer::CalcView使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类C_TFPlayer
的用法示例。
在下文中一共展示了C_TFPlayer::CalcView方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetAngleRotation
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
float CTFArrowPanel::GetAngleRotation( void )
{
float flRetVal = 0.0f;
C_TFPlayer *pPlayer = ToTFPlayer( C_BasePlayer::GetLocalPlayer() );
C_BaseEntity *pEnt = m_hEntity.Get();
if ( pPlayer && pEnt )
{
QAngle vangles;
Vector eyeOrigin;
float zNear, zFar, fov;
pPlayer->CalcView( eyeOrigin, vangles, zNear, zFar, fov );
Vector vecFlag = pEnt->WorldSpaceCenter() - eyeOrigin;
vecFlag.z = 0;
vecFlag.NormalizeInPlace();
Vector forward, right, up;
AngleVectors( vangles, &forward, &right, &up );
forward.z = 0;
right.z = 0;
forward.NormalizeInPlace();
right.NormalizeInPlace();
float dot = DotProduct( vecFlag, forward );
float angleBetween = acos( dot );
dot = DotProduct( vecFlag, right );
if ( dot < 0.0f )
{
angleBetween *= -1;
}
flRetVal = RAD2DEG( angleBetween );
}
return flRetVal;
}