Basic Jump Pad help

Hey everyone,
I need some help with creating a basic jump pad. My idea is that when the player collides with a specific gameObject (the jump pad), it will add a force to the player on its Y-axis, making the player “jump”. I’ve tried using rigidbody.AddForce, but it does not seem to work. If i untick “Is Trigger” on both the player and the jump pad, the collision register, but no force is added.

Any help appreciated!

So I don’t use unityScript and I didn’t use a player controller. Just a standard collision between two box colliders. I didn’t see anything happening until I raised the value of “speed” 500 was good for me. Heres the code for jumpPad:

public class jumpPad : MonoBehaviour {

    public int speed;

    void OnCollisionEnter(Collision other)
    {
        if (other.gameObject.CompareTag("Player"))
        {
            other.gameObject.GetComponent<Rigidbody>
                    ().AddForce(Vector3.up*speed);
        }
    }
}

Hi, some more details would be nice.

Show your code,
what exactly did happen with rigidbody.AddForce?

If your jumping script also use AddForce() the jump pad script and the jump script can be overlapped thus: you need to reset your characters RBs velocity before jump pads code runs. example is under below

    other.gameObject.GetComponent<Rigidbody>().velocity = Vector3.zero;
    other.gameObject.GetComponent<Rigidbody>().AddForce(Vector3.up*bounce, ForceMode2D.Impulse);

also; if u want to save your horizontal velocity you can use like this:

   other.gameObject.GetComponent<Rigidbody>().velocity = 
   new Vector3(other.gameObject.GetComponent<Rigidbody>().velocity.x,0,0);

Do not forget if your game is 2D you need to change Rigidbodys => Rigidbody2D and Vector3 => Vector2

good luck :slight_smile: