I’ve been googling for an hour, found alot of scripts, but can’t get any of them to work. The problem is, i’m pretty new to programming and I’m trying to learn it.
Now, I have a Player which is tagged as Player and a trap which i tagged Enemy. I have basic movement for my character. I’m using navmesh aswell.
Should i be adding a collider(box,capsule etc) to my Player and to the Trap? Also if someone could tell me how the script would Exactly look like? Thanks in advance. It’s been bugging me for a few hours now xD. Sucks to be a newbie ^^.
This is what i tried.
using UnityEngine;
using System.Collections;
public class Player : 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);
}
}
}
Last edited: 12 minutes ago