Question by 
               stanogg · Aug 27, 2016 at 08:48 AM · 
                rotationrelativerelative movement  
              
 
              Make input relative to rotation.
So, i have a 2D animation blend tree like this:

Im using input.GetAxis for animations. The problem is that when i rotate like that, and press D, i need to play the backwards animation instead of the right walk animation. 
thanks.
 
                 
                bef1b4fbcb5b4c0027ed8cd141ef3adb.png 
                (32.4 kB) 
               
 
                
                 
                3c802d913949a3e78407fbe23505182c.png 
                (47.2 kB) 
               
 
              
               Comment
              
 
               
              Answer by villevli · Aug 27, 2016 at 03:03 PM
It looks like you want the input to be relative to the camera:
 Vector3 inputDir = new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical"));
 inputDir = Camera.main.transform.TransformDirection(inputDir);
 inputDir.y = 0;
 inputDir.Normalize();
 
               However, if the camera looks straight down (90 degree angle), you have to swap the z and y axes.
Your answer