I have a car with 4 invisible cubes as colliders INSIDE it (the car is a rigidbody), and I want for example the front box collider to hit a wall and perform a specific function inside the car (enable an object, etc…), and so on with others colliders. Here a photo:
If you have multiple colliders on a Gameobject they behave as “merge” into one collider, as in: You can not differentiate between the different colliders inside
OnCollisionEnter(). You need to make a separate child object for each collision zone. To differentiate between the different zones you have different functionality inside the
OnCollisionEnter() of the child game objects.
Note: Unless each child has it’s own rigidbody, where you lock rotation and position to “disable it” as much as possible, the
OnCollisionEnter() inside the parent will also be triggered with each collision. The
OnCollisionEnter() event will essentially move up the hirachy until it reaches a game object with a rigidbody component.