feat(ai): enemies' paths stop at movement blockers

MovementAIComponent::SetDestination cuts an enemy's path (chasing, tethering,
wandering) where it first walks into a wall its collision group can't cross,
so enemies no longer walk through the Sentinel camp walls, the Crux Prime and
property navmesh carvers, or the enemy blocking volumes. With nothing left to
walk the enemy stays put. Patrols along a level path, and movers without combat
AI, are left alone.

Adds a scenario test: an enemy chasing across an enemy only volume and across a
carver stops in front of it; the clear threat wall is a trigger, not a wall.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Aaron Kimbrell
2026-09-29 17:37:45 -05:00
parent 62f5f13846
commit 6208724e6a
3 changed files with 147 additions and 0 deletions

View File

@@ -462,6 +462,14 @@ void MovementAIComponent::SetDestination(const NiPoint3 destination) {
}
}
// The path is walked without collision, so an enemy's stops at walls it can't cross (navmesh carvers, enemy only
// blockers); with nothing left to walk it stays where it is. A patrol along its level path is left as designed.
const bool patrolling = m_Path && m_BaseCombatAI && m_BaseCombatAI->GetState() == AiState::idle;
if (m_BaseCombatAI && !patrolling) {
computedPath = dpWorld::ClampPath(m_Parent->GetPosition(), std::move(computedPath), static_cast<uint32_t>(m_Parent->GetCollisionGroup()));
if (computedPath.empty()) computedPath.push_back(m_Parent->GetPosition());
}
m_InterpolatedWaypoints.clear();
// Simply path