Zylann / godot_heightmap_plugin

HeightMap terrain for Godot implemented in GDScript
Other
1.74k stars 159 forks source link

Paint areas for path finding #176

Open ghost opened 4 years ago

ghost commented 4 years ago

Hi Zylann

So I've been working on this AI mechanic where an AI 3d character generates a path at regular intervals when following the player whenever the player's character is within detection range. The mechanic works perfectly on a flat surface and any slopes, whether steep or not.

Now here comes my question and/or feature request... after I've spent time testing my AI, I decided to finally move on and integrate it into my real level where I am using your addon for my terrain. My mission is to generate a navigation mesh for my AI to use. I want the navigation mesh to only make certain areas of the landscape "followable".. if that makes sense!

So I was wondering, is there any possible way to add the following to your addon: paint a navigation mesh onto the landscape with a brush like when painting textures and shaping the landcape with it's sculpting tools?

As an alternative, if that's not possible, is there some other accurate method to accurately generate a navigation mesh?

I've attached an image of what I've tried, but failed.

101986158_1864175143718209_5117977321625616384_o

Zylann commented 4 years ago

At the moment the plugin doesn't have anything to manually decide where things are pathfindable or not. Besides, Godot's navmesh system isn't extensible enough to work right away with the terrain, so navmesh worfkflow is down to using the "Terrain -> Generate mesh" menu to temporary have a mesh, and ask Godot's navigation system to bake a navmesh from it. Looks like you've been doing this, so what's the problem? I assume Godot's tool has an option to decide maximum steepness to avoid holes, as seen in your screenshot (max slope? climb?). I never used this though, so can't help you more than you know.

ghost commented 4 years ago

I got a solution to my own issue this morning. I thought I might share it here for you and all your followers for in case anyone might want to do the same as me:

To make only a part of the landscape available for path finding (see image) -- any slopes and holes that need to be excluded from the followable area can be removed this way. Hope it makes sense!

Tut

Zylann commented 4 years ago

Ok, so what you need here is a special painting mode to define which areas of the terrain should be considered/excluded for pathfinding? If that's what you want, perhaps you could rename this issue to be a more focused feature request.

peterhoglund commented 4 years ago

Ha, I am actually looking to do something similar. Not to make a navmesh but to be able to "draw" paths that follow the terrain. It has to be an object so that it can be interacted with later. The use case is very different but I think the method would be similar.