- Home /
First Person controller Mouse Look isn't working
I know that this has been asked before, but it was not answered to my satisfaction there. And the thread is now two years old. I am teaching a class in Unity and have used the FP Controller many times. But today I opened a new project, created a simple terrain, a FPC and ran it. Mouse look did not work! I had not altered it in any way. I shut down Unity and relaunched it, same result. Can anyone give me some insight as to why this is happening? It didn't happen to any of my students.
Very frustrated.
I just ran into the same problem. it appears that the $$anonymous$$ouslook script was changed in an update. Here is the old script:
using UnityEngine;
using System.Collections;
public class $$anonymous$$ouselookClassic : $$anonymous$$onoBehaviour {
public enum RotationAxes { $$anonymous$$ouseXAndY = 0, $$anonymous$$ouseX = 1, $$anonymous$$ouseY = 2 }
public RotationAxes axes = RotationAxes.$$anonymous$$ouseXAndY;
public float sensitivityX = 15F;
public float sensitivityY = 15F;
public float $$anonymous$$imumX = -360F;
public float maximumX = 360F;
public float $$anonymous$$imumY = -60F;
public float maximumY = 60F;
float rotationY = 0F;
void Update()
{
if (Input.Get$$anonymous$$ey($$anonymous$$eyCode.F)) return;
if (axes == RotationAxes.$$anonymous$$ouseXAndY)
{
float rotationX = transform.localEulerAngles.y + Input.GetAxis("$$anonymous$$ouse X") * sensitivityX;
rotationY += Input.GetAxis("$$anonymous$$ouse Y") * sensitivityY;
rotationY = $$anonymous$$athf.Clamp(rotationY, $$anonymous$$imumY, maximumY);
transform.localEulerAngles = new Vector3(-rotationY, rotationX, 0);
}
else if (axes == RotationAxes.$$anonymous$$ouseX)
{
transform.Rotate(0, Input.GetAxis("$$anonymous$$ouse X") * sensitivityX, 0);
}
else
{
rotationY += Input.GetAxis("$$anonymous$$ouse Y") * sensitivityY;
rotationY = $$anonymous$$athf.Clamp(rotationY, $$anonymous$$imumY, maximumY);
transform.localEulerAngles = new Vector3(-rotationY, transform.localEulerAngles.y, 0);
}
}
void Start()
{
// $$anonymous$$ake the rigid body not change rotation
if (GetComponent<Rigidbody>())
GetComponent<Rigidbody>().freezeRotation = true;
}
}
Answer by stopsecret · Aug 17, 2011 at 07:43 PM
Ok, so, first of all, is your mouse working? second of all, did you try reimporting the character controller package? third, is your unity up to date? fourth, have you looked in your edit --> project settings --> input folder? all these may be the problem it's not working. You may also consider creating a new project and retrying it.
Answer by poemind · Aug 18, 2011 at 12:30 PM
Ok, yes my mouse is working. Yes, I tried re-importing Unity is probably not up to date, because the lab techs have not been on the ball over the summer, but it is the same version that my students were using successfully. I will look at the project settings, I had not looked at that. I will try making a new project.
But that doesn't answer the question as to why this would happen? Why would my project settings be different by default than my students?
Thanks for the quick response!
Answer by poemind · Aug 19, 2011 at 02:25 AM
Today I did try the edit-> project settings -> input folder (?) idea. I think. I went to edit-> project settings -> input, and that opened an input panel. I'm guessing that is what you are speaking of. Looking at that I couldn't find anything amiss. What specifically should I be looking for? I check the MouseX and MouseY and they were both linked to Mouse Movement as I recall. I'm a bit at a loss.
Thanks in advance.
Answer by MC HALO · Aug 19, 2011 at 02:35 AM
Hey go to my youtube channel and click on my video on unity tutorial. Then in my description box it will have my site web address and click on that and open it and in the site click on Script and download my unity package :) my youtube Channel is :
Answer by stopsecret · Aug 19, 2011 at 12:52 PM
Alright, so I think your mouse settings are fine. Have you tried reimporting the Character Controller package? If it still doesn't work after reimporting the first person controller, the FPC may be corrupted and you may want to try finding a copy of the character controller package that isn't corrupted on the web. The other thing to do, which I would highly recommend, is borrow one of your student's computers and analyze their project and your project carefully to see if there is anything different about your mouse look parameters- I hope this helps you! :)