- Home /
Question by
Youg3 · Nov 20, 2012 at 11:20 AM ·
javascriptmouselookfps controllerfirst person controller
MouseLook Freeze!
Been high and low for an answer to this with nothing seemingly that works, so any real, "this is whats wrong" would be great!
First off, I'm using Javascript and have implemented a javascript of MouseLook which compiles all well at the current time, but doesn't actually freeze the camera when the Pause menu is activated. Here's my code, which I figured if it got it freezing unfreezing would be the easy part.
var guiMode : String = "InGame";
var buttonWidth : int = 180;
//assigns player controller in inspector
var player : GameObject;
function Update()
{
// Pause button
if(Input.GetKeyDown("escape"))
{
//this is to completely pause all buttons and particles
Time.timeScale = 0;
//Freeze Mouse Look Script
player.GetComponent(MouseLookJava).enabled = false;
//GetComponent("MouseLook").enable = !GetComponent("MouseLook").enable;
//bring up menu options.
guiMode = "Paused";
}
}
Any help would be much appreciated.
Comment
Answer by Berenger · Nov 20, 2012 at 12:05 PM
I suspect your camera has a mouselook script as well, so you need to disable that one too.
Note that with Time.timeScale = 0, Time.deltaTime is set to a default value (0.2 ?), not 0.
Your answer
![](https://koobas.hobune.stream/wayback/20220613084147im_/https://answers.unity.com/themes/thub/images/avi.jpg)