player jump script 2d

My “game” is a 3d project, has 3d models, but the player can only move between two axis, (x, and y for jump). I need a script that can jump my player, Recorded Video Sessions on 2D in Unity 4.3 - Unity Learn I have seen the part of the jump, and I see other tutorials but I don’t understanded it. In the game there are more than one 3d objects, used as ground (like plane,and some cubes), can anyone help me? thanks! (example)

Hi you can use Rigidbody.AddForce and just add force at the Y-Axis Example:

Rigidbody.AddForce(new Vector2(0, 10));

or

Rigidbody.AddForce(new Vector3(0, 10, 0));

and for checking if the gameobject is on the ground just use:

private bool IsGrounded;

void OnCollisionEnter(Collision other)
    {
        if(other.transform.tag == "Ground")
        {
            IsGrounded = true;
        }
        
    }

and just remember to tag your ground with the tag (Ground).

Hope it helps.