Search Unity

  1. Check out the Unite LA keynote for updates on the Visual Effect Editor, the FPS Sample, ECS, Unity for Film and more! Watch it now!
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. Improved Prefab workflow (includes Nested Prefabs!), 2D isometric Tilemap and more! Get the 2018.3 Beta now.
    Dismiss Notice
  4. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice
  5. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

2D Character Randomly Jumping High

Discussion in 'Physics' started by YBtheS, Sep 11, 2018.

  1. YBtheS

    YBtheS

    Joined:
    Feb 22, 2016
    Posts:
    90
    I have a game object with Platformer Character 2D script that comes in Unity's standard assets. This game object has a rigidbody and is AI controlled. I have another game object with the Platformer Character 2D script that is player controlled. For some reason, the AI controlled one jumps much higher most of time but not always even though the Jump Force variable in the inspector is set to 1200 for both. They both have the same rigidbody mass so why does this happen?
     
  2. YBtheS

    YBtheS

    Joined:
    Feb 22, 2016
    Posts:
    90
    After doing some testing I've figured out that for some reason, my AI character is performing its initial jump and then moments later, jumping again even though it's in the air. I don't see why though. I haven't made any changes to the Platformer Character 2D script as far as I can tell...
     
  3. StickyHoneybuns

    StickyHoneybuns

    Joined:
    Jan 16, 2018
    Posts:
    207
    I have never used the platform character 2d script so I can't comment on what exactly is happening. However, double jumping is a common issue with lots of jumping code. If the code isn't too long, post it here so I can possible see what's going on.

    Do you know how its detecting the ground? How does the script know when its in the air?
     
  4. cory6677

    cory6677

    Joined:
    Oct 20, 2013
    Posts:
    7
    I've had this problem when a character jumps next to another character. I thought it was just my custom-built hacky mess, but I recently tried Corgi Engine and it turns out this issue exists there as well, which unless I'm mistaken doesn't even rely on the physics engine.