Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

How to create a jump pad

Discussion in 'Getting Started' started by xkingjohnx, Oct 19, 2020.

  1. xkingjohnx

    xkingjohnx

    Joined:
    Feb 22, 2016
    Posts:
    67
    hi there,

    I hope someone could help me a bit..

    am trying to make a jump pad (if the player enters a collider he should get a vertical speed boost) My player is instantiated at runtime without a rigidbody and I am trying to do it like this:

    public bool BouncePad; [Tooltip("BouncePad?")]
    public float AmountOfForce = 20;

    if (BouncePad)
    {
    other.transform.TransformDirection(Vector3.up * AmountOfForce);
    }


    The Script is added to a box with a box collider /is trigger active (Bounce Pad is also active) but nothing happens .. no error in the console..

    I would very much appreciate if anyone has an idea how this could be achieved
     
  2. dgoyette

    dgoyette

    Joined:
    Jul 1, 2016
    Posts:
    4,103
    Some things:
    • This sub-forum is for high-level design ideas, not scripting help. You should go past this over on the Scripting sub-forum so the right people see it.
    • You should use Code tags when posting code.
    • What you included isn't a script, it's just some code. In your new post, include your entire script, since it's significant whether you're calling OnCollisionEnter, OnTriggerEnter, etc.
    • You said you're using a rigidbody, but in this code you're not adding force to any rigidbodies. You should be using Rigidbody.AddForce if you're using non-kinematic rigidbodies in your game.
     
    Antypodish likes this.
  3. xkingjohnx

    xkingjohnx

    Joined:
    Feb 22, 2016
    Posts:
    67
    hey thanks for your answer.. sry didnt know where to post it.. actually I said the player is without a rigidbody..
    any idea how to achieve that?

    As recommended, I have posted it in the scripting subforum here with the code snippet