Been looking everywhere and tried over 10 scripts… Not sure why it ain’t working?
I just want this Trigger Box Collider to destroy the Player if he enter it…
Or preferably, play a “Death” animation before being destroyed.
Any simple way to do this? Current script is this but not working:
public class DeathBoxCollider : MonoBehaviour
{
// Use this for initialization
void Start()
{
}
// Update is called once per frame
void Update()
{
}
void OnCollisionEnter(Collision otherObj)
{
if (otherObj.gameObject.tag == "Player")
{
Destroy(gameObject, .5f);
}
}
Kinf of working… When I enter the box collider I destroy the box collider… So I want it the opsoite way…
Like, destroy “player” instead… Any idea how? Thanks tough!