I use navmesh agent for my Isometric game (diablo like) how then in all diablo-projects did they make it possible to rest against the wall? how to off pathfind in nav mesh agent ? I just want to hit the wall (or game object)
I tried everything, I can't figure out how to do it
CodePudding user response:
I need to make sure that he does not look for ways to get around, but just rests against the wall
CodePudding user response:
You have to use NavmeshObstacles
like explained here https://learn.unity.com/tutorial/navigation-basics#5c7f8528edbc2a002053b49c in Step 5.
So your navmesh basically ignores the wall - but the object prevents the player from passing. During runtime you can just remove the object and the path will be walkable.
Update: In order to force the player to run into the wall (I assume when you say 'rest' against the wall you mean that), you could add a script that recognizes the player when they're close and then takes over their movement to let them smash the wall.
But this isn't a specific question anymore. So I'd rather recommend that you check out the Unity Tutorial section: https://learn.unity.com/search?k=["tag:5d351f087fbf7d006af48180"] And try to get a better understanding of navigation and player movement in general.