-
-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pathfinding is going off the navmesh #80
Comments
Here's how I'm loading the NavMesh
And here's how I'm generating the NavMesh, by converting Unity's NavMesh to Recast.
|
Hello. Nice to meet you! If it's okay, could I please get the navmesh file? Oh, and if you have a screenshot of the reproduction steps for the issue, that would be really helpful. I can't quite figure out what the problem is from the screenshots you provided. |
Sure, thanks for helping with this! I'm trying to prevent the AI from walking into the water when following the player. The pathfinding will even follow the player into the air. The path returned is just two waypoints, the first being the AI's current location and the end result being the target location. So its as if its not even trying to find the path and just going directly to the result. |
@ikpil Thanks for the suggestions!
|
Any ideas on those two issues? I haven't been able to figure them out |
|
As for question 1, I'm not entirely sure what case you are referring to. When I opened the demo, I could see the path. Are you saying that the path goes under the bridge? |
If you need to express climbing the stairs more closely, referring to the Pathfind Follow logic will be helpful. It is designed to return a smooth point at every 0.5 distance. |
world.2024-12-10.235932.mp4 |
First, NavMesh.CalculateTriangulation(); returns a simple triangle value for the Unity NavMesh. This means that there is no detailed information for walking paths. So, if you create a NavMesh for DotRecast based on this value, you will inevitably get a distorted shape. To use DotRecast in Unity, you need to correctly create and input terrain data. You can refer to UniRecast's UniRcNavMeshSurface.BakeFrom for assistance. Reference: |
Or could the following code be helpful? I haven’t tried it myself, so it might not be accurate. |
In the sample, it appears to be using only one mesh. Have you tried it in a scene with a terrain and many meshes on the terrain? |
I have a navmesh that looks like this
My pathfinding is causing the agent to walk through the water, which is the empty area in the center of the screenshot.
Any ideas what I am doing wrong? Here's my code for finding the path. I probably screwed something up, it wasn't easy trying to figure out how to actually find a path using DotRecast. Had to use OpenAI and a lot of trial and error to try and figure it out lol.
The text was updated successfully, but these errors were encountered: