unity jump pad script code example

Example: how to make a forward jump pad in unity

public class jumpPad : MonoBehaviour {
 //Can be edited in your inspector. You'll start to notice a difference at Speed 
 = 1000.
     public int speed;
 
     void OnCollisionEnter(Collision other)
     {
     //You must assign a tag "Player" on your player object.
         if (other.gameObject.CompareTag("Player"))
         {
         //Your pad must have a rigidbody as well as your player(I think I'm not sure I got
         the script from Basic Jump Pad help - Unity Answers).
             other.gameObject.GetComponent<Rigidbody>
                     ().AddForce(Vector3.up*speed);
         }
     }
 }