Why doesn't my camera work?,Why does my mouse keep going up?
So i just downloaded unity and i started with the FPS microgame but every time i play the game the mouse keeps going up and turning in circles. And when i play with a controller i can look down but not with a joystick but with R2. Can anyone help? ,
Answer by pardosea · Apr 07, 2020 at 07:45 AM
I just downloaded that as well and I have the exact same problem. Seems like it detects a gamepad for a reason, I actually have some sort of gamepad(guitar hero controller, idk..).
Anyhow, I simply changed the following statement:
bool isGamepad = Input.GetAxis(stickInputName) != 0f;
In PlayerInputHandler.cs
to false:
bool isGamepad = false;
That seems to solve it for me.
Answer by UploadStudios · Apr 07, 2020 at 12:21 AM
Um I don't know how to really fix that problem, but if you are looking for 1st person and C#, then I can give you my script. @philipdbra
using System.Collections; using System.Collections.Generic; using UnityEngine;
public class MouseLook : MonoBehaviour {
public float mouseSensitivity = 200f;
public Transform playerBody;
float xRotation = 0f;
// Start is called before the first frame update
void Start()
{
Cursor.lockState = CursorLockMode.Locked;
}
// Update is called once per frame
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);
}
}
Your answer
Follow this Question
Related Questions
viewing on the Mouse Y axis not working. 0 Answers
getting Jittery movement on camera when player rotating and moving in same time 0 Answers
CineMachine Camera Movement is inverse 1 Answer
(Solveed) How to make object face same direction as its parent? 0 Answers
Trying to Make a Smooth Camera Zoom While Changing Targets 1 Answer