Hello there! I’m having troubles with colliders, I’m not an english native speaker so sorry if I make a mistake, so this is my problem:
I have an enemy elf (Elfito Verde) that has his own Rigidbody and his own Collider2D. I created an empty child object (Detector Enemigo) that has another collider that is a trigger and its bigger than the elf collider because I want its collider to detect the player’s character. They both have different scripts, the elf has a script that use OnCollisionEnter2D() to detect collisions and change its movement to the other side, and the other has a OnTriggerEnter2D to detect the player and attack.
Now my first problem was that both colliders activate the OnCollisionEnter2D() and my elf turn around when the biggest collider find the player. So I search and I found that I should use a kinematic Rigidbody to make the parent and the child’s colliders to not work as a compound collider, so I did that. My problem is that even with a Rigidbody attached to the child gameobject, the colliders still works as a compound collider.
How can I make the child collider to work individualy and not as a compound collider?
No quería tener que hacer eso porque tendría que cambiar un montón de cosas del script del elfito por eso buscaba una mejor solución, pero parece que tendré que hacerlo.
Pero es más lento y consume más recursos, no te lo recomiendo. Échale un vistazo a la estructura ContactFilter2D. Te puede servir para hacer tus propios OnTriggerEnter personalizados.