Procedural Grid Mover moves Agents on transform updates when Update Distance is greater than Node Size

The Procedural Grid Mover component will sometimes offset agents when it updates the graph center. This only occurs when Update Distance is greater than Node Size. This causes visible stutter-y teleportation and resultant physics issues.

The issue is quite inconsistent. The agents affected seem chosen at random, though occasionally, there seem to be patterns as nearby agents are affected together (related by heirarchy order? unsure of cause). Smells like a race condition to me.

Agents are moved a consistent distance - seems to be related to the node size.

I’ve only tested this on a grid graph. Unsure whether it’s a problem on other shapes.

A simple workaround is to lower the update distance on the procedural grid mover. In my case, I am using node size 0.5, so I lowered update distance to 0.1. This will attempt to update the graph every frame, but because it is constrained to moving it only on intervals of 0.5, the performance of this is a non-issue.

Reproduction steps:

  1. Create an object with a Pathfinder component. Add a grid graph with properties like the following (of particular importance, Node Size must be small):

  2. Attach a Procedural Grid Mover component to the Pathfinder and set the Update Distance larger than the grid’s Node Size. Assign the target to something easy to move for testing (for me, that’s the player).
    image

  3. Create an AI agent (my issue occurs on an agent with an AIPath, a Seeker, a Raycast Modifier, and a Simple Smooth). I can provide the properties for these if needed - I’m only allowed to use two images on this post :stuck_out_tongue:

The path destination for my agent is set by a custom script, but for reproduction purposes this is irrelevant, as this issue occurs regardless of whether the agent has a path.

  1. Scatter like ~200 duplicate agents around to make the effect more obvious.

  2. Enter playmode and move the procedural grid mover’s target. Watch the pathing agents as the graph offset updates.