- Home /
Colliders not interacting
Hey guys just a quick question about Colliders in my scene,
I have a simple space station tagged as "Station" with an empty game object as a child, which has a box collider marked as a trigger on it.
and a laser prefab tagged as "projectile" with an empty game object as a child, which has a capsule collider marked as trigger on it
usually this would be fine, although for some reason they are refusing to interact with each other using the following. on the Station
function OnTriggerEnter (other : Collider) { if(other.gameObject.tag == "Projectile") { Debug.Log ("Hello", gameObject); } }
and this on the laser
function OnTriggerEnter(other : Collider)
{
if(other.gameObject.tag == "Station")
{
Explode();
}
}
function Explode()
{
Instantiate(myExplosion, transform.position, Quaternion.identity);
Destroy(gameObject);
}
the laser flies straight through the object, and I dont understand why, when the laser interacts with everything else in the scene fine, including destroying other game objects
Thanks
Do either of your colliders have rigid bodies? Is your projectile set to kinematic or are you moving it through physics?