本文整理汇总了C++中IPhysicsObject::DestroyFrictionSnapshot方法的典型用法代码示例。如果您正苦于以下问题:C++ IPhysicsObject::DestroyFrictionSnapshot方法的具体用法?C++ IPhysicsObject::DestroyFrictionSnapshot怎么用?C++ IPhysicsObject::DestroyFrictionSnapshot使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IPhysicsObject
的用法示例。
在下文中一共展示了IPhysicsObject::DestroyFrictionSnapshot方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CheckTouching
bool CPhysicsNPCSolver::CheckTouching()
{
CAI_BaseNPC *pNPC = m_hNPC.Get();
if ( !pNPC )
return false;
CBaseEntity *pPhysicsEnt = m_hEntity.Get();
if ( !pPhysicsEnt )
return false;
IPhysicsObject *pPhysics = pPhysicsEnt->VPhysicsGetObject();
IPhysicsObject *pNPCPhysics = pNPC->VPhysicsGetObject();
if ( !pNPCPhysics || !pPhysics )
return false;
IPhysicsFrictionSnapshot *pSnapshot = pPhysics->CreateFrictionSnapshot();
bool found = false;
bool penetrate = false;
while ( pSnapshot->IsValid() )
{
IPhysicsObject *pOther = pSnapshot->GetObject(1);
if ( pOther == pNPCPhysics )
{
found = true;
if ( IsContactOnNPCHead(pSnapshot, pPhysics, pNPC ) )
{
penetrate = true;
pSnapshot->MarkContactForDelete();
}
break;
}
pSnapshot->NextFrictionData();
}
pSnapshot->DeleteAllMarkedContacts( true );
pPhysics->DestroyFrictionSnapshot( pSnapshot );
// if the object is penetrating something, check to see if it's intersecting this NPC
// if so, go ahead and switch over to penetration solver mode
if ( !penetrate && (pPhysics->GetGameFlags() & FVPHYSICS_PENETRATING) )
{
penetrate = IsIntersecting();
}
if ( penetrate )
{
pPhysicsEnt->ClearNavIgnore();
BecomePenetrationSolver();
}
return found;
}
示例2: IsTouchingPortal
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
bool CTriggerPortal::IsTouchingPortal( CBaseEntity *pEntity )
{
// First, check the touchlinks. This will find non-vphysics entities touching us
touchlink_t *root = ( touchlink_t * )GetDataObject( TOUCHLINK );
if ( root )
{
for ( touchlink_t *link = root->nextLink; link != root; link = link->nextLink )
{
CBaseEntity *pTouch = link->entityTouched;
if ( pTouch == pEntity )
return true;
}
}
// Then check the friction snapshot. This will find vphysics objects touching us.
IPhysicsObject *pPhysics = VPhysicsGetObject();
if ( !pPhysics )
return false;
IPhysicsFrictionSnapshot *pSnapshot = pPhysics->CreateFrictionSnapshot();
bool bFound = false;
while ( pSnapshot->IsValid() )
{
IPhysicsObject *pOther = pSnapshot->GetObject( 1 );
if ( ((CBaseEntity *)pOther->GetGameData()) == pEntity )
{
bFound = true;
break;
}
pSnapshot->NextFrictionData();
}
pPhysics->DestroyFrictionSnapshot( pSnapshot );
return bFound;
}