|
I have a parent GameObject with a script and a child named Colliders which has several GOs with colliders in it:
My test is the following: Set both colliders to non trigger: OnCollisionEnter gets called in the script. Set both colliders to trigger: OnTriggerEnter DOES NOT gets called in the script. Any ideas why could this be happening ?
(comments are locked)
|
|
Ok, I got it. Short answer is, because Unity works like that. Long answer: OnCollision* works different than OnTrigger. OnCollision is being executed by the engine when any collider of any child collides with anything, because the parameter is aCollision which holds both colliding colliders in every contact point. This way you can actually know which collider(s) of your childs has been touched. This is different in OnTrigger*, since the parameter is aCollider (that is the OTHER collider), the only place where it is executed its on the collider´s container GO, because otherwise you wouldn´t have a way to know which collider from your child has been touched. Hope this clears things up for somebody. Agustin
(comments are locked)
|
