mirror of
https://github.com/Project-Redacted/project-hampter.git
synced 2025-06-02 16:53:15 +00:00
Upload Game
This commit is contained in:
parent
b3f494d5c2
commit
18b63ffa9b
150 changed files with 85782 additions and 0 deletions
46
Assets/Movement/PlayerCam.cs
Normal file
46
Assets/Movement/PlayerCam.cs
Normal file
|
@ -0,0 +1,46 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class PlayerCam : MonoBehaviour
|
||||
{
|
||||
public float sensX;
|
||||
public float sensY;
|
||||
|
||||
public Transform orientation;
|
||||
|
||||
float xRotation;
|
||||
float yRotation;
|
||||
|
||||
float mouseX;
|
||||
float mouseY;
|
||||
private void Start()
|
||||
{
|
||||
Cursor.lockState = CursorLockMode.Locked;
|
||||
Cursor.visible = false;
|
||||
|
||||
}
|
||||
private void Update()
|
||||
{
|
||||
mouseX = Input.GetAxisRaw("Mouse X") * Time.deltaTime * sensX;
|
||||
mouseY = Input.GetAxisRaw("Mouse Y") * Time.deltaTime * sensY;
|
||||
//}
|
||||
//private void FixedUpdate()
|
||||
//{
|
||||
|
||||
|
||||
yRotation += mouseX;
|
||||
|
||||
xRotation -= mouseY;
|
||||
xRotation = Mathf.Clamp(xRotation, -90f, 90f);
|
||||
|
||||
transform.rotation = Quaternion.Euler(xRotation, yRotation, 0);
|
||||
orientation.rotation = Quaternion.Euler(0, yRotation, 0);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue