Collider dosent detect trigger
Im trying to make character respawn in the starting position if he runs into the trigger but he just does not detect it , the character has rigid body and capsule collider, and the trigger has box collider and is IsTrigger flag turned on, trigger has tag "death" and I tried to program it that way if Character would reach tag "death" then he would return back to his original position where he started from ,I did put them to different layers, and made debug but even if so it don't detect any collider, don't know what to try next , why does trigger not detecting any colliding? using UnityEngine; using System.Collections;
public class Respawn : MonoBehaviour {
private Vector3 startPos;
private Quaternion startRot;
void Start () {
startPos = transform.position;
startRot = transform.rotation;
}
//detect colision with collides
void OnTriggerEnter(Collider col)
{
Debug.Log ("Collision");
if (col.tag == "death")
{
transform.position = startPos;
transform.rotation = startRot;
}
}
}
Your answer
Follow this Question
Related Questions
Destroy object on hover? 1 Answer
Moving an Object Using a Trigger 0 Answers
OnTriggerEnter Message Panel trouble! 0 Answers
OnTriggerEnter and OnTriggerExit called twice despite checking it 1 Answer