How do I make a surface walkable?

I’m currently working on a project which involves a first person player rotating direction of gravity, so far, character rotates fine and gravity changes fine, but when he hits the ceiling while gravity is changed, so basically landing on a new floor, he bounces and if he hits the old floor, the player’s head will stick to the old floor.
So how can I make this new surface walkable?

If you look at the UCharacterMovementComponent class, you’ll see it assumes that in order to find the “floor” it can trace in the direction of the negative Z axis.

For example, CharacterMovementComponent.cpp line 3518:

bBlockingHit = GetWorld()->SweepSingle(Hit, CapsuleLocation, CapsuleLocation + **FVector(0.f,0.f,-TraceDist)**, FQuat::Identity, CollisionChannel, CapsuleShape, QueryParams, ResponseParam);

Similar assumptions are made on line 3531, line 3566, and possibly elsewhere.

I added a task to investigate making the character movement code flexible enough to support different gravity directions, with impacting performance in the normal case. Sounds like a cool feature if we can do it!

So…any luck?