本文整理汇总了C++中Agent::GetPos方法的典型用法代码示例。如果您正苦于以下问题:C++ Agent::GetPos方法的具体用法?C++ Agent::GetPos怎么用?C++ Agent::GetPos使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Agent
的用法示例。
在下文中一共展示了Agent::GetPos方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Execute
virtual bool Execute(Agent *_Agent)
{
float dist2 = 0;
if(_Agent->Attack)
{
Agent *TargetEnemy = nullptr;
for ( auto EnemyCurrent : _Agent->Enemies)
{
TargetEnemy = EnemyCurrent;
float Len = 0, tLen;
tLen = glm::length(_Agent->GetPos()) - glm::length(EnemyCurrent->GetPos());
if(tLen < 0){tLen *= -1;}
if(tLen > Len){Len = tLen;TargetEnemy = EnemyCurrent;}
}
if(TargetEnemy != nullptr)
dist2 = glm::distance2(_Agent->GetPos(), TargetEnemy->GetPos());
}
else
{
dist2 = glm::distance2(_Agent->GetPos(), _Agent->GetTarget());
}
if (dist2 < Range2)
return true;
return false;
}
示例2: QueueLineOfSightRay
void StalkerModule::QueueLineOfSightRay(Agent& stalker, IAIObject* target, StalkerInstance& instance)
{
PhysSkipList skipList;
stalker.GetPhysicalSkipEntities(skipList);
if (IAIActor* aiActor = target->CastToIAIActor())
aiActor->GetPhysicalSkipEntities(skipList);
instance.rayID = g_pGame->GetRayCaster().Queue(
RayCastRequest::HighPriority,
RayCastRequest(target->GetPos(), stalker.GetPos() - target->GetPos(),
ent_terrain|ent_static|ent_rigid|ent_sleeping_rigid,
((geom_colltype_ray << rwi_colltype_bit) | rwi_colltype_any | (10 & rwi_pierceability_mask)),
&skipList[0], skipList.size()),
functor(*this, &StalkerModule::LineOfSightRayComplete));
}
示例3: CheckCollision
// ===========================================================================
// Process possible collision between an agent and the hazard.
//
// In: The agent.
// Out: The collision result (NULL is invalid!)
//
void HazardDataSphere::CheckCollision(Agent& agent, HazardCollisionResult* result) const
{
assert(result != NULL);
result->Reset();
if (Distance::Point_PointSq(agent.GetPos(), m_Context.m_CenterPos) >
m_RadiusSq)
{
return;
}
result->m_CollisionFlag = true;
result->m_HazardOriginPos = m_Context.m_CenterPos;
return;
}