Hi Unity Community
I am trying to prevent the First Person character from rotating via mouse click however I cannot seem to access the appropriate field; how is this supposed to be achieved? I’m currently thinking the best approach might be change the **x/y mouse sensitivity** variables (held in the MouseLook class) to 0 however I can’t seem to do this.
(FYI I am programming in uJs.)
I have tried accessing the UnityStandardAssets.Characters.FirstPerson namespace but to no avail (returns ‘not found, maybe you forgot to add an assembly namespace’ - what is the appropriate namespace I require?)
I have also tried accessing the field directly (as per existing posts on the issue) via .GetComponent(MouseLook) also to no avail.
What is the best method of achieving this?
**Current Code:**
import UnityStandardAssets.Characters.FirstPerson;
var browseMenu : GameObject;
var browseMenuButton : GameObject;
var menuActive : boolean;
private var menuMode : boolean;
function Start () {
var fpcScript = gameObject.GetComponent(MouseLook);
}
function setMode()
{
if(!menuMode) //if not in menuMode turn it on
{
browseMenu.SetActive(true);
browseMenuButton.SetActive(true);
MouseLook.XSensitivity = 0;
}
}
**Field To Access: **
![alt text][1]
[1]: /storage/temp/56201-screen-shot-2015-10-15-at-115930-am.jpg
↧