Question by 
               jwalkaz33 · Oct 14, 2019 at 01:26 AM · 
                2d gamelocalpositionlocalrotation  
              
 
              Rotation doesnt affect up and down? 2D Game
So I have a 2D game where w,a,s,d move the player and q,e rotate the player but the players up stays as the global up so if I rotate to look left then hit w the move, it moves right not straight. How can i move based on the players local forward, backward, left, and right?
     private Rigidbody2D rb2d;
     public float speed;
     void Start()
     {
         rb2d = GetComponent<Rigidbody2D>();
     }
 
     public void FixedUpdate()
     {
         float moveHorizontal = Input.GetAxis("Horizontal");
         float moveVertical = Input.GetAxis("Vertical");
         Vector2 movement = new Vector2(moveHorizontal, moveVertical);
         rb2d.AddForce(movement * speed);
 
 
         if (Input.GetKey("e"))
             transform.Rotate(0, 0, 100 * Time.deltaTime);
 
         if (Input.GetKey("q"))
             transform.Rotate(0, 0, -100 * Time.deltaTime);
     }
 
              
               Comment
              
 
               
              Your answer