Hello, my 2d (topdown view) game works great with DIRECT control. But when I switch to Point and Click, the character walks through objects even when they have a box collider. In Direct control the character cant walk through the objects. What I am doing wrong?
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
You must define a NavMesh for characters to be able to pathfind.
In 2D scenes, this is a case of creating a Polygon Colider that describes the shape of the walkable area, and assigning it as your NavMesh (tutorial here).
In 3D scenes, it's a case of baking a Unity NavMesh (tutorial here).
Thank you. I did all this and even created a hole in the navmesh but this my character walks straight through. I recorded a video.
https://www.loom.com/share/a0109874645f4a93b70a762448ec64c2
The character appears to walk around the hole, so far as I can tell - which aspect are you referring to?
When using a 2D NavMesh, the character does not factor in his width - if the NavMesh covers an area, he'll be able to walk there.
If you want to prevent him from walking around the left side of the shelf, remove the hole and have the NavMesh come out over the shelf so that it covers the shelf and the gap to the left of it.
Thank you that worked.