Question by
AzadfekrP · May 18, 2018 at 05:57 PM ·
c#collisioncollision detectionmonobehavior
Cube wont destroy on collision
I'm making a game where the player is flying a plane(full rigidbody, colliders) and I have a cube with the following script attached:
using UnityEngine;
using System.Collections;
public class collision : MonoBehaviour
{
void OnCollisionEnter(Collision col)
{
if (col.gameObject.name == "breakableBox")
{
Destroy(col.gameObject);
}
}
}
And what I'm trying to make happen is that once the plane crashes into the cube, the cube disappears. Instead, the plane just bounces off the cube, which is really strange. Basically the cube acts like a concrete box and it doesn't move or get destroyed. How can I fix that?
Comment
Your answer
Follow this Question
Related Questions
Collision or Triggers both not working. 3D. 1 Answer
How To how ?? 2 Answers
Ignore collision based on position 1 Answer
How to make an object that collides with just the player? 1 Answer