Check out example codes for "isGrounded script for copy". It will help you in understanding the concepts better.

Code Example 1

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Example : MonoBehaviour {
   Rigidbody rigid;
   bool IsGrounded;
   void Start () {
     rigid = GetComponent<Rigidbody>();
   }
   void Update () {
     if (rigid.velocity.y == 0){
       IsGrounded = true;
     }
     else{
       IsGrounded = false;
     }
   }
}

Learn ReactJs, React Native from akashmittal.com