Hello
I’m having problems detecting colliders inside a BoxCollider that is a trigger.
What i have is a GameObject with a Rigidbody and a BoxCollider attached to it. The RigidBody has isKinematic set to true and the BoxCollider has the isTrigger set to true and i’m creading those dynamically on Start().
Collider collider = gameObject.collider ? gameObject.collider : gameObject.AddComponent<BoxCollider>();
collider.isTrigger = true;
((BoxCollider)collider).center = m_simulationDomain.center;
((BoxCollider)collider).size = new Vector3(m_simulationDomain.width, m_simulationDomain.height, 1);
Rigidbody rigidBody = gameObject.rigidbody ? gameObject.rigidbody : gameObject.AddComponent<Rigidbody>();
rigidbody.isKinematic = true;
rigidbody.useGravity = false;
I have a script on the GameObject that catches “OnTriggerEnter” and prints the collider that triggered it.
My problem is that if i create any object with a BoxCollider inside the base Gameobject collider i get no trigger message. If i change the isKinematic to false it will detect the colliders already inside but any other collider that will be creaded or enter it afterwards will not be detected.
I have also tried with Collisions by setting the isTrigger to false and catch “OnCollisionEnter” still the same problem.
Am i missing something here?
I have attached a sample project that shows this behavior. 1423068–75062–$TriggerTest.zip (17.2 KB)
Thanks
Gilberto