#new Code

1 messages · Page 1 of 1 (latest)

indigo kernel
#

public class CameraMovement : MonoBehaviour { public float sensX; public float sensY; public Transform orientation; float xRotation; float yRotation; bool invoke = true; private void Start() { Cursor.lockState = CursorLockMode.Locked; Cursor.visible = false; } private void Update() { if(invoke == true) { Invoke("MoveCamera", 2); invoke = false; } else { MoveCamera(); } } private void MoveCamera() { float mouseX = Input.GetAxisRaw("Mouse X") * Time.deltaTime * sensX; float mouseY = Input.GetAxisRaw("Mouse Y") * Time.deltaTime * sensY; yRotation += mouseX; xRotation -= mouseY; xRotation = Mathf.Clamp(xRotation, -85f, 85f); transform.rotation = Quaternion.Euler(xRotation, yRotation, 0); orientation.rotation = Quaternion.Euler(0, yRotation, 0); } }

surreal delta
#

Most readable code award goes to 🥇

uneven leaf
#

@indigo kernel can you put it in code block format

indigo kernel
#

i didnt even realize that it was that bad