- Home /
Camera Lock
I'm trying to stop all camera movement when a GUI comes on, and then resume movement once the GUI goes off. Any tips? I'm writing in Javascript and my code is below.
var information: String;
private var guiOn = false;
private var rect: Rect;
function OnMouseDown () {
guiOn = true;
rect = Rect(Screen.width/2-120,Screen.height/2-100,300,300);
}
function OnGUI () {
if (guiOn){
GUI.Label(rect, information);
if (GUI.Button(Rect(Screen.width/2-0,Screen.height/2-50,75,50), "False")) {
guiOn = false;
}
if (GUI.Button(Rect(Screen.width/2-100,Screen.height/2-50,75,50), "True")) {
animation.Play ("dooropen1");
guiOn = false;
}
}
}
This code handles the GUI. Where is the code that moves the camera?
The code handling the handling the camera is built into the player model. I thought to put it with the GUI code, because I don't want the player to be able to look around while a GUI is up. The game is an FPS, so the main camera is controlled with the mouse.
Answer by riko4628 · Mar 24, 2013 at 09:39 AM
disable the mouselook script
see i thought about trying tht but im having trouble getting it too work could you show me?
Your answer
Follow this Question
Related Questions
How To Make A Floating Health Bar 1 Answer
picture in picture 3d. 0 Answers
Dirt On Camera (BF3 and Metro Last Light) 1 Answer