StationObscurum/Assets/Scripts/Player/CameraController.cs
2023-06-01 08:03:48 -07:00

49 lines
1.4 KiB
C#

using UnityEngine;
public class CameraController : MonoBehaviour
{
//private float mouseX = 0;
//private float mouseY;
[SerializeField] private Camera cam;
[SerializeField] private Transform target;
private Vector3 offset;
public Vector3 Forward { get; private set; } = Vector3.zero;
public Vector3 Right { get; private set; } = Vector3.zero;
//private float originalDist = 0;
//private float newDist = 0;
//[SerializeField]
// private bool isChild = false;
// Start is called before the first frame update
private void Start()
{
}
// Update is called once per frame
private void Update()
{
GetMouseLook();
//if(target!=null&&!isChild)
//transform.position = target.transform.position+offset;
Forward = new Vector3(cam.transform.forward.x, target.transform.forward.y, cam.transform.forward.z);
Right = new Vector3(cam.transform.right.x, target.transform.right.y, cam.transform.right.z);
}
private void GetMouseLook()
{
//mouseX = Input.GetAxis("Mouse X");
//mouseY = Input.GetAxis("Mouse Y");
//transform.Rotate(0, mouseX * Time.deltaTime * 180f, 0);
//cam.transform.parent.parent.transform.Rotate(mouseY * Time.deltaTime * 180f, 0, 0);
//Cursor.visible = false;
//Cursor.lockState = CursorLockMode.Locked;
}
}