33 lines
850 B
C#
33 lines
850 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class CameraChanger : MonoBehaviour
|
|
{
|
|
Vector3 oldTransform;
|
|
|
|
void OnTriggerEnter(Collider other){
|
|
if (other.tag == "Player"){
|
|
Debug.Log("it in");
|
|
oldTransform = Camera.main.transform.position;
|
|
}
|
|
}
|
|
|
|
void OnTriggerStay(Collider other){
|
|
if (other.tag == "Player"){
|
|
Debug.Log("still in");
|
|
float x = other.gameObject.transform.position.x;
|
|
float z = other.gameObject.transform.position.z;
|
|
//Camera.main.transform.position = new Vector3(x,25,z);
|
|
}
|
|
}
|
|
|
|
void OnTriggerExit(Collider other){
|
|
if (other.tag == "Player"){
|
|
Debug.Log("its gone");
|
|
//Camera.main.transform.position = oldTransform;
|
|
}
|
|
}
|
|
|
|
}
|