Download

UCharacterMovementComponent - Character decelerates though all frictions and brakings are set to 0

I have an ACharacter with the standard UCharacterMovementComponent + Capsule (no physics simulation) using EMovementMode::MOVE_Flying. I’ve set all brakings and frictions of the UCharacterMovementComponent to 0.f Now, after I accelerate the ACharacter using AddInputVector() of the MovementComponent I’m expecting that it keeps that velocity “forever”. However the ACharacter constantly decelerates slowly until it comes to an hold. Anything I’ve missed?

EDIT: When the Movement mode is set to walking, the character keeps the velocity as expected (when friction/braking is zero). Are there additional influences on flying mode?

Ok, it was caused by the DefaultPhysicsVolume. Flying is affected by its fluid friction while walking isn’t.

EDIT: The code below doesn’t work with multiplayer. My next idea was to create a derived physics volume, but then I found that the DefaultPhysicsVolume gets its setting from the project settings. So changing friction in project settings to 0.f is enough! :slight_smile:
[HR][/HR]
Not working in multiplayer since server doesn’t know about this change.
One solution is to disable the friction for that volume:



void AMyGameMode::InitGame(const FString& MapName, const FString& Options, FString& ErrorMessage) {
    Super::InitGame(MapName, Options, ErrorMessage);
    auto DefaultPhysicsVolume = GetWorld()->GetDefaultPhysicsVolume();
    DefaultPhysicsVolume->FluidFriction = 0.f; // So that EMovementMode::MOVE_Flying doesn't get slowed down when no input happens.
}