本文整理汇总了C++中C_BaseAnimating::LookupAttachment方法的典型用法代码示例。如果您正苦于以下问题:C++ C_BaseAnimating::LookupAttachment方法的具体用法?C++ C_BaseAnimating::LookupAttachment怎么用?C++ C_BaseAnimating::LookupAttachment使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类C_BaseAnimating
的用法示例。
在下文中一共展示了C_BaseAnimating::LookupAttachment方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Vector
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void C_HL2MP_Player::CalculateIKLocks( float currentTime )
{
if (!m_pIk)
return;
int targetCount = m_pIk->m_target.Count();
if ( targetCount == 0 )
return;
// In TF, we might be attaching a player's view to a walking model that's using IK. If we are, it can
// get in here during the view setup code, and it's not normally supposed to be able to access the spatial
// partition that early in the rendering loop. So we allow access right here for that special case.
SpatialPartitionListMask_t curSuppressed = partition->GetSuppressedLists();
partition->SuppressLists( PARTITION_ALL_CLIENT_EDICTS, false );
CBaseEntity::PushEnableAbsRecomputations( false );
for (int i = 0; i < targetCount; i++)
{
trace_t trace;
CIKTarget *pTarget = &m_pIk->m_target[i];
if (!pTarget->IsActive())
continue;
switch( pTarget->type)
{
case IK_GROUND:
{
pTarget->SetPos( Vector( pTarget->est.pos.x, pTarget->est.pos.y, GetRenderOrigin().z ));
pTarget->SetAngles( GetRenderAngles() );
}
break;
case IK_ATTACHMENT:
{
C_BaseEntity *pEntity = NULL;
float flDist = pTarget->est.radius;
// FIXME: make entity finding sticky!
// FIXME: what should the radius check be?
for ( CEntitySphereQuery sphere( pTarget->est.pos, 64 ); ( pEntity = sphere.GetCurrentEntity() ) != NULL; sphere.NextEntity() )
{
C_BaseAnimating *pAnim = pEntity->GetBaseAnimating( );
if (!pAnim)
continue;
int iAttachment = pAnim->LookupAttachment( pTarget->offset.pAttachmentName );
if (iAttachment <= 0)
continue;
Vector origin;
QAngle angles;
pAnim->GetAttachment( iAttachment, origin, angles );
// debugoverlay->AddBoxOverlay( origin, Vector( -1, -1, -1 ), Vector( 1, 1, 1 ), QAngle( 0, 0, 0 ), 255, 0, 0, 0, 0 );
float d = (pTarget->est.pos - origin).Length();
if ( d >= flDist)
continue;
flDist = d;
pTarget->SetPos( origin );
pTarget->SetAngles( angles );
// debugoverlay->AddBoxOverlay( pTarget->est.pos, Vector( -pTarget->est.radius, -pTarget->est.radius, -pTarget->est.radius ), Vector( pTarget->est.radius, pTarget->est.radius, pTarget->est.radius), QAngle( 0, 0, 0 ), 0, 255, 0, 0, 0 );
}
if (flDist >= pTarget->est.radius)
{
// debugoverlay->AddBoxOverlay( pTarget->est.pos, Vector( -pTarget->est.radius, -pTarget->est.radius, -pTarget->est.radius ), Vector( pTarget->est.radius, pTarget->est.radius, pTarget->est.radius), QAngle( 0, 0, 0 ), 0, 0, 255, 0, 0 );
// no solution, disable ik rule
pTarget->IKFailed( );
}
}
break;
}
}
CBaseEntity::PopEnableAbsRecomputations();
partition->SuppressLists( curSuppressed, true );
}