Flying character slide on landscape

Hello my fellow devs !

I have a simple project to test flying gameplay and I’m stuck on some simple flying controls :

As you can see in the video, I restricted inputs to only fly left/right and up/down. Everything is fine when flying above the landscape.
But when I hit the ground and keep moving “down”, the slope of the landscape makes me go “forward” (that’s what happened at the end of the video).
What I would like is to just stay in place when I go down on a slope.

More info :

  • The CharacterMovement is always in flying mode, with a enormous braking value (thats why he doesn’t glide that much in the air). The character animation changes to “running” when close to the ground but it’s only some BS magic, the CharacterMovement mode is still Flying

  • I could hard restric the movement of my character by overriding it’s movement when on the ground or by setting the Character->Planar Movement, but I might need to move my character forward in the future so I try to avoid such radical behavior :peace_symbol:

  • Landscape doesn’t have a Physics Material

  • I suspect it’s some capsule component wizardry, but I tried tweeking most of its value to no results. Same for collsion of Landscape, pawn, …

Movement input is pretty basic :

I you have any ideas or inputs on what’s going on I will gladly accept them :smile:
Sorry for the broken english ^^

Thanks

Ok so I found out what was going on.

In the CharacterMovementComponent, the flying mode implement a sliding method in its CharacterMovementComponent::PhysFlying().

SlideAlongSurface(Adjusted_test, (1.f - Hit.Time), Hit.Normal, Hit, true);

Thats what caused the sliding. This method is implemented in various ways for the different movement modes.

But just overriding the CharacterMovementComponent and removing the method doesn’t do the trick. If you just remove the method from the ::PhysFlying(), you character will be stuck on the ground as soon as it touches it. Moreover, I want my character to be able to slide right/left on the terrain so I can’t remove this completly.

I came out with a bit of an hack, don’t watch if your bad-code-sensitive :

//adjust and try again
HandleImpact(Hit, deltaTime, Adjusted);

// Thats a Hack, character can only slide left/right
auto const Adjusted_test = FVector{ Adjusted.X,Adjusted.Y,0.0f };
SlideAlongSurface(Adjusted_test, (1.f - Hit.Time), Hit.Normal, Hit, true);

An that’s all folks