Problem with rotation and groundchek _ 2D - C#

Hi everybody, I searched a lot but I didn’t find a solution to my problems.

I have a sphere. I want that this sphere jumps after “x” seconds of a timer.
I did it but I have 2 problems.

First problem:
Trying to understand which is the relation from “second” to “distance” (i.e. after how many seconds the sphere covers 4x unit??) I did a few attempts:

  1. rigidbody.velocity = new Vector3 (2,0,0);

    The sphere rotates BUT the gravity doesn’t work and the jump is not natural.

  2. transform.position += Vector3.right * speed * Time.deltaTime;

    The gravity and the jump are perfect BUT the sphere instead of rotating, crawls.

Second problem:

About the “groundcheck”, I wrote this code:

public bool isJumping = false;
	
	

	void FixedUpdate () 
	{

		//stuff
		
		
		if(myCondition)
		{
			
			
			//rigidbody.velocity = new Vector3 (2,0,0);
			//transform.position += Vector3.right * speed * Time.deltaTime; 
			
   			  
				if (myCondition && isJumping == false)
				{
					rigidbody.velocity = new Vector3 (0,5,0); //
					isJumping = true;
							
				}

		}
		
  }

	void OnCollisionEnter(Collision col)
	{
		if(col.gameObject.tag == "Ground")
		{
			isJumping = false;
		}
	}
}

What happens is this:

IF #1: The sphere jumps and then, in the air, tries to jump again → doesn’t jump (perfect!)

IF #2: The sphere is falling, tries to jump → jump . . . How can I fix this?

I already sat the tag “Ground” to my ground.

I hope you understand my problems (despite my english) and somebody are able to tell me the solutions.

thanks, bye.

Not sure exactly what your first problem is. Typically you create a jump by adding a force straight up. Unity takes care of the rest automatically.

For the second problem consider setting isJumping to true in OnCollisionExit, instead of as part of your jump.

Edit: Convention tends to be to use isGrounded instead of isJumping. isGrounded is a more accurate name for situations where the character is not actually jumping, but still cannot jump. Like falling or on a soft/liquid surface.