Nav Mesh Vehicle AI

Title: “Unreal Engine Marketplace | Nav Mesh Vehicle AI | Overview – YouTube”Video Transcript: “hi everyone welcome and in this quick video i’m just going to be showcasing the navmesh ai that i’ve built and i’m going to be showing its settings and you know some uses that you can use this ai to you know for great effect that normally other ais on the marketplace don’t really cover so basically with this pack i’m just trying to move away from you know the spline path kind of movement that people always do with vehicles but that doesn’t really allow you to change stuff at runtime and it’s not usable with enough mesh that for example if you want you know the paths or the destinations to be random and not predefined that the spline method doesn’t really work so this that’s where this system comes into play so what can you do with it well right now um if you click play you can see that the vehicle will move to these pads that you will see over here and you can see that the path points are being created at runtime so they are changing that basically means that um for example if you have a player in the middle of the pad the vehicle will go around it or anything that basically affects the nav mesh like this pillar will make that the vehicle will change its path at runtime now you can see these boxes because if you go into blueprints test vehicle and test ai vehicle pawn i have activated over in the component to draw debug path points now if you disable this you’re not no longer going to see that now one of the things that this pack is great is or this system is that it can change its path at runtime so i’m going to show you using this pillar how you can do that so first of all you need to make sure that this your recast nav mesh over here that if you find it it needs to be dynamic so right now it’s static let’s change it to dynamic and let’s i’m going to find this pillar and i’m also going to make it movable so i can move it while i’m simulating the game so right now i’m going to press p to hide the nav mesh and i’m going to click play you can see that right now the the vehicle oh sorry i need to enable back draw debug pad point so we can see that let’s click play now you can see that you have this pad points over here so i’m going to want this path point over here to be blocked by this pillar so i’m just going to be moving it and you can see that the vehicle is updating the pad points over here and i believe the the vehicle will now try to go to you know sideways on the pillar or not to the side and it’s going to go around but now if i go over here you can see that the vehicle is already detecting a new path and it’s going around and now he’s going to stop it actually slide that’s very cool into the path point now it’s not going exactly to the position why because i have this reached goal acceptance value at 0.1 now if you make this value smaller it’s going to try to reach the exact position but i i don’t really like that i want the vehicle to have you know some margin of error and i don’t want them to go exactly to the spot because that can create some problems so i like this now you have the padpoint reach threshold over here that i should explain now each one of these paths that you see that are red now the vehicle needs to get close enough to them that it detects okay i’ve reached this path so now i’m going to go to the next one now this distance over here in this case it’s 150 centimeters or a meter and a half the vehicle is going to think okay i’m going to move to the next pad point now if you make this value too small what’s basically going to happen is that it’s going to try to go exactly to the pad point so for example if he slides like it is over here it’s going to try to go sideways or reverse to go exactly into the point and then continue to the next one so if you make that too accurate it’s going to look you know it’s not going to drive itself naturally but with this kind of values you’re going to find that that you will you know behave more realistically but you can play around with all these values and test for yourself of course now the acceleration multiplier is how fast does the vehicle accelerate compared to a human input so in this case it’s one to one so it will accelerate the same as human if you want to make it less you can lower this value i don’t think if you go above one is going to do anything because the vehicle stats are actually driven by the vehicle movement component of your vehicle that’s why it’s so great because it can be used with any custom component or custom vehicle system and it will always use the steering settings the the engine settings everything else that the player would control this will also be used by the ai so that’s why it’s so great and basically you can just limit if you wanted to accelerate slower you can lower this value the same to the same thing with the max speed uh right now it’s at 0.7 if i put a lower value it will uh you know cap its speed at the lower value or more uh it will drive itself to the full potential of you know a player input basically or this stats over here now this is useful for example if you don’t want vehicles to move too fast or too slower you can always change this value i left it at the default 0.7 just because i like that value when i tested my stuff out and now the movement update interval is basically it’s over here more for performance reasons so you can see that the vehicle is moving right away and you can see his movement is quite um you know smooth so it updates its direction or the wheels uh you know pretty often especially like when he’s doing like curves like over here now the way the reason that it uh looks so smooth like this it’s because the vehicle is updating 0.01 times you know every 0.01 times and that means that it’s basically every tick now obviously if you have a lot of vehicles or you know your game is for example for mobile this might be a little bit too much and it will affect performance so if you want to lower this value uh it will make the movement a little bit more sharper or it might not you know turn as much times and it might actually create problems if the pad points are too close together but you can always alter this value slightly to gain better performance for example if alter this to 0.05 it’s going to be five times cheaper in terms of performance and you can see that the vehicle will uh you know is going to be more linear with its path is not going to work as well but generally it will you know it’s not going to be really that noticeable let’s see over here in the curve how it behaves you can see it’s kind of you know now it’s going to try to go around and now continue you can see that it can change its behavior because it’s not updating as quickly but you know normally the default value and the value that you always want to use it’s 0.01 again you can change this for performance if you want to um and yeah i think that’s it um now this pack is really simple that’s why it’s only six dollars um you know compared to other similar packs on the marketplace uh it’s very simple obviously but it’s not you know as expensive and if you just want a simple ai so your vehicles just move that’s the only thing that you want to go to a specific vector and they move this is the pack for you obviously now if you want complex systems uh you know or more complex ais obviously that will depend on your project so i can really you know prepare anything from my end so that it fits exactly your project but if i get a lot of requests for for people for certain features or certain things that you want me to do they i will do it and i will update the pack for free so let me know in the comments what you think what you want me to improve i always appreciate that and yeah if you could buy the pack that will obviously help me a lot so thank you and yeah i’m gonna leave it here thank you guys so much for watching and bye bye”Video Summary:

