My goal is to move a unit as close as possible to a building. The problem I'm facing is, that if i use the center of the building as the target position for NavMesh.CalculatePath the resulting path is invalid and no corners are provided because the area of the building is not walkable. Now I can use SamplePosition to find a point on the NavMesh but that doesn't yield the shortest path to that building. The only option I can think of is to calculate multiple paths to all the sides of the building but that seems rather wasteful. Any tips?
I'm pretty sure that the NavMesh.SetDestination just finds the closest path, couldn't you just set the destination to the objects transform, and it will try to get as close to said object as possible? Sorry if this doesn't help - I'm in a bit of a pinch and can't post a full set of solutions. Kind Regards, Miggi124
I remember someone with a similar issue. Can you provide a little more info on your setup, specifically what components are on the building? I'm assuming you put a collider and a NavMeshObstacle on it, is that correct?