Hey,
thanks for all the help and quick responses you’ve been giving so far, it definitely makes integrating A* a much easier and quick process. I have one last issue that im having before i think I’ll have everything working perfectly. Im still working on instantiating buildings and updating the recast graph to include them, and what i set up is, i have the floor and the stairs into the home set to a walkable layer, of which i set the graph to scan, and after instantiating it i call AstarPath.active.UpdateGraphs(new Bounds(building.transform.position, new Vector3(20, 20, 20))); On top of that i also have a navmesh cut attached to the building under the floor to cut out the mesh on the terrain below the house. the issue is that the floor and the ground below are fairly close together, and i can’t seem to be able to remove the terrain floor without preventing the building floor also from being built. the thing is, there’s also a stair way/pathway on the second floor on the side of the building (multiple meters away from the navmeshcut) which i set to scan just to test, and although its way outside the bounds of the navmesh cut, it seems to still be affected by it, as it only fails to generate when the navmesh cut is on, although its fairly far from it. How come navmeshcut is cutting mesh’s well outside the bounds of the area it shows, and do you know how i could better approach this, expecially in the case of the floor below the house being disabled, while the floor of the house not being?
Not sure about the stair thing, do you have a screenshot of that?
If you are actually recalculating the recast graph around the building when it is being placed, why do you need a navmesh cut? The recast graph should be able to take care of it.
Screenshot?
Hey,
Sorry for the really late response. so, i’ve got some screenshots and tried few more things, and I think i can fully explain the issues that im having. This is the house that i’ve been testing with. The floor is elavated to around where the stone ends and the wood wall starts. There are two things which I seem to be having an issue with. The main issue I am having is that after i rescan the map, it seems that after i adjusted the setting a bit more, it seems to notice the building and scans it right for the most part (the stairs in front I haven’t got to scan properly yet). The problem is though, when the AI walks into the house, it doesn’t correct its height and ends up clipping under the floor to where the navmesh used to be on the terrain as seen here:
Do you have any idea how to fix this? I also would like to know if theres a way to have the AI acknowledge the walls, i haven’t managed to get the stairs in set up yet, which when i do might fix it, but i’ll assume that once the stairs in the entrance are properly getting scanned the AI should know to use them?
Also the stair issue I said last post, it should not cause any issues now if i don’t use a navmeshcut however what was happening was that these stairs in the back, would also get affected by a navmeshcut that was only around the base of the stone, which I found odd since they are a good distance outside of the bounds of the navmeshcut.
Does the house have colliders for the floor and stair that the player can walk up on?
The character does not walk on the navmesh, it uses the physics system for that.
What happens if you leave the house in and scan it when the game is not playing?
How does the graph look, does it scan the house correctly?
One thing you can try is to make a very low resolution mesh/collider that you only use for scanning. I think that that building should be able to be scanned without that, but since you are scanning during runtime I would suggest this since it will be a lot faster (that house looks like it is pretty high poly).
Hey,
I finally managed to get some time to really look into this issue and I managed to get everything working perfectly. I haven’t tried to test while generating navmesh for the house at run time, but so far all the issues I’ve had are solved with pre cached graph and assume will be for run time scan also. The issues i had were a variety of tiny mistakes I made, including not having the houses layer set as a ground mask, and the stairs mesh not scanning due to the holes in it. Any ways, everything Works now that I fixed all those issues, Thanks very much for the help.