Question by 
               FlaviusJesu · May 07 at 10:52 AM · 
                scripting problemscript.unityeditorscripting beginner  
              
 
              Hold mouse to move camera doesn't work
When I click my MB0 and move it at the same time the camera move a little, but afterward it doesn't move, even when im holding the MB0. Im new to c# and unity, any help would be very helpful.
 using UnityEngine;
 using System.Collections;
 
 public class FirstPersonCam : MonoBehaviour {
 
     public float speedH = 2.0f;
     public float speedV = 2.0f;
     public bool is_down;
 
     private float yaw = 0.0f;
     private float pitch = 0.0f;
 
     void TrackMouse(){
       yaw += speedH * Input.GetAxis("Mouse X");
       pitch -= speedV * Input.GetAxis("Mouse Y");
 
       transform.eulerAngles = new Vector3(pitch, yaw, 0.0f);
 
 
       Cursor.lockState = CursorLockMode.Locked;
       Cursor.visible = false;
     }
 
     void Update () {
       if (Input.GetMouseButtonDown (0)){
         is_down = true;
       }
       if (Input.GetMouseButtonUp (0) && is_down){
         StartCoroutine("TrackMouse");
       }
     if (Input.GetMouseButtonUp(0)){
       is_down = false;
       StopCoroutine("TrackMouse");
       Cursor.lockState = CursorLockMode.Locked;
       Cursor.visible = false;
     }
 }}
Thank you.
 
               Comment
              
 
               
              Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
               
 
			 
                