|
Using the MouseLook script in the standard assets project, How would I disable the script when a button is pressed? Here's the set up: I have a script that Hides the Cursor (for fps sake) unless you press the "Left Alt" button. When you press Left Alt, the cursor shows back up. That works fine. However, I'd like the MouseLook Script to be disabled when I press the Left Alt Button and then Re Enabled when I release the Left Alt Button. By Doing this, I could adjust options, or select objects on the screen without the camera continuing to rotate. Thanks for any help!
(comments are locked)
|
|
Use GetComponent to get a reference to the script, and set enabled to false or true as necessary. Use GetButton rather than hard-coding keys, so it can be changed by the user easily (in a stand-alone anyway). Thanks much, I had this exact same script already put in and it wasn't working. But when I re typed it out in it's own script instead of another one I was using it seemed to work. Whatever works I guess, right? Thanks again.
Apr 27 '10 at 12:32 AM
CalledToGaming
(comments are locked)
|
|
Use a boolean variable that gets set to true on left alt down, and set to false on left alt up. Then, in your mouselook script, add an if statement surrounding the mouselook part of the script. If it's not true (alt isn't held down) then you can rotate. if it is true (alt is held down) than it can't move. EDIT: Here's a JS mouselook. I thought the same thing, but I can't figure it out on a CS script. I'm used to JS
Apr 26 '10 at 11:45 PM
CalledToGaming
I've updated my answer.
Apr 27 '10 at 12:09 AM
e.bonneville
(comments are locked)
|
