[UE4] AI Navigation Issues - I think (hope) I've fixed them

Advertisemen

The problem:

This video demonstrates what is happening https://youtu.be/lXrkkG71Y-E

Given a low(ish) obstacle that the AI is unable to step over, it keeps trying to path across it to reach the player instead of pathing around the obstacle.

I came up with two hacky solutions, both of which would restrict the level design in the future.

1) Make the obstacle taller - which would really restrict the level design, not being able to have lower ledges/boxes etc... Terrible fix!

2) A Nav Modifier is a 3D shape (i.e. box) which can be used to manually block out parts of the Nav Mesh. A Nav Modifier can be placed on top of the obstacle to block out the Nav Mesh on top of it. This works but there are downsides. The first is that manually placing them everywhere would be a pain in the ass - especially when the map changes. The second is that by placing the Nav Modifier on top the obstacle - let's say it was a ledge that you also want AI to walk ontop of, as well as on the lower level, an image to show what I mean:


Using the Nav Modifier method would mean that the AI on the platform wouldn't be able to move around because the NavMesh would be disabled there.

Attempted solution:

So I played around with various combinations of some settings, three in particular:
1) The radius of the AI's capsule component (Char Radius)
2) The agent radius on the Nav Bounds Recast (Nav Bounds Vol Rad)
3) The agent radius on the Nav System in the project settings (Proj Settings)

The following photo shows the various combinations I tried (the icons in the 'Works' column: X means the AI didn't move at all, and ~ means the AI moved but the initial problem was still there).


None of this worked so I asked for some help

Solution:

Unreal Answers post: https://answers.unrealengine.com/questions/514794/ai-keeps-trying-to-path-over-an-obstacle-it-cant-s.html

So I started off by changing the Agent Radius in the Project Settings to a higher number, however, that showed no effect on the generated Nav Mesh in the editor. So I deleted both the Nav Mesh and Recast Nav Mesh, and then created a new Nav Mesh Bounds which updated with the changes. Eventually when I set the agent radius to 15, it was no longer trying to path over the obstacle, instead it was trying to path around. However, it was still stuck on the corner of the obstacle.

I tried changing the AI Pawn's capsule collision radius but that had no effect. Then I looked into my Blueprint and changed some of the parameters of my Move To Location node - in particular the distance threshold from ~100 to 0 and it worked!

Probably more testing will end up breaking it though, but hopefully not!

Advertisemen

Disclaimer: Gambar, artikel ataupun video yang ada di web ini terkadang berasal dari berbagai sumber media lain. Hak Cipta sepenuhnya dipegang oleh sumber tersebut. Jika ada masalah terkait hal ini, Anda dapat menghubungi kami disini.

Tidak ada komentar:

Posting Komentar

© Copyright 2017 Game Engine Tutorial