# Simple smooth bug wrong path

Hello.

There is a bug (well more like path is being “skipped” due to optimization), but it returns incorrect path for some situations which is a bit limiting for grid graph. In short it optimizes the route, but in that optimization, in rare case where it is on border of two tiles it can “skip” a tile (explained in more detail below)
if there was an option to get “pure” path from tile to tile along with the smooth step this would fix an issue (as I would be able to control it more properly, but as it is at the moment it is a bit unusable like this (yeah i could track if it skipped the path and then default it on the previous path or something but seems a bit hacky)

Anyhow wanted to share how i got it and what happens in case there is some better idea

1.) this is the path that i get
[0] = {Vector3} (19, -0.989177465, 0)
[1] = {Vector3} (19.0122604, -0.0014372064, 0)
[2] = {Vector3} (19.522562, 0.488259733, 0)
[3] = {Vector3} (20.4985619, 0.5, 0)
[4] = {Vector3} (21.0000019, 0.5, 0)

2.) this is coordinates converted into my grid (check picture for positions)
[0] = {Vector2Int} (6, 2)
[1] = {Vector2Int} (6, 2)
[2] = {Vector2Int} (7, 3)
[3] = {Vector2Int} (7, 3)
[4] = {Vector2Int} (8, 3)

I have calculated these values manually to confirm if they are in the “right” range of the slots and i have shown example of it below (was worries i might have misjudged some borderline scenarios or something while calculating it)

Anyhow i was wondering what was happening and i noticed that data was sent incorrectly. Turning off simple smooth fixed it and i guess for my test case it is OK to not use it but wanted to show the problem.

I mean it happens in a weird way tho. i selected my units and sent them between 6,2 and 7,3 by clicking back and forth.

ONLY when they are near the edge of two tiles this bug can happen (i had to click maniacally when units are near it)

having learned from previous mistake i checked the settings and voila, the traitor was in my midst all along

Message me if I can help somehow further otherwise can close as I will continue without the smoothing option for now

P.S. (used Simple smooth, checked uniform lenght, max segment length and iterations = 1and strength = 0.048)

EDIT: this probably works good for most cases, but in my case i have to move from tile to tile - and smoothing seems to take shortcuts which don’t work for me (in my case i need to know exact route the unit goes because when he goes from tile to tile i check for doors.

Hi

The smoothing just does a pure geometric smoothing of the path. With enough smoothing it will not traverse the exact same nodes as in the input. This is by design.

If you need to move from tile to tile then I think the simple smooth modifier is definitely not something you should use.

I’m not quite sure what you want to get out from the smooth modifier considering your agents need to mvoe from tile to file exactly following the path?

1 Like

it just looked more natural with some smoothing But as i changed my theme to more robotic crew no smoothing will do just fine.

Having thinked about it it does make sense that this would cause issues for my project but makes sense for everything else.

Thank you

1 Like