Download

navigation question

hello. i want to ask a question as shown in the image…
b82e5b03f0f434f9c91467c4ad7a942a2addd8cd.png

i have a nav mesh in my level.
and when i send my ai to move, to point A to point B.
the ai would navigate, using the red line.

yes, it is the quickest route.
but, i was curious if it is possible to make the path look a bit realistic, like the black line…
making the navigation not to cut corners really sharp…

Use Navmesh modifier to exclude areas AI should not move
Or setup a targetpoint array and let the ai walk along the targetpoints, on the way to your target, many options.
:slight_smile:

there are walls, so the navmesh already know it is not passable.
targetpoint array?.. what do you mean by that?..
something like, waypoint1, waypoint 2 3 … etc ?

now how would i make it set the waypoint automatically as the player set the destination point B

I am really sorry, because i am only novice BP and when i try to show you something, i bet there is a better way, to do that.
My english is to limited, to teach someone more then breathing with it.
Here i load the target points in my case into Array.
456340f47a7ea06d63411da49247bc5c143adeb5.jpeg
And here i am extracting them again, but i use random locations. You could check the distance to the next point and choose the next aviable to start track.
c36c629dd317b09ca3617e0a8a745be23031967e.jpeg
I think in your case it would be best to setup a targetpoint grid (at every crossing section, or where the pathdirection changes, but you have to try it out on your own).
Not to complicated i think.
:slight_smile:

sorry for the late reply luftbauch.
i see now what you meant by using target point…
so the ai gets all the targe points / waypoints. and check the nearest one and go there…

so, the target points are placed on the middle of the path corners

You can use the navpoint / route system that is in the survival game sample:

But there you have to place the routepoints manually.
If you want to go for a more realistic automated route, i would suggest to keep a minimum distance to the borders of the navmesh, like 1 meter for example.
As a human you would go the original red line from A to B with some distance to the walls.

If you want more of a robot/drone behaviour that really goes in the middle of the paths, then i would set up manually a mesh of navpoints, its quick to do.

i have more question for using the waypoints…

so if destination is set, then the ai gets all waypoints to an array
then gets the closest one then moves to it.

now the question is, if going to the destination, the character has to cross 10 waypoints…
what i get is only the first step, go to nearest waypoint in array.
then whats next?

how does the ai find the next waypoint to go to to get nearer the destination after it reaches the first waypoint…?