- Home /
Input.ResetInputAxes() not freezing first person controller on all axes
I'm following a tutorial for Unity 3.5, and trying to set up something where escape key can be used to toggle system cursor on and off, and also to freeze the responsiveness of Unity to user input (so you can move cursor up to deselect the play button without game responding to your moving cursor)
The Input.resetInputAxes() does freeze motion in response to mouse movements left and right, and also deactivates the WASD movement keys. But game still follows mouse movements Up and Down when shouldn't respond at all. Any ideas on problem?
Thanks
Hey rob - did you have any luck? I am working on the same tutorial and ran into the same issue. I am assu$$anonymous$$g it is a 3.5 versus 4 issue.
I'm having the same problem!
Has anyone found a solution to stopping the up and down movement on escape?
i am following lynda unity 3.5 tutorial
i have the same problem :/
Answer by liveuk · Nov 15, 2013 at 10:37 PM
Hi Guys the Mouse look script is also on the controller and that is still active You would have to do the same to the other script or scripts you have on the controller that you did in the tutorial. Maybe the controller only had one script on it back when the tut was made
Mike oobydoo
var fpc : GameObject;
internal var show$$anonymous$$enu : boolean = false;
function Start () {
// Hide Cursor
Screen.showCursor = false;
}
function Update () {
if (Input.Get$$anonymous$$eyDown ("escape")){
if (Screen.showCursor == false) {
fpc.Send$$anonymous$$essage("ToggleInput", true);
Screen.showCursor = true;
show$$anonymous$$enu = true;
}
else {
ResumeGame ();
}
}
}
function OnGUI () {
if (show$$anonymous$$enu == true) {
GUI.BeginGroup(Rect(Screen.width / 2 - 50, Screen.height / 2 - 45,100,90));
GUI.Box(Rect(0,0,100,90), "$$anonymous$$enu");
if(GUI.Button(Rect(10,30,80,20), "Quit")) {
Application.Quit();
}
if(GUI.Button(Rect(10,60,80,20), "Resume")) {
ResumeGame();
}
GUI.EndGroup ();
}
}
function ResumeGame () {
Screen.showCursor = false;
fpc.Send$$anonymous$$essage("ToggleInput", false);
show$$anonymous$$enu = false;
}
Answer by neesonch · Aug 04, 2014 at 11:52 PM
For those following the Lynda Unity 3.5 tutorial - as Mike mentions above, there are two different scripts for mouse control of the camera (I'm using Unity 4.5.1f3);
i) FPSInputController.js directly on the 'First Person Controller' object ii) MouseLook.cs on the 'Main Camera' child of First Person Controller
If you apply the tutorial code only to the first script, the game view will still tilt up and down the Y axis in response to mouse movement. Simply apply the code from the tutorial to the second script as well as the first (translating syntax from JavaScript to C# where appropriate) and you should see the desired result.
Your answer
Follow this Question
Related Questions
Help In Making a SphereCast for 3D Tire! Working RayCast Script included! 0 Answers
Input.GetAxisRaw("Mouse ScrollWheel") 4 times 0 Answers
How to get Input Button name? 2 Answers
Checking whether string is a valid Input.Key 1 Answer
How can I synchronize the cooldown on two separate scripts? 2 Answers