Hello, I wonder if is there a way to convert the x and y force to speed and angle. By looking at my code you could say that the longer you hold the button, the futher the object would jump from its starting position. I want to make the code work the same but using angle and velocity. If you have other ways around or ideas that would be also good.
void Update () {
if (Input.GetMouseButton(0) && player_rb.velocity.y == 0)
{
onGround = true;
jumpup += upwardMultiplier * Time.deltaTime * 2.1f;
jumpside += sidewardMultiplier * Time.deltaTime * 2f;
if (jumpup >= 15.0f)
{
onGround = true;
Jump();
}
}
}
void Jump()
{
if (onGround)
{
player_rb.velocity = new Vector2(jumpside, jumpup);
jumpup = jumpside = 0;
onGround = false;
}
}