void Start() { if (GetComponent <Rigidbody>()) { GetComponent <Rigidbody>().freezeRotation = false; } if (GetComponent <Camera>()) { axis = RotationalAxis.MouseY; } }
void Start() { if (GetComponent <Rigidbody>()) { GetComponent <Rigidbody>().freezeRotation = true; } Cursor.lockState = CursorLockMode.Locked; Cursor.visible = false; if (GetComponent <Camera>()) { axis = RotationalAxis.MouseY; } }
//private Light torch; //bool torchOnOff; void Start() { //Lock the cursor Cursor.lockState = CursorLockMode.Locked; //Hide the cursor Cursor.visible = false; if (GetComponent <Camera>()) { axis = RotationalAxis.MouseY; } //torch = GetComponentInChildren<Light>(); //torch.gameObject.SetActive(false); //torchOnOff = !torch.gameObject.activeSelf; }
private void Start() { if (GetComponent <Rigidbody>()) { GetComponent <Rigidbody>().freezeRotation = true; // freeze the rigid body rotation so it doesn't muk up our mouse look code } Cursor.lockState = CursorLockMode.Locked; // lock the mouse cursor Cursor.visible = true; // hide the mouse cursor if (GetComponent <Camera>()) // if the object is a camera { axis = RotationalAxis.MouseY; // look up and down } }
//Start - the very first frame the componate the object is active private void Start() { //If we want to use RigidBody Freezes all Rotational Control Actions if (GetComponent <Rigidbody>()) { GetComponent <Rigidbody>().freezeRotation = true; } Cursor.lockState = CursorLockMode.Locked; Cursor.visible = false; //Allows the Camera to move along the Y-axis if (GetComponent <Camera>()) { axis = RotationalAxis.MouseY; } }
private void Start() { // Checks if player has Rigibody and freezes the rotation on it if it exists if (GetComponent <Rigidbody>()) { GetComponent <Rigidbody>().freezeRotation = true; } // The curser will go invisible when the game starts and will lock on the middle of the screen. If Esc key was pressed, the cursor will apear and will be unlocked Cursor.lockState = CursorLockMode.Locked; Cursor.visible = false; // Checks if player has added a Camera Component and if so will change it so the rotational axis to the y axis if (GetComponent <Camera>()) { axis = RotationalAxis.MouseY; } }
void Start() { //Checks if the player has the component rigidbody and freezes the rotation on it if it exists if (GetComponent <Rigidbody>()) { GetComponent <Rigidbody>().freezeRotation = true; } //Locks the cursor to the center of the screen and makes it invisable Cursor.lockState = CursorLockMode.Locked; Cursor.visible = false; //Checks if its attached to the camera and if so will change it so the rotational axis to the y axis if (GetComponent <Camera>()) { axis = RotationalAxis.MouseY; } }
private float _rotY; //The y rotation of the camera void Start() { //If the component rigidbody exists if (GetComponent <Rigidbody>()) { //Freeze the roatation of the rotation GetComponent <Rigidbody>().freezeRotation = true; } //Lock the cursor state Cursor.lockState = CursorLockMode.Locked; //Set the visiblitiy of the cursor to false Cursor.visible = false; //If the componet Camera exists if (GetComponent <Camera>()) { //Set the axis to the RotationalAxis mouseY axis = RotationalAxis.MouseY; } }
void Start() { //For if we wanted to use a Physics based movement system //Checks for a rigidbody component if (GetComponent <Rigidbody>()) { //Allows the game object to not rotate GetComponent <Rigidbody>().freezeRotation = true; } Cursor.lockState = CursorLockMode.Locked; //makes the cursor invisible when playing the game Cursor.visible = false; //Mouse Y is loacted on the Camera component //Checks for a Camera component if (GetComponent <Camera>()) { //Created a reference for the Y axis axis = RotationalAxis.MouseY; } }