So, I’m making my first game, and when I hop into playmode, the code I wrote isn’t doing what I want it to do. It’s a first person camera controller. I’m new to unity, so that might be the reason why my code sucks.
I made some code for a basic camera controller, but when I go into the game, it doesn’t want to work. I’m new to unity, so there are probably some major problems with it. Here’s the code, BTW…
public float sensX;
public float sensY;
public Transform orientation;
float xRotation;
float yRotation;
private void Start()
{
Cursor.lockState = CursorLockMode.Locked;
Cursor.visible = false;
}
private void Update()
{
//get mouse input
float mouseX = Input.GetAxisRaw("Mouse X") * Time.deltaTime * sensX;
float mouseY = Input.GetAxisRaw("Mouse Y") * Time.deltaTime * sensY;
yRotation += mouseX;
xRotation -= mouseY;
}
}