本文整理汇总了C++中CAI_BaseNPC::WorldAlignMaxs方法的典型用法代码示例。如果您正苦于以下问题:C++ CAI_BaseNPC::WorldAlignMaxs方法的具体用法?C++ CAI_BaseNPC::WorldAlignMaxs怎么用?C++ CAI_BaseNPC::WorldAlignMaxs使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CAI_BaseNPC
的用法示例。
在下文中一共展示了CAI_BaseNPC::WorldAlignMaxs方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: IsIntersecting
bool CPhysicsNPCSolver::IsIntersecting()
{
CAI_BaseNPC *pNPC = m_hNPC.Get();
CBaseEntity *pPhysics = m_hEntity.Get();
if ( pNPC && pPhysics )
{
Ray_t ray;
// bloated bounds to force slight separation
Vector mins = pNPC->WorldAlignMins() - Vector(1,1,1);
Vector maxs = pNPC->WorldAlignMaxs() + Vector(1,1,1);
ray.Init( pNPC->GetAbsOrigin(), pNPC->GetAbsOrigin(), mins, maxs );
trace_t tr;
enginetrace->ClipRayToEntity( ray, pNPC->PhysicsSolidMaskForEntity(), pPhysics, &tr );
if ( tr.startsolid )
return true;
}
return false;
}
示例2: FrameUpdatePostEntityThink
//.........这里部分代码省略.........
record.m_vecAngles = pPlayer->GetLocalAngles();
record.m_vecOrigin = pPlayer->GetLocalOrigin();
record.m_vecMinsPreScaled = pPlayer->CollisionProp()->OBBMinsPreScaled();
record.m_vecMaxsPreScaled = pPlayer->CollisionProp()->OBBMaxsPreScaled();
int layerCount = pPlayer->GetNumAnimOverlays();
for( int layerIndex = 0; layerIndex < layerCount; ++layerIndex )
{
CAnimationLayer *currentLayer = pPlayer->GetAnimOverlay(layerIndex);
if( currentLayer )
{
record.m_layerRecords[layerIndex].m_cycle = currentLayer->m_flCycle;
record.m_layerRecords[layerIndex].m_order = currentLayer->m_nOrder;
record.m_layerRecords[layerIndex].m_sequence = currentLayer->m_nSequence;
record.m_layerRecords[layerIndex].m_weight = currentLayer->m_flWeight;
}
}
record.m_masterSequence = pPlayer->GetSequence();
record.m_masterCycle = pPlayer->GetCycle();
}
// Iterate all active NPCs
CAI_BaseNPC **ppAIs = g_AI_Manager.AccessAIs();
int nAIs = g_AI_Manager.NumAIs();
for ( int i = 0; i < nAIs; i++ )
{
CAI_BaseNPC *pNPC = ppAIs[i];
CUtlFixedLinkedList< LagRecord > *track = &m_EntityTrack[i];
if ( !pNPC )
{
track->RemoveAll();
continue;
}
Assert( track->Count() < 1000 ); // insanity check
// remove tail records that are too old
int tailIndex = track->Tail();
while ( track->IsValidIndex( tailIndex ) )
{
LagRecord &tail = track->Element( tailIndex );
// if tail is within limits, stop
if ( tail.m_flSimulationTime >= flDeadtime )
break;
// remove tail, get new tail
track->Remove( tailIndex );
tailIndex = track->Tail();
}
// check if head has same simulation time
if ( track->Count() > 0 )
{
LagRecord &head = track->Element( track->Head() );
// check if entity changed simulation time since last time updated
if ( &head && head.m_flSimulationTime >= pNPC->GetSimulationTime() )
continue; // don't add new entry for same or older time
// Simulation Time is set when an entity moves or rotates ...
// this error occurs when whatever entity it is that breaks it moves or rotates then, presumably?
}
// add new record to track
LagRecord &record = track->Element( track->AddToHead() );
record.m_fFlags = 0;
if ( pNPC->IsAlive() )
{
record.m_fFlags |= LC_ALIVE;
}
record.m_flSimulationTime = pNPC->GetSimulationTime();
record.m_vecAngles = pNPC->GetLocalAngles();
record.m_vecOrigin = pNPC->GetLocalOrigin();
record.m_vecMaxs = pNPC->WorldAlignMaxs();
record.m_vecMins = pNPC->WorldAlignMins();
int layerCount = pNPC->GetNumAnimOverlays();
for( int layerIndex = 0; layerIndex < layerCount; ++layerIndex )
{
CAnimationLayer *currentLayer = pNPC->GetAnimOverlay(layerIndex);
if( currentLayer )
{
record.m_layerRecords[layerIndex].m_cycle = currentLayer->m_flCycle;
record.m_layerRecords[layerIndex].m_order = currentLayer->m_nOrder;
record.m_layerRecords[layerIndex].m_sequence = currentLayer->m_nSequence;
record.m_layerRecords[layerIndex].m_weight = currentLayer->m_flWeight;
}
}
record.m_masterSequence = pNPC->GetSequence();
record.m_masterCycle = pNPC->GetCycle();
}
//Clear the current player.
m_pCurrentPlayer = NULL;
}
示例3: FinishLagCompensation
//.........这里部分代码省略.........
if( currentLayer )
{
currentLayer->m_flCycle = restore->m_layerRecords[layerIndex].m_cycle;
currentLayer->m_nOrder = restore->m_layerRecords[layerIndex].m_order;
currentLayer->m_nSequence = restore->m_layerRecords[layerIndex].m_sequence;
currentLayer->m_flWeight = restore->m_layerRecords[layerIndex].m_weight;
}
}
}
if ( restoreSimulationTime )
{
pPlayer->SetSimulationTime( restore->m_flSimulationTime );
}
}
// also iterate all monsters
CAI_BaseNPC **ppAIs = g_AI_Manager.AccessAIs();
int nAIs = g_AI_Manager.NumAIs();
for ( int i = 0; i < nAIs; i++ )
{
CAI_BaseNPC *pNPC = ppAIs[i];
if ( !m_RestoreEntity.Get( i ) )
{
// entity wasn't changed by lag compensation
continue;
}
LagRecord *restore = &m_EntityRestoreData[ i ];
LagRecord *change = &m_EntityChangeData[ i ];
bool restoreSimulationTime = false;
if ( restore->m_fFlags & LC_SIZE_CHANGED )
{
restoreSimulationTime = true;
// see if simulation made any changes, if no, then do the restore, otherwise,
// leave new values in
if ( pNPC->WorldAlignMins() == change->m_vecMins &&
pNPC->WorldAlignMaxs() == change->m_vecMaxs )
{
// Restore it
pNPC->SetSize( restore->m_vecMins, restore->m_vecMaxs );
}
}
if ( restore->m_fFlags & LC_ANGLES_CHANGED )
{
restoreSimulationTime = true;
if ( pNPC->GetLocalAngles() == change->m_vecAngles )
{
pNPC->SetLocalAngles( restore->m_vecAngles );
}
}
if ( restore->m_fFlags & LC_ORIGIN_CHANGED )
{
restoreSimulationTime = true;
// Okay, let's see if we can do something reasonable with the change
Vector delta = pNPC->GetLocalOrigin() - change->m_vecOrigin;
// If it moved really far, just leave the player in the new spot!!!
if ( delta.LengthSqr() < LAG_COMPENSATION_TELEPORTED_DISTANCE_SQR )
{
RestoreEntityTo( pNPC, restore->m_vecOrigin + delta );
}
}
if( restore->m_fFlags & LC_ANIMATION_CHANGED )
{
restoreSimulationTime = true;
pNPC->SetSequence(restore->m_masterSequence);
pNPC->SetCycle(restore->m_masterCycle);
int layerCount = pNPC->GetNumAnimOverlays();
for( int layerIndex = 0; layerIndex < layerCount; ++layerIndex )
{
CAnimationLayer *currentLayer = pNPC->GetAnimOverlay(layerIndex);
if( currentLayer )
{
currentLayer->m_flCycle = restore->m_layerRecords[layerIndex].m_cycle;
currentLayer->m_nOrder = restore->m_layerRecords[layerIndex].m_order;
currentLayer->m_nSequence = restore->m_layerRecords[layerIndex].m_sequence;
currentLayer->m_flWeight = restore->m_layerRecords[layerIndex].m_weight;
}
}
}
if ( restoreSimulationTime )
{
pNPC->SetSimulationTime( restore->m_flSimulationTime );
}
}
}