- Home /
Question by
gargd · Oct 25, 2017 at 04:46 PM ·
collisiongameobjects
How to stop GameObjects from colliding with one another?
Hi I am creating a traffic simulator on unity. I've got vehicles randomly getting instantiated but I couldn't figure how to stop them from colliding with one another. How can I make them maintain a safe distance from one another?
Comment
Answer by jchester07 · Oct 26, 2017 at 03:50 AM
Use raycast to detect proximity. Adjust its speed when getting close.
You could use this as a reference Using raycast to determine if player is grounded.
There is also an alternative: Rigidbody.SweepTest
Your answer
![](https://koobas.hobune.stream/wayback/20220612141829im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Dictionary with GameObject as key is updating values under other keys 1 Answer
How to handle collisions for LODs with different submeshes? 1 Answer
Object "crawling" over floor, how? 2 Answers
Make my gameobject bounce 0 Answers
Vibrating GameObjects 0 Answers