- Home /
Why is this rigidbody not activating the trigger?
See the screenshots below. Both the crate and the teddy bear objects land on the *Grounds, but only the crate gets destroyed by the DESTROYER plane. Am I missing something really obvious?
DESTROYER trigger code:
using UnityEngine;
public class destroytrigger : MonoBehaviour {
void OnTriggerStay (Collider other) {
Destroy(other.gameObject);
Debug.Log("object destroyed");
}
}
The first image shows that when the three floating object fall to the ground, the center object "test bear" does not get destroyed like the other two do. You can also see in the corners that an identical crate and bear land on the ground just fine (when they don't pass through DESTROYER, that is).
I have a couple of guesses. You've marked your bear collider as 'convex', but convex colliders are limited to 255 triangles. It looks like your bear has more than 255 triangles. Also is your plane marked as convex? Consider putting a box collider rather than a mesh collider on the plane. That way the bear does not have to be convex.
Furthermore try to use OnTriggerEnter(). Also as far as I understand this: the objects do not have to interact with the ground right? So you may try to mark the colliders as triggers (checkbox).