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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Unpredictable 2D Rigidbody Results

Discussion in '2D' started by LeeDenbigh, Aug 8, 2016.

  1. LeeDenbigh

    LeeDenbigh

    Joined:
    Jul 7, 2014
    Posts:
    48
    Hi, working on a 2D game and I thought using a Rigidbody would be the best thing to use, but the results of the jump just aren't the same every time.

    Here's a video... I just want the jump to be the same every time I press the jump button...



    Can anyone help please?
     
  2. LeeDenbigh

    LeeDenbigh

    Joined:
    Jul 7, 2014
    Posts:
    48
    I figured it out if anyone else needs a solution... I just instead used:
    rigidbody2D.velocity = new vector3(0, 8, 0);
     
  3. LiterallyJeff

    LiterallyJeff

    Joined:
    Jan 21, 2015
    Posts:
    2,802
    Ideally you would be using rigidbody2D.AddForce(Vector3.up * jumpStrength, ForceMode2D.Impulse);

    Where jumpStrength = 8f.