Search Unity

  1. Unity 2018.3 is now released.
    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. We've updated our Terms of Service. Please read our blog post from Unity CTO and Co-Founder Joachim Ante here
    Dismiss Notice
  4. Want to provide direct feedback to the Unity team? Join the Unity Advisory Panel.
    Dismiss Notice
  5. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice

2D Character Randomly Jumping High

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

  1. YBtheS

    YBtheS

    Joined:
    Feb 22, 2016
    Posts:
    102
    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:
    102
    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.