I had done my fps game for my college project in that the mesh collider is not working properly
collision is not happening between the bullet of the gun and thewalls
sometimes its colliding but sometimes its not colliding
i dont know the problem is with unity or in my script
this is the script i am using
function Update ()
{
Destroy(gameObject,2);
}
function OnCollisionStay(collision : Collision)
{
if (collision.rigidbody)
Destroy(gameObject);
}
1 -Walls are generally rectangular, so its better to use a box collider and to take care about well sizing it
2 - that script is attached to your bullet ? if so, are you sure about putting Destroy(gameObject,2); in the update function ? that means that your bullet will be destroyed after 2 seconds of its intanciation ! it might be destroyed before reaching the wall ! so no collision !
3 - Its better to use OnCollisionEnter than OnCollisionStay for bullet collision detection (logic implementation)
You should set the collision detection of the Bullet to Continuous and the Mesh collider must be static (without a Rigidbody). Have a look at the documentation for Rigidbodies: Unity - Manual: Rigidbody component reference