wtf is going on with mulitbar

This commit is contained in:
unknown committed 2022-01-23 23:49:39 +11:00
1 parent a7c2f40c1b
commit 0033273018
22 files changed
+10497 -2323

No files matched your search

+40
View File
@@ -0,0 +1,40 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Cinemachine;
public class CameraController : MonoBehaviour {
private Vector2 mousePos;
private Vector2 worldSize;
private float mouseSens = 200f;
private float moveSpeed = 100f;
void Start() {
mousePos = Input.mousePosition;
}
void Update() {
// Camera Rotation
if (Input.GetMouseButton(0)) {
float yawDelta = mouseSens * Time.deltaTime * Input.GetAxis("Mouse X");
float pitchDelta = mouseSens * Time.deltaTime * Input.GetAxis("Mouse Y");
pitchDelta = Mathf.Clamp(pitchDelta, -90f, 90f);
transform.Rotate(Vector3.up * yawDelta, Space.World);
transform.Rotate(Vector3.left * pitchDelta);
}
// Camera Movement
if (Input.GetMouseButton(1)) {
Vector2 delta = new Vector2(
(Input.mousePosition.x - mousePos.x) * moveSpeed * Time.deltaTime,
(Input.mousePosition.y - mousePos.y) * moveSpeed * Time.deltaTime
) * -1;
transform.position += new Vector3(delta.x, delta.y, 0.0f);
}
mousePos = Input.mousePosition;
}
}