In my Top Down 2D Game the Character can travel between rooms through small corridors.
For the corridor it would be needed that the character moves only on walkable Tiles, but sadly the character actually cuts partially the way and travel just through the walls because its the shortest way.
Is there a possiblity to let a Character only move on walkable Tiles, like in the “AI Lerp” Script but with an more realistic looking move like in “AI Path” ?
I also tried AI Lerp with Smoothing, but i would prefer Ai Path much, much more if possible …
There are several ways to address this issue.
The video tutorial here: https://youtu.be/i1Lo_WI_YOQ?t=4m7s shows 2 ways.
You can also disable the ‘Cut Corners’ option in the grid graph settings.
Thx a lot !
it works better now, but now there is just another issue.
If i´m reducing “Pick Next Waypoint Distance” the character starts to shake when he comes nearer to the target, a kind of spinning aorund the target …
Ah. Yeah such oscillations can happen if the pick next waypoint distance is reduced too much. Try not to reduce it that much.
ok thx a lot ! now it works fine …
It works now, but it has some disadvantages. For example to make the grid finer, reduces also its maximum size, so maybe as an suggestion.
- The object should be only allowed to walk on walkable tiles, if the path crosses unwalkable parts the length of the calculated path is automatically reduced and new calculated until the path only hits walkable Tiles … Well, no idea if this would work
You can adjust the ‘Diameter’ setting in the Grid Graph -> Collision Testing section. By default it will check for obstacles within a circle with a diameter of exactly 1 node. If you increase it then you will get a larger margin from the wall.
This is also show in the second half of the video tutorial I linked above.
Yes i did this, but originally i have an passage only with a width of one Tile, so increasing the Diameter makes the passage unwalkable.
So i have to separate the Tiles into smaller ones to work wit increased Diameters, with the disadvantage of making the whole grid smaller …
Is there a easy way to force Characters to move only on Walkable Tiles?
Could you post a screenshot or video showing the current issue?