I’ve set up a scene to more easily showcase what’s happening
Gif of what’s happening: https://gyazo.com/166d8e7dfe7e3856cab366a35fac7e61
Screenshot of my grid: https://gyazo.com/ff5353a833d71e7361114dfdad89883e
As you can see, the seeker phases through the wall a little bit. The 2D box collider matches the seeker perfectly but still it goes through the wall. I’ve checked 2D and 2D physics. Do i need to set up something else for my AI characters to not do this?
I also noticed, if there’s a tiny crack between two obstacles the seeker will go through it. Even though the crack is way smaller than the seeker’s collider (by also making the node size smaller)
The navmesh (grid in this case) surface represents all points where it is valid for the agent’s center to be. In your case the grid edge lines up perfectly with the obstacle edge which means that the agent will think it is valid for its center to be right next to the obstacle. I would suggest that you increase the Collision Testing -> Diameter setting (or alternatively the ‘erosion’ setting) to create a small margin around the obstacles.
Pathfinding in itself does not take into account the colliders of the agent as that would be extremely bad for performance (in particular with many different agents), it is assumed that the pathfinding grid is already shrunk by approximately the agent radius.
If you attach for example a CharacterController to the agent, then it will respect physics, however by default when no physics components are attached then it does not care about physics except by using a raycast to position it on the ground. This is good enough or often even desired in most cases and is beneficial for performance then.
The reason however that using just physics is not enough however is that the agent needs to try to move somewhat reasonably. It does not look very good if the agent bumps into obstacles all the time even though physics would prevent the agent from intersecting the obstacle. See the videos here for example: https://arongranberg.com/astar/docs/aipath.html#pickNextWaypointDist
Ah I see!
I got confused I guess. In the tutorials, both video and text, you’re using raycast for the 2D example. Since raycast are no longer an option using 2D (only point and circle) i thought maybe i had to set something up differently from how you do it in the tutorials. But now I get how it works!
I’ll mess around with the diameter. Having AI characters in different sizes will prove to be an issue probably though. Since it’s using the mid-point of each AI. Unless there’s already a solution for this that i might’ve missed?
Oh I do? Hm… I should probably change that.
You can take a look at this tutorial: https://arongranberg.com/astar/docs/multipleagenttypes.html
Which text tutorial are you referring to here?
At around 2 minutes of this video. https://www.youtube.com/watch?v=i1Lo_WI_YOQ&t=171s I understand that this video is kinda old and outdated haha. I’m sure a lot of changes have been made.
And then also here: https://gyazo.com/999f0c28da46821385f03e9c741bcab8
Under “Pathfinding in 2D” in your documentation.
I might be confused with what you mean with Raycasting there?
Also, great tutorial about different sized agents! I can’t see how i will be held back in any way now ^^ Tack!