Can I add air friction or drag to a flying character?

Hey there,

I’m wondering if it’s possible to add air friction/air drag to a flying character? I’ve been able to use the setting of “Falling Lateral Friction” for a falling character which represents what I need, but it’d be great to have this possible on a flying character. Right now I have a dragon flying around but without drag/friction its momentum will carry it past the target until its acceleration overcomes the momentum.

Any thoughts?

1 Like

Is this an AI character or a player controller one? I Think you could achieve it using the AddMovemenetInput and the scale. Then you just change the scale to act as friction.

This is using an AI controller. And currently the dragon moves in the direction of its rotation (with AddMovementInput) and rotates towards targets instead of aligning rotation to movement.

Did adapting the scale work in your case?

Same issue, there is a “GroundFriction”, and a “FallingLateralFriction”, but once you enter Flying mode, there is no damping for your character and no variables for making you ONLY move in the direction you are facing (like “FlyingFriction” or something similar). I’m trying to make my player jump up and then fly, but he starts Tokyo drifting all over the place instead of only moving where he’s looking. Don’t know how to get this fixed, tried C++ but I can’t even find where the movement code is. Hope someone figures this out soon, seems like it shouldn’t be as hard to find as it has been

Sorry I’ve been working on another project and haven’t had time to try this. I’ll give it a shot soon.

Have you tried the solution Moss suggested above? I haven’t tried it myself yet, been too busy.

Not really sure what he means by adapting the scale, it could be 1 or 1000 or -1000, wouldn’t change the linear velocity problem. What I’m gonna do is take the character’s velocity and multiply it by around .98 or so ever tick that the movement key is held and then turn up the BrakingAccelerationFlying variable. If I get it working I’ll post a picture.

UCharacterMovementComponent::PhysFlying() is where the flying code is implemented. Similar to swimming movement, friction in this mode comes from the current physics volume’s FluidFriction setting. Unfortunately I just noticed that the fluid friction is not exposed in the project physics settings, I’ll change that.

In the meantime you could modify World->DefaultPhysicsVolume->FluidFriction, or override CalcVelocity in CharacterMovementComponent in C++ to use a different friction setting when flying.

I can confirm that the adding a PhysicsVolume to your level and changing the FluidFriction will alter the friction of your player when flying so that the player does not ‘slide’ in the air uncontrollably.

I might also add that within the Player Blueprint, setting the Max Speed to a huge number will not actually make the player move faster past a certain speed if you have FluidFriction Volume within the level.
Instead, the variable to change to make the player faster is Max Acceleration

You can try to use: “Braking Friction Factor” in the character component.