I have the following objects in a scene:
- Object A: plane mesh with a BoxCollider, IsTrigger = true
- Object B: plane mesh with a BoxCollider (IsTrigger = false) and RigidBody (IsKinematic = true)
- In both objects A and B I override the OnTriggerEnter() method with a simple Debug.Log("Hit: " + other.gameObject.Tag)
- Both planes are across the XY plane and have Z = 1.
I animate the Object B by updating it’s transform.position within the Update() method. Object B moves towards Object A.
Because they are both on Z = 1, I would expect that they will eventually trigger the OnTriggerEnter() method. But this method is never called on either object.
When I ‘play’ the scene, I clearly see Object B animating all the way over Object A.
Any ideas of what could be going wrong here?
According to the documentation a static trigger hitting a rigid body should cause the method to be called.
I also played around by setting the IsTrigger on all sorts of combinations between the two objects and also tried applying a rigid body to both and none of the items. No luck.
Is the trigger supposed to work for a 2D plane? I also tried adding ‘depth’ to the plane but the OnTriggerEnter still doesn’t get called.
Thanks!