LieutenantChampignon/Projet Unity/Lieutenant Champignon/Assets/Scripts/Teleport.cs

18 lines
505 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Teleport : MonoBehaviour
{
[SerializeField]
private Vector3 destination;
private void OnTriggerEnter(Collider other) {
if(other.tag == "Player") {
other.gameObject.GetComponent<CharacterController>().enabled = false;
other.gameObject.transform.position = destination;
other.gameObject.GetComponent<CharacterController>().enabled = true;
}
}
}