Navmesh Obstacles on Grabbable Objects? And what does Carve Do?

Right now i’m working on having a dog be able to pick up, or grab+drag variously sized and weighted toys. I have everything in place thus far, that i can click a toy, move to it, and have the dog bite and lift it at the exact location i clicked, great!

I’m running into some problems with oddly shaped objects though. A good example is a stick. As long as the dog can run straight at the stick and pick it up, things work great.

But if the stick is pointing along a somewhat similar axis to the direction to the dog, and i click a grab point that isn’t on the facing end, then the dog tries to run directly at the point i clicked, unsuccessfully hitting the wrong end of the stick and running in place. He can’t seem to path around to the other side of the stick successfully to pick it up

Demonstration: Here the dog on the left is told t grab the right end of the stick. He can’t get there because he tries to run through it.

I realise i could solve this problem by using a larger stopping distance for my navigation, but IMO that’s a copout, and it would cause visual problems, like the stick teleporting into the dog’s mouth from a wierd range. I’ve kept the stopping distance deliberately small, smaller than the length of that stick, he never comes within range of the target in this gif, and the pathing only stops because of friction preventing the stick from being pushed.

I’m attempting to use a navMeshObstacle to solve this problem. And indeed, the stick in the above image DOES have a navmesh obstacle component added, but as can be clearly seen, it doesn’t seem to do anything. The exact same problem occurs if i order the dog to move to a spot on the far side of the stick . it seems to just entirely ignore obstacles, and draws a straightline path to the target spot.

Here’s the inspector panel of the stick;

Now i’ve not tried using Carve yet. I watched the unity tutorial video about NavMeshObstacles, and it does explain that carve will cut a temporary hole in the navmesh. But it’s not clear on exactly WHY you’d want to do or not do that, and the video explicitly shows the pathing around the obstacle working correctly with carve UNCHECKED

Why won’t it work for me? i could do with some ideas

So why would you use carve?
There are many times you would want to use carve. I used to use them for pretty much everything moving, before I switched to A*! In my Simple Option Stack tool available on the asset store, I had to use the builtin Unity navmesh for my example scene. I used carve on all the destructible objects. You can clearly see what it does if you have the navmesh tab open while playing!

So how do you solve your problem?
Correct me if Im wrong: Your dog tries to go to the position of the stick transform? That tricks the unity navmesh agent into thinking the position is accesible on the navmesh. You could use navmeshhit to find the closest point on the navmesh, which would logically mean either of the short sides. Or you could make a child empty gameobject to the stick, and make the agent target this childs position.

If none of this doesn’t work you need to switch pathfinding solution! I always recommend the A* Project by Aron Granberg, because it is so amazingly good. Despite the name, the pro version includes a navmesh system aswell.