Smooth Obstacle Avoidance in Unreal Engine
Smooth obstacle avoidance refers to the steering techniques that allow AI agents to navigate around each other and dynamic obstacles in real time without jittery movement or unrealistic collisions. While Pathfinding (NavMesh) handles long-distance routing around static geometry, Avoidance handles immediate, frame-by-frame adjustments to prevent agents from bumping into moving entities.
Unreal Engine provides two primary built-in systems for this:
- RVO (Reciprocal Velocity Obstacles): A lightweight, velocity-based system built into the Character Movement Component.
- Detour Crowd: A sophisticated simulation that considers NavMesh topology and manages large groups through a specialized AI Controller.
RVO Avoidance Setup (Character Movement Component)
RVO is the simplest method to implement, as it is built directly into the UCharacterMovementComponent. It is ideal for basic AI that needs to “nudge” away from others.
Steps to Enable RVO:
- Use a Character Actor: Ensure your AI uses a
CharacterMovementComponent. - Toggle “Use RVO Avoidance”: In the Character Blueprint, select the Movement Component and check Use RVO Avoidance.
- Configure Parameters:
- Avoidance Consideration Radius: How far the AI “looks” for obstacles. A common value is 300–500 units for human-sized NPCs.
- Avoidance Weight: How strongly the AI steers to avoid others (Default: 0.5). Higher values make the AI more cautious.
- Avoidance Groups: Use bitmasks to define which AI groups should avoid or ignore each other (e.g., NPCs avoid each other but ignore small decorative animals).
Note: RVO runs on the server. Avoid enabling it for player-controlled characters, as the auto-steering can make manual control feel “weird” or unresponsive.
Best RVO Settings for Smooth Movement
Achieving “natural” movement requires balancing the radius and weight:
- Radius Tuning: If too small, AI will collide before reacting; if too large, they will take unnecessarily wide turns. Set it to roughly 2–3 times the character’s capsule radius.
- Weight Tuning: The default 0.5 is a balanced baseline. If AI overlap too much, increase to 0.6–0.8. If they stop or stutter in crowds, decrease to 0.3–0.4.
- Destination Acceptance: Smoothness often improves by increasing the Acceptance Radius in MoveTo commands, preventing multiple AI from “fighting” to stand on the exact same pixel.
Enabling and Configuring Detour Crowd
The Detour Crowd system is more advanced and prevents agents from being pushed off the NavMesh. It is better suited for dense crowds and complex environments.
Steps to Enable Detour Crowd:
- Assign DetourCrowdAIController: In the Pawn’s details, change the AI Controller Class to
DetourCrowdAIController. - Disable RVO: CRITICAL: Uncheck “Use RVO Avoidance” on the Character Movement Component. Using both simultaneously causes jitter and logic conflicts.
- NavMesh Requirements: Ensure a NavMeshBoundsVolume is present and built. Detour relies on NavMesh topology to ensure agents don’t dodge into “unwalkable” areas.
Crowd Manager Global Settings
In Project Settings > Engine > Navigation System, you can tune the global Crowd Manager:
- Max Agents: The limit of AI participating in the simulation (Default: 50). Increase this if your game features larger crowds.
- Separation Behavior: Adds a repulsive force to keep agents from bunching too tightly.
- Max Avoided Agents/Walls: Controls how many nearby neighbors and obstacles each agent considers (Default: 6 agents, 8 walls).
Detour Crowd AIController and Components
The core of the Detour system is the UCrowdFollowingComponent.
- Custom Controllers: If you have a custom AI Controller, you must ensure it uses the
UCrowdFollowingComponentinstead of the standardUPathFollowingComponent. In C++, this is done by setting theDefaultSubobjectClassin the constructor. - Movement Logic: To ensure avoidance works, use the standard MoveTo system. Manually setting an AI’s velocity every frame can override the crowd system’s steering adjustments.
Summary Comparison
| Feature | RVO Avoidance | Detour Crowd |
| Setup Complexity | Very Low (Checkbox) | Moderate (Controller Change) |
| Smoothness | Moderate (Local Velocity) | High (Path Sampling) |
| NavMesh Awareness | No (Can push off edges) | Yes (Respects boundaries) |
| Performance | Very Lightweight | Higher CPU usage |
| Best Use Case | Simple NPCs, few agents | Dense crowds, high-quality movement |
If all else fails or for specialized movement (like vehicles or non-standard movement), you might implement custom obstacle avoidance via raycasts and steering behaviors, which is our next topic.
Custom Obstacle Avoidance Using Traces and Steering
When built-in systems like RVO or Detour Crowd do not meet specific needs—such as for flying units, specialized vehicles, or unique movement styles—developers can implement custom avoidance. This involves using sensing techniques (traces) and mathematical steering logic to adjust an AI’s path.
Key Components of a Custom Avoidance System
- Sensing Obstacles:
- Line/Sphere Traces: Perform raycasts or shape sweeps in front of the AI to detect impending collisions with walls or other actors.
- Multi-Trace Arrays: Use a “fan” of traces (center, left, and right) to gauge where open space is available.
- Proximity Sensors: Use overlap spheres or collision volumes to detect objects in the immediate vicinity.
- Decision Making (Steering Logic):
- Seek: The standard behavior of moving toward a target.
- Flee/Avoid: Calculating a vector that steers the agent away from a detected hit point.
- Side-stepping: If a left trace hits an obstacle, apply a rightward force or movement input.
- Separation: Applying a repulsive force when agents get too close to one another to prevent overlapping.
Implementation Strategies
- Blueprints and C++:
- In the Tick event or a Behavior Tree Task, perform traces and use
Add Movement Inputto nudge the character laterally. - For physics-based actors, manually adjust the velocity vector based on trace results.
- Use the Environment Query System (EQS) to find unobstructed points near the AI and temporarily move there to bypass an obstacle.
- In the Tick event or a Behavior Tree Task, perform traces and use
- Hybrid Approaches: Use the NavMesh for high-level pathfinding but override the movement with custom steering when a dynamic obstacle (not on the NavMesh) is detected.
Common Blueprint Pitfalls for AI Movement
Even with powerful tools, small configuration errors in Blueprints can lead to jittery or broken AI navigation.
Technical Pitfalls to Avoid
- Conflicting Movement Logic: Manually setting actor location or velocity every frame via
SetActorLocationprevents RVO and Detour Crowd from functioning. Always preferAdd Movement InputorMoveTocommands. - Low Rotation Rates: If the Rotation Rate in the
CharacterMovementComponentis too low, the AI may “slide” sideways because it cannot turn fast enough to face its new avoidance velocity. - Acceptance Radius Issues: Setting a
MoveToAcceptance Radius too low (e.g., 0) causes AI to “jitter” or dance around a destination they can never perfectly reach, especially if crowded by other agents. - System Conflicts: Enabling both RVO and Detour Crowd on the same agent creates a “tug-of-war” between algorithms, resulting in erratic, shaky movement.
- Network Jitter: Enabling RVO on player-controlled characters in a multiplayer game often causes prediction errors and rubberbanding. Avoidance should generally be reserved for server-side NPCs.
Performance and Design Pitfalls
- Heavy Tick Logic: Running complex multi-trace calculations on dozens of AI agents every frame in Blueprint can tank the frame rate. Optimize by tracing every few frames or using C++.
- Incorrect Controller Assignment: Forgetting to set the AI Controller Class to
DetourCrowdAIControllerin the Character’s Class Defaults is a common reason why advanced avoidance fails to trigger. - SimpleMoveTo Node: Avoid using
Simple Move to Locationfor complex AI; it lacks the full integration required for robust obstacle avoidance. Use theAI MoveTonode instead.
By avoiding these pitfalls and following best practices in Blueprint (using the right nodes, not conflicting with the system, tuning parameters), you can achieve very smooth obstacle avoidance. In essence, let the AI system handle as much as possible, only intervene through provided interfaces (like MoveTo, or toggling avoidance when needed) rather than brute forcing movement, and always test under the actual game conditions (multiple AI, frame rate, etc).
Finally, always iterate: observe the AI in game, and adjust. Achieving truly smooth crowd movement can require fine tuning of a lot of small details, but Unreal gives you the tools and flexibility to get there – combining NavMesh pathfinding, RVO/Detour algorithms, and your own logic where necessary.
Now that we’ve covered all the technical details and best practices, let’s consolidate some of the frequently asked questions regarding smooth obstacle avoidance in Unreal Engine and provide concise answers.
Frequently Asked Question (FAQs)
- What’s the difference between RVO avoidance and Detour Crowd in Unreal Engine?
- RVO (Reciprocal Velocity Obstacles): A lightweight system built into the
CharacterMovementcomponent. It adjusts velocity locally to prevent collisions but ignores NavMesh boundaries, which can result in AI pushing others into non-navigable areas. - Detour Crowd: A sophisticated system tied to the NavMesh via the
DetourCrowdAIController. it uses velocity sampling and path corridor adjustments to keep AI on the NavMesh, providing smoother and more natural crowd movement.
- RVO (Reciprocal Velocity Obstacles): A lightweight system built into the
- How do I enable obstacle avoidance for my AI characters?
- For RVO: Open the AI character’s Blueprint, select the
CharacterMovementcomponent, and check Use RVO Avoidance. Set the Avoidance Consideration Radius and Avoidance Weight (default is ~0.5). - For Detour Crowd: Change the AI’s AI Controller Class to
DetourCrowdAIControllerand ensure Use RVO Avoidance is disabled on the movement component to avoid logic conflicts.
- For RVO: Open the AI character’s Blueprint, select the
- My AI still bump into each other – what can I do to improve avoidance?
- Verify Groups: Ensure all agents belong to mutual avoidance groups.
- Adjust RVO: Increase the Avoidance Radius so agents react earlier and check that the Avoidance Weight is at least 0.5.
- Adjust Detour: Enable Separation in the crowd settings and increase the SeparationWeight.
- Goal Logic: Set a larger Acceptance Radius for
MoveTocommands so multiple AI do not fight to occupy the exact same destination point.
- Why are my AI sometimes getting stuck on each other or pushing each other out of the NavMesh?
This is a common limitation of RVO because it does not respect NavMesh edges. To resolve this:- Switch to Detour Crowd, which is designed to keep agents within navigable boundaries.
- If using RVO, increase the NavMesh coverage or the avoidance radii.
- Address the “standing on my goal” problem by using behavioral logic to make blocking AI move aside or by increasing goal acceptance tolerances.
- How can I make AI avoid the player character?
- NavMesh Method: Set the player’s
CapsuleComponentCanEverAffectNavigation to true. With a dynamic NavMesh, AI will treat the player as an obstacle and path around them. - Avoidance Groups: Put the player in a unique avoidance group that the AI is set to avoid.
- C++ Method: For Detour Crowd, implement the
ICrowdAgentInterfaceon the player to register them as an agent in the crowd simulation.
- NavMesh Method: Set the player’s
- Is it possible to have only certain AI avoid each other and ignore others?
Yes, using Avoidance Groups and GroupsToAvoid/Ignore masks:- Assign specific bitmask flags (e.g., Group 1 for “Soldiers,” Group 2 for “Civilians”).
- Configure the GroupsToAvoid list to determine which factions an agent steers away from.
- GroupsToIgnore will override avoidance even if a collision is imminent, which is useful for specialized gameplay behaviors.
- How do I debug what the AI’s avoidance is doing?
- Visual Debugger: Press ‘ (apostrophe) during gameplay to toggle the AI debug overlay.
- Visual Logger (VisLog): Use this to record and review AI paths, nearby obstacles, and steering vectors.
- Console Commands: Use
show Navigationto visualize the NavMesh and dynamic obstacles in real-time. - Log Proxy: Use Blueprint
Print Stringnodes triggered by capsule overlaps to detect when avoidance has failed.
- Should I use RVO or Detour Crowd for my game’s AI?
- Use RVO: For a small number of agents (2–3) where performance is the absolute priority and NavMesh precision is less critical.
- Use Detour Crowd: For 10+ agents or any scenario requiring high-quality, “human-like” flow where agents must stay strictly on the NavMesh.
- Custom Logic: For non-humanoid agents (e.g., flying drones) that do not use the standard ground-based NavMesh.
- Can I change avoidance settings during gameplay? Yes, many parameters are accessible via Blueprints at runtime:
- Toggle State: Call
SetAvoidanceEnabledto turn avoidance on or off (e.g., when a player possesses an NPC). - Dynamic Adjustments: You can change the Avoidance Consideration Radius or Weight on the fly—for example, increasing the radius when an AI starts sprinting.
- Console Tweaks: Certain global Detour settings can be adjusted using console commands like
ai.crowd.SeparationWeight.
- Toggle State: Call
- Does obstacle avoidance work with moving obstacles or only static ones?
Built-in avoidance is primarily for agent-to-agent interactions.- Static Obstacles: Handled by the NavMesh pathfinding.
- Moving Non-AI Obstacles: To make AI avoid objects like a rolling boulder or moving platform, the object must be a Dynamic Obstacle (using “Can Ever Affect Navigation”) to update the NavMesh in real-time, or you must implement custom sensor-based avoidance logic.
Now that we’ve answered these common questions, let’s wrap up with some key takeaways and final thoughts on smooth obstacle avoidance in Unreal Engine.
Conclusion
Smooth obstacle avoidance in Unreal Engine is achievable by combining the power of the Navigation Mesh with the right avoidance system and careful tuning. We explored two main built-in approaches: RVO avoidance (simple and quick, but limited) and Detour Crowd (more advanced and smoother for complex scenarios). For small numbers of AI or simple needs, RVO can prevent basic collisions with minimal setup. However, for dense crowds or more natural movement, Detour Crowd clearly offers superior results – keeping AI on the NavMesh, avoiding jittery pushes, and providing many configurable parameters to fine-tune behavior.
When default systems fall short (for example, flying bots or special gameplay behaviors), you can implement custom avoidance with traces and steering behaviors, but that should supplement rather than replace the proven navmesh-based solutions for most ground AI. Often a hybrid approach yields the best result: let the NavMesh and avoidance handle routine movement, and use a bit of custom logic for the edge cases (like a temporary dodge or formation alignment).
Finally, iteration and testing are key. Visualize the navmesh, use debug tools to watch your AI think and move, and tweak parameters gradually. Small changes in radius or weight can have big impacts on crowd dynamics. With patience and the guidelines from this article, you can tune your AI to move convincingly – characters that navigate to their goals while elegantly sidestepping obstacles and each other, providing a believable and frustration-free experience for players.
Smooth obstacle avoidance not only improves the realism of your AI but also prevents gameplay issues like NPC traffic jams or players being body-blocked by AI. By leveraging Unreal Engine’s RVO and Detour Crowd systems, along with thoughtful NavMesh setup and maybe a touch of custom logic, you can ensure your AI move through your game world fluently and intelligently, no matter how complex the environment or crowded the scene.
Sources and Citations
- Unreal Engine Documentation – Using Avoidance With the Navigation System, https://docs.unrealengine.com/5.0/en-US/using-avoidance-with-the-navigation-system-in-unreal-engine/
- Epic Games Forum – Detour crowds vs RVO Avoidance, https://forums.unrealengine.com/t/detour-crowds-vs-rvo-avoidance/313908
- Epic Games Forum – RVO avoidance causing AI to get stuck…, https://forums.unrealengine.com/t/rvo-avoidance-causing-ai-to-get-stuck-and-push-each-other/313611
- Epic Games Forum – Navigation around pawns that are dynamic obstacles, https://forums.unrealengine.com/t/navigation-around-pawns-that-are-dynamic-obstacles/453413
- Reddit – Detour Crowd AI Controller and RVO Avoidance Demonstration, https://www.reddit.com/r/unrealengine/comments/6x0m3p/detour_crowd_ai_controller_and_rvo_avoidance/
- AI Wiki (M. Zielinski) – UE4 AI Tutorial – Avoidance, https://michaeljcole.github.io/wiki.unrealengine.com/Unreal_Engine_AI_Tutorial_-_Avoidance/
- Vikram Codes Blog – Navigation Filtering and Avoidance, https://www.vikram.codes/blog/ai/03-navigation-filtering-and-avoidance
- Epic Games Forum – Detour Avoidance Groups, https://forums.unrealengine.com/t/detour-avoidance-groups/301317
- Qiita (Ken Kuwano) – Crowd Manager control, https://qiita.com/kenkuwano/items/4e8a0f3d3c9d4b6a4c91
- Steve Streeting Blog – Agent Player Avoidance in UE, https://www.stevestreeting.com/2023/05/15/agent-player-avoidance-in-unreal-engine/
Recommended
- Blender Multi-Camera Rendering: A Step-by-Step Guide with The View Keeper
- Musgrave Texture Removed in Blender 4.1 – Workarounds and Alternatives
- How do I create a POV shot with the Blender camera?
- The View Keeper Add-on: Tips for Seamless Camera Switching in Blender
- How do I set a camera as the active camera in Blender?
- Where to Stream Every LEGO Movie Online in 2026 (Updated Streaming Guide by Country)
- Donald Glover Is Playing Yoshi in The Super Mario Galaxy Movie: Cast, Trailer, Release Date, and Everything Confirmed
- War Machine Review (2026): Netflix’s Alan Ritchson vs Alien Killer Robot Sci-Fi Action Movie
- Blender Camera Control: Why The View Keeper Is the Ultimate Tool
- Capturing Every Angle: Blender Camera Management with The View Keeper










