Hello I want to make it so when i use rigidbody2d.velocity and for example add 5 velocity on the x axis , it naturally adds 5 velocity on the x axis , simple . But what i want to do is i want to rotate the character with the E and Q buttons (Which ive already done) and when i press W to add velocity to my player , I want it to not add velocity towards the X axis but to the front of the player , how can I manage to do this
Rotation Script :
float rotationInput = Input.GetAxis("Rotation");
float rotationForce = rotationInput * Time.deltaTime * rotationPower
transform.Rotate(new Vector3(0, 0, rotationForce));
Movement Script:
moveInput.x = Input.GetAxisRaw("Horizontal");
moveInput.y = Input.GetAxisRaw("Vertical");
moveInput.Normalize();
rb.velocity = transform.up * moveInput.y * Time.deltaTime * moveSpeed * multiplier;
Extra detail if you couldnt understand :
So im gonna press W to go front , which works at 0 degrees angle because im my upper part is pointed towards the y axis so it adds 5 velocity to the y angle
But when i rotate it to 45 degrees angle , it doesnt go forward of the player blue arrow but goes towards the y axis black arrow
Thanks!