virtual AUVec3f CalculateDesiredPosition( float timeDelta ) { AUVec3f pos = m_pOwner->GetEntity()->GetPosition(); if ( !m_pBBCommon->target_position.IsInfinite() ) { AUVec3f targetVec = m_pBBCommon->target_position - m_pBBCommon->current_position; AUVec3f targetDir = targetVec.GetNormalised(); float dist = std::min( targetVec.Magnitude(), m_pOwner->GetMaxSpeed() * timeDelta ); pos += targetDir * dist; } return pos; }
virtual AUVec3f CalculateDesiredPosition( float timeDelta ) { AUVec3f pos = m_pOwner->GetEntity()->GetPosition(); IGameObject* pGameObject = 0; IObjectUtils::GetObject( &pGameObject, m_pBBCommon->enemy_collision_objectid ); if (pGameObject) { AUVec3f targetVec = pGameObject->GetEntity()->GetPosition() - m_pBBCommon->current_position; AUVec3f targetDir = targetVec.GetNormalised(); float dist = std::min( targetVec.Magnitude(), m_pOwner->GetMaxSpeed() * timeDelta ); pos += targetDir * dist; } return pos; }
virtual AUVec3f CalculateDesiredPosition( float timeDelta ) { AUVec3f pos = m_pOwner->GetEntity()->GetPosition(); AUVec3f targetPos; if (m_pApproachTarget) { targetPos = m_pApproachTarget->GetEntity()->GetPosition(); } else { targetPos = pos + m_PatrolDir * m_pOwner->GetMaxSpeed(); } AUVec3f targetVec = targetPos - pos; AUVec3f targetDir = targetVec.GetNormalised(); float dist = std::min( targetVec.Magnitude(), m_pOwner->GetMaxSpeed() * timeDelta ); pos += targetDir * dist; return pos; }