|
How would I suspend the mouse look script? I want to be able to click on my GUI in first person with out turning my head/(camera) to select a GUI.button. Can't I add a command to the mouse look script to suspend it when I hold down shift or alt?
(comments are locked)
|
|
Sorry I didn't see this in my original search, but this thread actually covers what I was talking about, How do I disable mouse look when a button is pressed? Maybe my mis-phrasing will help some other hillbilly find his answer too...
(comments are locked)
|
|
You check the current mouse position against the window containing your GUI element(s) and set a global (I use a Plugin, you could also use a common script object). Then in MouseLook, return early from Update if that's set. Also, clear that global boolean in a LateUpdate function. I made this my 'global' variable manager:
Then in my OnGUI() functions:
Then in MouseLook: Thank you... I really appreciate your help, DaveA! I am new to scripting and just haven't got my head around all the nuances. Even more than just having a code that works, I am really trying to crasp what's going on here, it's seems like your solution is more complicated than it would need to be, which is why I haven't responded sooner. I have been trying to absorb your answer until I understood it, and having the working code should augment that understanding. All of the scripts seem to have a check box to enable them. Is it not a good idea to script a keyboard key to un-check this?
Feb 01 '11 at 10:01 AM
TurtleWolf
Yeah, actually, I coded this when I was a noob too. The other post is much cleaner, using 'active' is a much better way to go, generally. I think mine grew out of a need to turn off one axis but leave the other on, or something strange. I voted up the other answer. That said, if you have other UI items which may need to set/check such state, a GUI manager may still come in handy...
Feb 02 '11 at 12:03 AM
DaveA
(comments are locked)
|
