本文整理汇总了C++中CBaseAnimating::GetAbsOrigin方法的典型用法代码示例。如果您正苦于以下问题:C++ CBaseAnimating::GetAbsOrigin方法的具体用法?C++ CBaseAnimating::GetAbsOrigin怎么用?C++ CBaseAnimating::GetAbsOrigin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBaseAnimating
的用法示例。
在下文中一共展示了CBaseAnimating::GetAbsOrigin方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Update
void CRagdollLRURetirement::Update( float frametime ) // EPISODIC VERSION
{
VPROF( "CRagdollLRURetirement::Update" );
// Compress out dead items
int i, next;
int iMaxRagdollCount = m_iMaxRagdolls;
if ( iMaxRagdollCount == -1 )
{
iMaxRagdollCount = g_ragdoll_maxcount.GetInt();
}
// fade them all for the low violence version
if ( g_RagdollLVManager.IsLowViolence() )
{
iMaxRagdollCount = 0;
}
m_iRagdollCount = 0;
m_iSimulatedRagdollCount = 0;
// First, find ragdolls that are good candidates for deletion because they are not
// visible at all, or are in a culled visibility box
for ( i = m_LRU.Head(); i < m_LRU.InvalidIndex(); i = next )
{
next = m_LRU.Next(i);
CBaseAnimating *pRagdoll = m_LRU[i].Get();
if ( pRagdoll )
{
m_iRagdollCount++;
IPhysicsObject *pObject = pRagdoll->VPhysicsGetObject();
if (pObject && !pObject->IsAsleep())
{
m_iSimulatedRagdollCount++;
}
if ( m_LRU.Count() > iMaxRagdollCount )
{
//Found one, we're done.
if ( ShouldRemoveThisRagdoll( m_LRU[i] ) == true )
{
#ifdef CLIENT_DLL
m_LRU[ i ]->SUB_Remove();
#else
m_LRU[ i ]->SUB_StartFadeOut( 0 );
#endif
m_LRU.Remove(i);
return;
}
}
}
else
{
m_LRU.Remove(i);
}
}
//////////////////////////////
/// EPISODIC ALGORITHM ///
//////////////////////////////
// If we get here, it means we couldn't find a suitable ragdoll to remove,
// so just remove the furthest one.
int furthestOne = m_LRU.Head();
float furthestDistSq = 0;
#ifdef CLIENT_DLL
C_BasePlayer *pPlayer = C_BasePlayer::GetLocalPlayer();
#else
CBasePlayer *pPlayer = UTIL_GetLocalPlayer();
#endif
if (pPlayer && m_LRU.Count() > iMaxRagdollCount) // find the furthest one algorithm
{
Vector PlayerOrigin = pPlayer->GetAbsOrigin();
// const CBasePlayer *pPlayer = UTIL_GetLocalPlayer();
for ( i = m_LRU.Head(); i < m_LRU.InvalidIndex(); i = next )
{
CBaseAnimating *pRagdoll = m_LRU[i].Get();
next = m_LRU.Next(i);
IPhysicsObject *pObject = pRagdoll->VPhysicsGetObject();
if ( pRagdoll && (pRagdoll->GetEffectEntity() || ( pObject && !pObject->IsAsleep()) ) )
continue;
if ( pRagdoll )
{
// float distToPlayer = (pPlayer->GetAbsOrigin() - pRagdoll->GetAbsOrigin()).LengthSqr();
float distToPlayer = (PlayerOrigin - pRagdoll->GetAbsOrigin()).LengthSqr();
if (distToPlayer > furthestDistSq)
{
furthestOne = i;
furthestDistSq = distToPlayer;
}
}
else // delete bad rags first.
{
furthestOne = i;
break;
}
//.........这里部分代码省略.........