I am trying to detect if a bullet(which has rigidbody and box collider) hit my model(which has CharacterController and a mesh collider) but it doesn't work. If i try the same script on a cube (which also has a CharacterController and a Box Collider) it works perfectly well. I have tried making it a trigger and use OnTriggerEnter but it still doesn't work on the model but also works well on the cube. Here is my code.
function OnControllerColliderHit (hit : ControllerColliderHit)
{
//doesnt work for either of them
if(hit.gameObject.tag == "bullet")
{
print("i have been hit by a bullet");
}
}
function OnTriggerEnter(hit : Collider)
{
//works for the cube and not the model
if(hit.gameObject.tag == "bullet")
{
print("i have been hit by trigger hit ");
}
}
function OnCollisionEnter(hit: Collision)
{
//works for the cube and not the model
if(hit.gameObject.tag == "bullet")
{
print("i have been hit by trigger hit ")
}
}
Collision Detection
property of the bullet rigidbody toContinuous Dynamic
and the model rigidbody toContinuous
? – nwellnhof