This repository has been archived on 2023-09-13. You can view files and clone it, but cannot push or open issues or pull requests.
station_obscurum_unity/Assets/Scripts/Player/CameraController.cs

49 lines
1.4 KiB
C#
Raw Permalink Normal View History

2023-03-14 00:59:59 +01:00
using UnityEngine;
public class CameraController : MonoBehaviour
{
//private float mouseX = 0;
//private float mouseY;
2023-06-01 17:03:48 +02:00
[SerializeField] private Camera cam;
[SerializeField] private Transform target;
2023-03-14 00:59:59 +01:00
private Vector3 offset;
2023-06-01 17:03:48 +02:00
public Vector3 Forward { get; private set; } = Vector3.zero;
2023-03-14 00:59:59 +01:00
2023-06-01 17:03:48 +02:00
public Vector3 Right { get; private set; } = Vector3.zero;
2023-03-14 00:59:59 +01:00
//private float originalDist = 0;
//private float newDist = 0;
//[SerializeField]
2023-06-01 17:03:48 +02:00
// private bool isChild = false;
2023-04-08 07:23:11 +02:00
2023-03-14 00:59:59 +01:00
// Start is called before the first frame update
2023-06-01 17:03:48 +02:00
private void Start()
2023-03-14 00:59:59 +01:00
{
}
// Update is called once per frame
2023-06-01 17:03:48 +02:00
private void Update()
2023-03-14 00:59:59 +01:00
{
GetMouseLook();
//if(target!=null&&!isChild)
//transform.position = target.transform.position+offset;
2023-06-01 17:03:48 +02:00
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);
2023-03-14 00:59:59 +01:00
}
2023-06-01 17:03:48 +02:00
2023-03-14 00:59:59 +01:00
private void GetMouseLook()
{
//mouseX = Input.GetAxis("Mouse X");
//mouseY = Input.GetAxis("Mouse Y");
2023-06-01 17:03:48 +02:00
2023-03-14 00:59:59 +01:00
//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;
2023-03-14 00:59:59 +01:00
}
2023-06-01 17:03:48 +02:00
}