using UnityEngine;
using System.Collections;
public class PlayerDeath : MonoBehaviour {
private Vector3 spawn;
// Use this for initialization
void Start () {
spawn = transform.position;
}
// Update is called once per frame
void Update () {
}
void onCollisionEnter (Collision obj) {
print ("Hit");
if (obj.gameObject.name == "Enemy") {
transform.position = spawn;
print ("Hit Enemy");
}
}
}
based on this video: link
When I hit the enemy I just get pushed away when I am supposed to get teleported back to spawnpoint