News › Forums › RAIN › Sample Projects, How To, and Code › RAIN NavMesh
Tagged: navigation mesh, odd path, smoothing
This topic contains 4 replies, has 3 voices, and was last updated by Almuva 1 month ago.
-
AuthorPosts
-
July 4, 2022 at 1:55 pm #38429
I’ve been banging away on RAIN for a couple of days. I have made zero progress. It seems the NavMesh works fine if I am just using a flat plane. I don’t build a lot of flat planes. Does RAIN not work with meshes and terrains?
Here is my simple level:
ClearLevel
The half walls and cylinder in front of “Max” are in layer Default. (I will need to make them walkable eventually, as the player hops over them.)
Here is the NavMesh setup.
NavMeshSetup
Here is the navmesh that gets generated.
NavMesh
No spaces around the half walls or cylinder.
The Max character happily ignores the fact that these objects block his path to the PatrolRoute and WanderNetwork.
He also doesn’t seem to stay above ground. As he moves forward on the slightly inclined terrain, he sinks deeper and deeper until he turns around and heads back along the patrol route, at which time he rises back out of the dirt at the same rate as he went in.A little time invested in a manual or online instruction that is both intelligible and legible would probably help a great deal.
Please respond. Thanks,
MarkJuly 6, 2022 at 10:22 am #38437Let’s start with the Navigation Mesh. The Included Layers tells the Navigation Mesh what colliders to use to create the Navigation Mesh. Since you have it set to Walkable it is ignoring the half walls and cylinder in the Default layer. Likely a good setup for the included layers is to have everything on, and uncheck any players/ai/dynamic things. Ignored Tags will also allow you to ignore specific tags, in case your layers are already being used for another purpose. If you don’t want a collider to be walkable at all (including on top of it), you would need to add it to the Unwalkable Tags.
As far as the Max character going into the ground. If he is using a Rigid Body make sure he has a Basic Motor on him (AIRig, third tab). If he has a Character Controller on, you should use the Character Controller Motor instead. The Mecanim Motor will work with either a Rigid Body or Character Controller. Going to fix this so that it isn’t necessary in the next version, but until then.
September 1, 2022 at 2:26 am #39005Hello!
I have a question regarding navmesh generation and pathfinding.
The case is that in some places, when our AI characters have to just go forward, they don’t because of the navmesh generated.
Here there’s some example:
-> In this case the enemy was placed in the waypoint on the left, and had to go to the one at the right, but instead of going right, he went to the place he is now.
-> Here you can see the path he’s following. The way I understand it, he doesn’t go straight because of the way RAIN generated the navmesh… or am I wrong?There’s a way to avoid this issue?
Thanks!!
September 3, 2022 at 9:35 pm #39020I am working on a fix for this. We’re using a string pulling algorithm for smoothing our paths, but it doesn’t take into account interior points (like your example). Essentially we need to notice points like this and see if we can just skip them by casting a ray (not a physics ray, but a simple 2d ray across our Navigation Mesh).
I’ll let you know when I have a fix for this and you can give it a try (bug me about it in awhile if I haven’t come back, been a bit busy lately).
September 4, 2022 at 1:35 am #39023OK, thanks!
-
AuthorPosts
You must be logged in to reply to this topic.