- Home /
Question by
DevYoung · Apr 20, 2020 at 12:24 AM ·
2d2d-platformervelocitycollision detectionjumping
2D Platformer Jumping at a 45 degree angle
I'm making a 2D platformer, I'm currently developing a wall jump.
I want to know how I can start off to make my player jump at 45 degree angle.
Comment
Best Answer
Answer by kSiasios · May 02, 2020 at 07:39 AM
Hey there! I'm also developing a 2D platformer and I'm moving the player using RigidBody2D.velocity. So, since you want to move the player at a 45 degree angle, you just have to multiply your jump force ( how high you want to jump with each jump ) with Vector2.one ( a vector with values (1, 1) ). This is if you want to jump to the right. If you want to jump to the left, just put - to your x value ( or flip it every time you touch the wall ). Something like that:
rb.velocity = jumpForce * Vector2.one; //for right jumping
rb.velocity = new Vector2( -jumpforce, jumpforce); //for left jumping
Your answer
![](https://koobas.hobune.stream/wayback/20220612231926im_/https://answers.unity.com/themes/thub/images/avi.jpg)