Hello to all!
Sorry if this is kind of a noobish question, but I want to know which is the best way to set the NPC so that my Player does not step over them (I'm creating a 2D Point and Click game, using Polygon Collider, pretty much as the 2d demo).
I know I can make holes on the NavMesh on the spots in which the NPC stand, but this only works (to my knowledge) if the NPC is static. If I want to avoid moving NPC, do I have to switch to Unity's NavMesh and use the NavMesh Obstacle?
Also, back to the Polygon Collider, should my player have a Circle Collider 2D at his feet to avoid the holes or whatever I use? Or should the NPCs be the ones with the circle collider? (or both?)
Thanks in advance!
Comments
Your NavMesh's Inspector has a Character evasion option - for performance reasons, this is set to Stationary Characters Only by default, but you can set it to All Characters to affect moving ones as well.
For character evasion to work, all characters in question (both Player and NPCs) must have Circle Collider 2Ds at their base on their root object. You will also need to set a non-zero Pathfind update time (s) in the Settings Manager for characters to recalculate evasion paths.
They will also need to be at the character's origin - i.e. where the Audio icon / yellow circle are. Set their Centre values to (0,0,0) and reduce the radius by at least half and see if things improve.
Know that if you enable "Gizmos" in the Game window while playing, you should be able to see the NavMesh update in realtime as holes are automatically generated.