**Video Summary – “Unreal Engine Marketplace | Nav Mesh Vehicle AI | Overview”**

This video showcases a custom **Nav Mesh–driven Vehicle AI system** designed as an alternative to the common **spline-based vehicle pathing** in Unreal Engine. The creator highlights how it differs from spline movement by dynamically recalculating paths at runtime, allowing vehicles to avoid obstacles, react to changes, and follow non-predefined routes.

### Key Features
– **NavMesh Integration**: Vehicles use Unreal’s **Recast NavMesh** to generate paths dynamically. Obstacles (like players or pillars) alter the AI’s course in real time.
– **Runtime Adaptation**: Moving an obstacle during gameplay immediately updates the vehicle’s path.
– **Debug Path Points**: Can be toggled on/off to visualize decision-making.
– **Dynamic vs Static NavMesh**: Must set NavMesh to *dynamic* and obstacles to *movable* for runtime recalculations.

### Tunable Settings
– **Goal Acceptance Radius**: Controls how close vehicles must get to a target. Smaller = more precise but can cause awkward reversing; larger = more natural driving.
– **Path Point Reach Threshold**: Default ~150 cm. Larger values produce smoother driving; too small makes cars unnaturally “hunt” for exact points.
– **Acceleration Multiplier**: Scales AI acceleration vs. human input. Default = 1 (same as player control).
– **Max Speed Multiplier**: Caps AI speed (default 0.7). Useful for keeping traffic under control.
– **Movement Update Interval**: How often AI updates steering (default 0.01 = per tick, very smooth). Higher values save performance at cost of responsiveness.

### Advantages
– Works with **any custom vehicle movement component**, preserving physics, engine torque, and handling.
– Simple and inexpensive ($6 on Marketplace).
– Great for projects needing **basic AI-driven traffic or vehicle movement** without heavy complexity.

### Limitations
– Not a full traffic system — just point-to-point AI movement on NavMesh.
– Complex behaviors or advanced decision-making would need additional systems.

👉 In short: this pack gives you **plug-and-play vehicle AI that avoids obstacles naturally using NavMesh**, ideal for small projects or as a lightweight baseline system.

Would you like me to break this into a **step-by-step guide** for setting up a car with this system in UE5.6 (dynamic NavMesh, AI controller, test vehicle setup), so you can replicate what was shown?
Yes, write out the instructions for your coding twin to carry out. This is entry level coding – step by step practice.

Got it, Rick. Here’s a dead-simple, “hand it to your coding twin” set of **step-by-step**, entry-level instructions to make a vehicle-ish thing navigate a level on a NavMesh, avoid movable obstacles in real time, and (optionally) upgrade to a proper Chaos vehicle later.

I’ll give you two tracks:
– **Track A (Beginner, Blueprint-only):** a box “car” with FloatingPawnMovement that fully obeys NavMesh + AI Move To. Fast to learn, perfect for practice.
– **Track B (Upgrade):** swap in a real Chaos vehicle and feed throttle/steer from path points.

# Track A — Blueprint NavMesh Car (Beginner)

## 0) Prereqs (2 minutes)
– UE **5.6** project (Blueprint).
– Plugins: default is fine. (No vehicle plugin needed yet.)
– Window → **World Settings** → check “Enable Navigation System” (usually on by default).

## 1) Build a NavMesh playground
1. Create a new level. Add a floor (e.g., Cube scaled to make a platform).
2. Place **Nav Mesh Bounds Volume** to fully cover the drivable area.
3. Press **P** to toggle green NavMesh preview. (Make sure your floor is walkable—default works.)
4. In the Outliner, select **RecastNavMesh-Default** (it appears when you have a NavMesh volume)
– Details → **Runtime Generation** = **Dynamic** (not Static).
– Rationale: lets the mesh update at runtime when obstacles move.

