What I did to fix this was to change the NPC's Rigidbody 2D mass to something ridiculously high (in my case 10000) and that kept my character from pushing the NPC around (he was just too heavy).
Might have unwanted consequences, but non that I have noticed yet.
If the player's stuck because the NPC is in the way, consider lowering the "Destination accuracy" slider in the Settings Manager - that'll mean the player won't try to be so close to the target when walking.
Hi Chris, this doesn't appear to help. I had this set to 1 and tried lowering as suggested, but even 0.1 and it doesn't change the outcome.
Looking at the path calculated in the scene view at the same time it appears to basically run a path through the NPC to the destination and won't stop until it gets there, which it can't.
well, one workaround would be to change / add a hole to the navmesh where your NPC stands, but i admit its a problem (hence my dumb questions about pathfinding all the time )
For now, until there's a good solution, I've gone in and added holes for the static NPCs I have, but for the ones that are moving around I have just removed the collider entirely. I find it far less jarring to have my character pass through the NPCs as if they were ghosts than have them get stuck in the walking animation.
There's a point in Da New Guys where the player can switch between multiple characters, who may or may not be on the same screen. Because the player had total freedom of control, it was possible to place one character in front of a doorway, switch character, and then find yourself unable to leave because the doorway was then blocked.
To counter it, I wrote a script that caused the NPC to move away by small small amount if the player got too close. Would something similar be appropriate here? Since that was a 2D game, the character would move towards the centre of the screen if they were on the edge, to prevent them walking off-screen. Not sure how that would translate to 3D.
Chris, I think in terms of solving the infinite walking problem that perhaps a solution of recalculating the path to destination when colliding, where the calculation takes into consideration the collider's collision area. If the only path found results in going through the collider's collision area or outside the nav mesh, then stop the character exactly where he is.
More difficult but I think it solves it for good. I was thinking of doing a script that stops the player when hitting collision but the side effects would be horrible.
Also as for the pushing issue you could also remove the RigidBody2D but keep a collider on the NPC.
In 1.40, NPCs will be able to move out of the way if the player gets too close. That's a nice solution @WillG, but quite a complex one. It won't be in for 1.40, but perhaps a later release.
Comments
To counter it, I wrote a script that caused the NPC to move away by small small amount if the player got too close. Would something similar be appropriate here? Since that was a 2D game, the character would move towards the centre of the screen if they were on the edge, to prevent them walking off-screen. Not sure how that would translate to 3D.
More difficult but I think it solves it for good. I was thinking of doing a script that stops the player when hitting collision but the side effects would be horrible.
Also as for the pushing issue you could also remove the RigidBody2D but keep a collider on the NPC.