I cant detect if my player is moving
I am trying to detect if the player is moving horizontal or vertical, but it switches, like 1 second it will only detect horizontal movements, then the next only vertical.
  void FixedUpdate()
     {
 
         Vector2 targetVelocity = new Vector2(Input.GetAxisRaw("Horizontal"), Input.GetAxisRaw("Vertical"));
         GetComponent<Rigidbody2D>().velocity = targetVelocity * playerSpeed;
         if (Input.GetAxisRaw("Horizontal") == 0 && Input.GetAxisRaw("Vertical") == 0)
             animator.SetBool("Walk", true);
         if (Input.GetAxisRaw("Horizontal") != 0 && Input.GetAxisRaw("Vertical") != 0)
             animator.SetBool("Walk", false);
     }
 
 }
               Comment
              
 
               
               
               Best Answer 
              
 
              Answer by jaden03 · Nov 24, 2018 at 05:05 AM
Im dumb, I was putting
if (Input.GetAxisRaw("Horizontal") == 0 && Input.GetAxisRaw("Vertical") == 0)
when it should have been or ( || )
if (Input.GetAxisRaw("Horizontal") == 0 || Input.GetAxisRaw("Vertical") == 0)
Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                