Character falling very fast when jumping from beyond an edge

Cheo

Active member
Hello, this is a major long standing issue that I was finally able to reliably reproduce in the UCC demo scene. When the player is slightly over an edge and magically floating in the air, when jumping from that state he will end up falling very fast. Take a look at this video starting from 2:00 :


Here is a sequence from my game where the player has to fall down a series of platforms and beams to reach the bottom of the tower. I've seen this bug appear during numerous playtests, especially during this section. There is no need to make a complex platforming game to be concerned by this issue :


I cannot stress enough how big of an issue this is. Please have it fixed for the next update, thanks.
 
Thank you thank you thank you!

I have noticed this throughout the years but was never able to determine a fix. With your repros I have a proper fix. Add the following to line 1331 of CharacterLocomotion:

Code:
            // Cancel downward external force on every grounded check. Edge contact can add a downward
            // friction force without changing the grounded state, which would otherwise accumulate and oppose a jump.
            if (grounded && !m_ForceUngrounded) {
                var localExternalForce = this.InverseTransformDirection(m_ExternalForce);
                if (localExternalForce.y < 0) {
                    localExternalForce.y = 0;
                    m_ExternalForce = this.TransformDirection(localExternalForce);
                }
            }
            // Existing:
            m_SlopedGround = false;
            UpdateSlopeFactor();
 
After applying your changes the issue does not happen when jumping while standing still in the air, but it still does when moving at the moment we start jumping :


Did I apply your changes correctly ? If I paste your code above m_SlopedGround = false; then it's not at line 1331.
 
You did, there was one more use case:

Within Jump.cs, immediately after the following within ApplyJumpForce:

Code:
m_JumpTime = TimeUtility.Time;
Add:
Code:
if (!m_CharacterLocomotion.Grounded) {
    m_InAirTime = m_JumpTime;
    m_AirborneJumpApplied = true;
}
 
Back
Top