- Home /
How to have multiple colliders intersect without colliding with each other?
Hello everyone!
I am developing a kid's driving game. I have a small city map, and I added colliders to empty game objects giving the shape of the buildings/obtacles and avoid using mesh colliders.
For most of the cases, the colliders intersect, check picture1
The empty gameobject(EGO) has also rigidbody component attached (for collision to occur). As I run the game, a mess happens and the colliders collide with each other(natural to happen, since they are touching each other) see pictue2
now I solved this with a non-efficient method. I had all EGOs as a child to another parent EGO named "colliders". I duplicated colliders, made all the child colliders to be triggers and added rigidbody component.
Hence the colliders serve as colliders, and I check the collision by OnTriggerEnter, since there is a trigger at the same position(its duplicate).
Is this the way its going to be? How to use colliders in an optimal way?
Answer by kramcomposer · Mar 04, 2013 at 05:40 PM
If you don't intend for those objects to move, you should remove rigidbody from the collider(s), Other rigid body will still interact with them as if they were brick walls.
You can also Put all those ground objects On a Layer Called: Obsticals, and your cars to use a layer called: Cars..
Then Click on [Edit] -> [ProjectSettings] -> [Physics] And then make it so Obsticals do not interactice with Obsticals
thx dude, but can you explain more what to do in the project Settings < physics ?
Your answer
Follow this Question
Related Questions
Performance issues with trigger colliders and lots of projectiles. 2 Answers
OnTriggerEnter2D triggering multiple times when moving around inside the trigger area. 1 Answer
Having problems with playing a sound (C#) 2 Answers
Does OnTriggerStay don't detect a collision with a non-trigger collider? 1 Answer
Problems with the Trigger Collider (randomly fictional) 1 Answer