logo80lv
Articlesclick_arrow
Research
Talentsclick_arrow
Events
Workshops
Aboutclick_arrow
profile_loginLogIn

Basic Collision Avoidance Mechanic Set Up in Unity

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."

Click here to learn more about the setup. Also, don't forget to join our 80 Level Talent platformour Reddit page, and our Telegram channel, follow us on Instagram and Twitter, where we share breakdowns, the latest news, awesome artworks, and more.

Join discussion

Comments 0

    You might also like

    We need your consent

    We use cookies on this website to make your browsing experience better. By using the site you agree to our use of cookies.Learn more