i have the code to move my rigid body upward.

my code lets me move my rigid body move upward. it just jump in fixed position. but i want my rigid body to jump upward as well as move forward. how can i achieve. i tried addforce but nothing worked

if (isGrounded)
moveVector = transform.forward * jumpForwardheight;
if (jump)
anim.SetBool(“IsJump”, true);

            Vector3 temp2 = rb.velocity;
            temp2.y = jumpHeight;
            rb.velocity = temp2;
        if (!jump)
            anim.SetBool("IsJump", false);

You can use the following for addforce.

GetComponent ().AddForce ((transform.right * moveForce) + (transform.up * jumpForce));

Here, moveforce is float value of how much displacement you towards towards right and jumpforce is a float value that determines how high your player jump. So in a way it will create an arc by totaling both forces along X and Y axis.

Edit 1: In the answer, transform.right is multiplied by moveforce and same for jumpforce. However, the “*” in between is not shown after submitting the reply.