## 2) Drop a movable obstacle that affects nav
1. Add a **Cube** (call it `SM_Obstacle`), set **Mobility = Movable**.
2. Details → Search **“Navigation”**:
– **Can Ever Affect Navigation** = **true** (so moving it punches holes in the NavMesh).
3. You’ll drag this during PIE to watch paths update live.

## 3) Make the “car” pawn (box that moves on NavMesh)
1. **Blueprint Class** → **Pawn** → name it `BP_NavCar`.
2. Add components:
– **StaticMesh** (use a Cube; scale like a car 2×1×0.5).
– **FloatingPawnMovement** (keeps it simple and AI-friendly).
– **Sphere** (optional “collision halo” for on-road checks; radius ~120).
3. In **BP_NavCar** → **Class Defaults**:
– **Use Controller Rotation Yaw** = **true** (so it faces where it steers).
– FloatingPawnMovement:
– Max Speed: **1200** (tune later).
– Acceleration/Deceleration: **2048/2048** (tune later).
4. **Auto Possess AI** = **Placed in World or Spawned**.

## 4) Create an AI Controller that roams to random points
1. **Blueprint Class** → **AIController** → name it `BP_NavCarController`.
2. Open **BP_NavCarController**, add variables (Editable/Expose on Spawn where noted):
– `RoamRadius` (float, default **4000**, **Editable**).
– `AcceptanceRadius` (float, default **150**, **Editable**).
– `UpdateInterval` (float, default **0.01**, **Editable**) – “steering refresh”.
– `bDrawPathPoints` (bool, default **true**).
3. **Event Graph** logic (entry-level, no Behavior Trees needed):
– **Event On Possess** → set a **Timer by Function Name**:
– Function: `”TickSteer”`; **Time** = `UpdateInterval`; **Looping** = true.
– Also call `”PickNextDestination”` immediately.

4. Add **Function: PickNextDestination**
– **Get Controlled Pawn** → **Get Actor Location**.
– **Random Reachable Point in Radius** (Location, `RoamRadius`) → **TargetLocation**.
– **AI Move To** (Pawn = Controlled Pawn, **Destination = TargetLocation**, Acceptance Radius = `AcceptanceRadius`).
– (Optional) **Find Path to Location Synchronously** → **Get Path Points** (array).
– If `bDrawPathPoints` true: ForEach PathPoints → **Draw Debug Sphere** (radius 20, duration 1–2s).

5. Add **Function: TickSteer** (keeps movement responsive & “car-ish”)
– You don’t actually need to steer manually with FloatingPawnMovement when using **AI Move To**, but we’ll add a little facing assist so the box turns nicely:
– Get Controlled Pawn → Get Velocity. If speed That’s it. **AI Move To** handles path following on NavMesh. The timer keeps your facing smooth (your “movement update interval” knob).

## 5) Place one—or many—cars
1. Drag `BP_NavCar` into the level.
2. In **Details**, set **AI Controller Class = BP_NavCarController**.
3. Duplicate a few to watch emergent traffic.

## 6) Live demo (runtime updates)
1. PIE.
2. Press **P** to hide/show NavMesh.
3. Drag `SM_Obstacle` around. Paths will re-compute as the cube moves.
4. Toggle `bDrawPathPoints` on one car to see red dots dancing.

## 7) Tuning knobs (match the video’s ideas)
– **AcceptanceRadius** ~ 100–200: larger feels more natural; tiny values cause awkward “hunting”.
– **RoamRadius** = how far it wanders.
– **UpdateInterval**:
– `0.01` = smoothest but costlier (per-tick).
– `0.05` = 5× cheaper; turning looks a little chunkier (acceptable for many NPCs).
– **Speed Caps**: use FloatingPawnMovement MaxSpeed (or reduce Accel) to simulate “max speed multiplier”.

## 8) Entry-level on-road/off-road (NavMesh-based)
Goal: detect if the car is “on the road” (i.e., on the NavMesh), and self-correct if it slips off.

**In `BP_NavCar` (Event Tick or a 0.2s timer):**
– **Project Point to Navigation** (ActorLocation).
– If **success**: `bOnNav = true`.
– If **fail**: `bOnNav = false`; ask controller to **AI Move To** the **projected** point (closest Nav spot). That “snaps back to road”.
– Optional: Use the Sphere halo:
– **Get Overlapping Actors** filtered by a custom “Road” tag or collision channel you assign to road meshes. If none overlapped, consider “off-road”.

**Tiny Blueprint snippet (pseudo):**
– `Branch( ProjectPointToNavigation(Location) ? )`
– True → no action.
– False → `AI Move To(Destination = ProjectedLocation, AcceptanceRadius = 150)`

