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

54 lines
1.6 KiB
C#
Raw Normal View History

2023-03-14 00:59:59 +01:00
using UnityEngine;
using FishNet.Object;
using FishNet.Connection;
2023-06-01 20:25:46 +02:00
namespace Player
2023-03-14 00:59:59 +01:00
{
public class CameraController : NetworkBehaviour
2023-06-01 20:25:46 +02:00
{
//private float mouseX = 0;
//private float mouseY;
2023-06-15 11:56:12 +02:00
public Camera cam;
2023-06-01 17:03:48 +02:00
2023-06-01 20:25:46 +02:00
[SerializeField] private Transform target;
2023-06-01 20:25:46 +02:00
private Vector3 offset;
public Vector3 Forward { get; private set; } = Vector3.zero;
2023-03-14 00:59:59 +01:00
2023-06-01 20:25:46 +02:00
public Vector3 Right { get; private set; } = Vector3.zero;
2023-03-14 00:59:59 +01:00
2023-06-01 20:25:46 +02:00
//private float originalDist = 0;
//private float newDist = 0;
//[SerializeField]
// private bool isChild = false;
2023-06-01 20:25:46 +02:00
// Start is called before the first frame update
private void Start()
{
}
2023-03-14 00:59:59 +01:00
2023-06-01 20:25:46 +02:00
// 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);
}
2023-06-01 17:03:48 +02:00
2023-06-01 20:25:46 +02:00
private void GetMouseLook()
{
//mouseX = Input.GetAxis("Mouse X");
//mouseY = Input.GetAxis("Mouse Y");
2023-06-01 17:03:48 +02:00
2023-06-01 20:25:46 +02:00
//transform.Rotate(0, mouseX * Time.deltaTime * 180f, 0);
//cam.transform.parent.parent.transform.Rotate(mouseY * Time.deltaTime * 180f, 0, 0);
2023-03-14 00:59:59 +01:00
2023-06-01 20:25:46 +02:00
//Cursor.visible = false;
//Cursor.lockState = CursorLockMode.Locked;
}
2023-03-14 00:59:59 +01:00
}
2023-06-01 20:25:46 +02:00
}