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
2023-06-15 15:26:12 +05:30

54 lines
1.6 KiB
C#

using UnityEngine;
using FishNet.Object;
using FishNet.Connection;
namespace Player
{
public class CameraController : NetworkBehaviour
{
//private float mouseX = 0;
//private float mouseY;
public 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;
}
}
}