Answer the question
In order to leave comments, you need to log in
Unity 2D diagonal jump?
Unity is a kettle, don't judge too harshly. There is a jump code:
void Update()
{
if (Input.GetKeyDown(KeyCode.Space))
{
BallJump();
}
}
void BallJump()
{
rb.AddForce(transform.up * 14f, ForceMode2D.Impulse);
}
Answer the question
In order to leave comments, you need to log in
Because you are applying force upwards transform.up
. Take the direction vector you need.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question