microphone listener

This commit is contained in:
ntr committed 2022-02-03 16:12:06 +11:00
1 parent 0e3c85bac3
commit 7691417ebd
9 files changed
+1699 -1318

No files matched your search

+40 -40
View File
@@ -1,40 +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;
}
}
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;
}
}