## 9) (Optional) Minimal “go to fixed pads” mode
– Place a few **TargetPoint** actors as “pads”.
– In `PickNextDestination`: choose the nearest/next TargetPoint instead of Random Reachable.

# Track B — Upgrade to a Real Chaos Vehicle (steer + throttle)

> Once you’ve mastered Track A, swap the box for a car and drive it with simple steering math. Still entry-level, just a few more nodes.

## 10) Enable vehicle plugin and blueprint
1. Edit → Plugins → enable **Chaos Vehicles**; restart editor.
2. **Blueprint Class** → **WheeledVehiclePawn** → `BP_ChaosCar`.
3. Add a skeletal mesh with wheels (use UE sample or a template). Ensure the **ChaosWheeledVehicleMovement** component is configured (wheel setups, etc.).
4. **Auto Possess AI** = Placed in World or Spawned.

## 11) Controller that translates path → throttle/steer
Reuse `BP_NavCarController` logic, but replace “let AI Move To drive” with “we drive inputs”:

**Controller variables (same as before):**
– `AcceptanceRadius` (150–250)
– `UpdateInterval` (0.01–0.03)
– `bDrawPathPoints`
– `RoamRadius`

**Flow:**
– On Possess → start `TickSteer` timer; call `PickNextDestination`.
– `PickNextDestination`:
– Find **Random Reachable Point in Radius** → `TargetLocation`.
– **Find Path to Location Synchronously** → store **PathPoints** array.
– Set `CurrentIndex = 1` (skip point 0 which is near you).
– `TickSteer`:
– If **distance** to `PathPoints[CurrentIndex]` = PathPoints.Num → **PickNextDestination** again.
– Else: **Steering math** toward `PathPoints[CurrentIndex]`:
– Get Pawn forward vector `F`, pawn location `L`, waypoint `W`.
– Desired direction `D = Normalize(W – L)`.
– **Angle** = `atan2( cross(F,D).Z, dot(F,D) )` (in BP: “Cross Product”, “Dot Product”, then “Atan2”, convert to degrees).
– **SteerInput** = `Clamp( Angle / 45°, -1, 1 )` (45° = full lock; adjust).
– **ThrottleInput**:
– Base = `1.0`
– Reduce when turning hard: `Throttle = 1.0 – Clamp(abs(Angle)/90°, 0, 0.6)`
– Reduce when close to waypoint (120°) and **speed** is high → apply a short **Brake Input** or release throttle.

**Tuning “video knobs” equivalents:**
– **Goal Acceptance (final point)** = `AcceptanceRadius`.
– **Path point reach threshold** = `PathPointReach` (~150 cm) to avoid awkward “micro-parking”.
– **Acceleration multiplier** = scale **ThrottleInput** globally.
– **Max speed multiplier** = set gear ratios or **VehicleMovement → Max RPM** or use a simple “if speed > cap → reduce throttle”.
– **Movement update interval** = `UpdateInterval` timer.

**Debug path points**: draw spheres at `PathPoints`. Toggle with `bDrawPathPoints`.

## 12) Keep dynamic NavMesh behavior
– Your movable `SM_Obstacle` with **Can Ever Affect Navigation = true** still works.
– RecastNavMesh **Runtime Generation = Dynamic** (critical).

## Quick Test Checklist (what your twin should verify)
– [ ] Press **P**: green mesh present over floor.
– [ ] Moving the obstacle live updates the green mesh.
– [ ] Track A car(s) wander around, avoid the obstacle, and re-route instantly.
– [ ] Path points (red dots) redraw when the obstacle moves (if debug on).
– [ ] Turning down **UpdateInterval** to `0.05` looks slightly choppier but saves perf.
– [ ] Track B car steers toward waypoints; big Angle → more steer, less throttle.

## Common gotchas (and fixes)
– **“AI Move To fails”** (Track A): Usually no NavMesh where you clicked or `NavMeshBoundsVolume` too small. Expand volume.
– **Obstacle not carving**: Check **Movable** + **Can Ever Affect Navigation = true**.
– **Chaos car won’t move**: Ensure wheels are set up, collision is correct, and **VehicleMovement** has engine torque values > 0.
– **Vehicle spins at a point**: Increase `AcceptanceRadius` and `PathPointReach` a bit; don’t force surgical precision.
– **Too fast / too jerky**: Cap MaxSpeed; raise `UpdateInterval` slightly; add light braking on sharp turns.

If you want, I can drop a tiny **Blueprint screenshot map** (in text form) or a **C++ micro-controller** version that mirrors this logic. But this gets you from zero → cars roaming on a NavMesh, reacting to obstacles in real time, exactly like the video’s behavior—without needing the Marketplace pack.