Greetings everyone.
I’m trying to create a 2D platformer, and I wish to change the jump direction, when the player has rotated.
The rotation is working fine, but I cant make the player jump the x direction instead of the y direction.
Here is the code:
//Jump button
if (Input.GetKeyDown(KeyCode.Space) && grounded) {
GetComponent<Rigidbody2D>().velocity = new Vector2(GetComponent<Rigidbody2D>().velocity.x, jumpHeight);
}
Thanks for taking your time reading this.