This raycasts-based mechanic was created by Matheus Reis.
Indie Game Developer and the creator of Vanaris Tactics, a tactical turn-based RPG released in August 2022, Matheus Reis, a.k.a. retromaten, has recently published a couple of impressive demos showcasing a neat collision avoidance game mechanic set up in Unity using raycasts.
According to the developer, the rays update every 10 frames and allow the in-game entities to avoid hitting one another, with the circle itself representing the tolerance of the characters. "Whenever they stop because there's no good direction to move in, they decrease the tolerance, as they'd be getting more nervous," said the creator.
"I cast a ray w/ a length of 2 in each direction and see how far it goes. The ratio between the ray.distance and max distance (2) returns something between 0 and 1," commented the developer. "The remainder (1 - base priority) is passed to neighbors: 50% to X+-1, and 25% to X+-2 ones. The amount of priority they lose by "borrowing" the priority loss from their neighbors is represented by the white part in the line."