Hi,im actually working on a little game(a parkour game more specificaly) and i try to make a chekpoint system but im facing a difficulty. My system work that way, there a big trigger on the bottom of the map and if you fall in it, the position of the player change to the start of the level. Now i try to make the first chekpoint this way: when he the player enter the trigger, the restart position if the player fall in the trigger at the bottom of the map change to another position not to the start of the level. But i cant figure how to change that position(3 variable 1 for the y 1 for the z and one for the x) using another script. I read many documentation and question but this dont help solve my problem. Heres the dead zone(ZoneDeMort.js)
var Joueur:GameObject;
@HideInInspector
public var JoueurY:float=1.315027;
@HideInInspector
public var JoueurX:float=5.94885;
@HideInInspector
public var JoueurZ:float=-1.150034;
function Start () {
}
function Update ()
{
}
function OnTriggerEnter()
{
Joueur.transform.position=Vector3(JoueurX,JoueurY,JoueurZ);
Debug.Log("le joueur est entrer");
}
and here the chekpoint empty (Chekpoint1.js)
function Start () {
}
function Update () {
}
function OnTriggerEnter()
{
var Joueury=gameObject.GetComponent(ZoneDeMort);
Joueury.JoueurY=0;
}
I try something but that didnt work when i enter the trigger it says NullReferenceException: Object reference not set to an instance of an object