I use a same script for both make character jump in 2D and 3D game:
using UnityEngine;
public class Test : MonoBehaviour
{
private Rigidbody rb;
public float jumpForce;
private void Start()
{
rb = GetComponent<Rigidbody>();
}
private void Update()
{
if (Input.GetKeyDown(KeyCode.Space))
{
rb.AddForce(Vector3.up * jumpForce, ForceMode.Impulse);
}
}
}
But in their result is very difference. I don't know how to show it through images so I make videos and upload them on Youtube: //use might like to mute if doesn't the music.
Here is the link of the 3D object jumping:
and there is 2D object is video:
-2D object jump is just like suddenly appear in the air.
Although share a same scripts and Rigidbody but why it's difference between 2D and 3D.
The problem seems to be using different sized for the different projects, the 3D character is 1 unit big and the 2d is 5 units big.
also the 3D environment is no the same as the 2D one, therefore you need to use Rigidbody 2D component instead