I am trying to make a jump system where you must be standing on an object too jump but I don’t know how to check the collision.
My code:
using UnityEngine;
public class PlayerJump2d : MonoBehaviour
{
//Variables
public float Height = 2;
public Rigidbody2D rb;
//Code
void Update()
{
if(Input.GetKeyDown("space") )
{
rb.AddForce(new Vector2(0f,Height),ForceMode2D.Impulse);
}
}
}