I’m in a very simple script, and i got a problem with collision:
When the object collide with the player, it will be destroyed. And the problem was: The object have box collider and rigid body, so it is in the ground. When the player collides, the object do not detect the collision with the player, because it is in a collision with the ground (i think ). I tried to let the object fall in the player head, and it worked.
Here is the Script:
function Start () {
}
function Update () {
}
function OnCollisionEnter (collision: Collision)
{
if (collision.gameObject.tag ==“Player”)
{
Destroy(gameObject);
}
}
Thank you for the attention, and sorry for my bad english.