/
Bruhh
/
Simulator
Обзор
Документация
Войти
/
Bruhh
/
Simulator
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
BuilderCamera.cs
26 строк
682 B
Bruhh
upload files
04 дек 2025, 08:25
04 дек 2025, 08:25
838886c
Код
Авторство
О чём код?
using UnityEngine; public class BuilderCamera : MonoBehaviour { public float mouseSensitivity = 100f; public Transform playerBody; private float xRotation = 0f; private void Start() { Cursor.lockState = CursorLockMode.Locked; } private void Update() { float mouseX = Input.GetAxis("Mouse X") * mouseSensitivity * Time.deltaTime; float mouseY = Input.GetAxis("Mouse Y") * mouseSensitivity * Time.deltaTime; xRotation -= mouseY; xRotation = Mathf.Clamp(xRotation, -90f, 90f); transform.localRotation = Quaternion.Euler(xRotation, 0f, 0f); playerBody.Rotate(Vector3.up * mouseX); } }