Walking to Falling Transition Behaviour

When my character transitions from walking to falling by running off an edge there is a noticeable change in direction that makes him do a small jump.
This behavior can also be seen in the standard 3rd person character template, but the direction change is a bit more obvious on downward slopes with higher speed.

How would I get a character to slide off an edge (transition from walking to falling) and have their trajectory maintained?

Hi Drocks,

I just tested this in the default 3rd Person template in 4.5.1 and couldn’t get your results. The MyCharacter slides fluidly off of every angled slope that I’ve test.

In the MyCharacters detail panel, did you set anything to a non-default option?

Thanks for looking into this TJ :slight_smile:

Here is what I have done to reproduce the behavior:

  • Create new 3rd person template
    project
  • Adjust some geo to be on a 45 degree
    angle (running down slopes makes the
    issue easier to see)

In the character blueprint defaults:

  • Change walkable floor angle to 75 (just so it doesnt go into a slide
    and lets you walk off the edge of the
    slope instead)
  • Change Max Walk Speed to 1500 (higher speeds make the issue more
    apparent)

In the HeroTPP_AnimBlueprint:

  • Delete all nodes in the state machine
    under the Anim Graph so the player
    remains in T pose and animations wont
    get in the way of seeing how the
    capsule behaves.

I then run down the slope and transition from walking to falling. When this happens it looks like the player character pops up a bit.

It does seem like the character’s z velocity is interpolating up from 0 when this transition occurs, but the x and y remain constant, giving the bounce like transition?

Thanks again for your help!

Hi Drocks,

Thanks for the specific repro steps. I was able to reproduce the issue and I have created JIRA UE-6035 in our tracking software. Our developers will be looking into it further.

I am also working with another developer to try to find a workaround. I’ll post back here as soon as we have something.

Cheers,

TJ

I think this happens because we always store your velocity when walking as a horizontal velocity only, so when you transition to falling you are getting an initial horizontal velocity. You can work around this by hooking in to the “OnWalkingOffLedge” event and setting velocity to the result of “GetPhysicsLinearVelocity()” from the Character capsule.

You may only want to do this when moving downward, otherwise you may find that you start launching in the air when running off upward slopes (unless that it something you want).

Thanks for the image, that helped see what was going on quite easily :slight_smile:

-Zak

1 Like

Thanks for the help TJ and Zak, that worked!

Just to update this: I checked in a change for 4.8 that affects this (for the better). We can’t just change the current default behavior without affecting too many existing projects, so instead I made it easier to compute custom velocities in the OnWalkingOffLedge() event and removed some barriers in character movement:

  • Added more parameters to OnWalkingOffLedge (previous floor normals, old location before movement, and timestep) so it’s easier to compute a custom velocity based on the change in location. GetPhysicsLinearVelocity() is still fine, just beware that under 30fps you need to enable physics substepping for it to be consistent.
  • CharacterMovementComponent::StartFalling no longer forces a zero Z velocity, so custom velocities will be respected.

Thank you - nearly a decade later and I am using this fix (setting CMC vel by capsule linear vel).