microphone listener
This commit is contained in:
1 parent
407ff42597
commit
02cb0d182e
9 files changed
+1699
-1318
No files matched your search
+40
-40
@@ -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;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user