- Home /
How to make the basic mouselook look all the way up and down?
I am a noob who downloaded unity for practice, and right now I tweak the basic codes to practice and I cant seem to make the fps controller (mouselook) to look all the way up, or all the way down, and its bugging me.
I changed this,
public float minimumY = -90F;
public float maximumY = 90F;
but it didn't make any difference. I even changed it to 180, if someone posts an answer can you also tell me how it works?
Answer by aldonaletto · Nov 12, 2013 at 03:45 AM
Maybe you're modifying the wrong MouseLook: there are two scripts, one attached to the player (which only rotates horizontally) and the other attached to the camera - this one rotates the camera up and down, and checks minimumY and maximumY. Anyway, these limits should never reach -90/90 degrees: a kind of "division by zero" condition appears when the angle is too close to -90 or 90 degrees, and the camera gets crazy (even worse if passing these limits).
Answer by RealEfrain12 · Nov 22, 2020 at 02:30 AM
To look Up and Down I have this as my looking up and down script
public float mouseSensitivity = 100f;
float xRotation = 0f;
void Start()
{
Cursor.lockState = CursorLockMode.Locked;
}
void Update()
{
float MouseY = Input.GetAxis("Mouse Y") * mouseSensitivity * Time.deltaTime;
xRotation -= MouseY;
xRotation = Mathf.Clamp(xRotation, -90, 90);
transform.localRotation = Quaternion.Euler(xRotation, 0f, 0f);
}
You shouldn't multiply mouse input by Time.deltaTime. This causes a per-frame input to unexpectedly be reduced based on current framerate.
For constant-value input, such as held keys, it makes sense. For input that varies on a per-frame basis, such as mouse movement, you want to use it as-is.
Your answer
![](https://koobas.hobune.stream/wayback/20220613121657im_/https://answers.unity.com/themes/thub/images/avi.jpg)