- Home /
The question is answered, right answer was accepted
Trigger on OnCollisionEnter
I have the current situation: - One collider is a creature and has a child object with a trigger collider, bigger than the parent collider, which is a aura to interact with the surroundings. - Another object with a collider is a chaser, and will attack the creature on the collider's touch. - Both objects have rigidbodys (not the child with trigger), and all the layers are setted to default.
However, even with the chaser pushing the creature all over the scenario, the OnCollisionEnter/Stay is not called with the creature's collider, instead it is called with the creature's child trigger. If I turn off the child object then the event is called with the correct collider. So, the child trigger is blocking the collision with the collider, but, since it's a trigger, it should not have this problem, right? Someone can explain me this?
I am using Unity 4.2.0f4, currently downloading the new version.
Thank you in advance.
EDIT: found the solution, I was getting the object of the collision with collision.collider which returned the collidsor of the wrong object. Getting with collision.transform fixed this issue. I will leave this here for future references.
Oh thank god. This was driving me nuts. Great find on the fix. Hopefully they fix this bug at some point.