Download

Change direction of character in mid-air

Hi. I’m new to Unreal Engine 4 and I was making a character from scratch using C++ (similar to the Third Person Character template) to learn better with the help of this tutorial. I realized that the character does not change direction in mid-air when a key is pressed. For example, in most games, the player can suddenly stop leaping to a particular direction in mid-air. However, in my game, when the player jumps and is moving right, the character does not turn left if the left arrow key is pressed, until the character lands. I needed help to make the character able to change direction or stop going in a particular direction in mid-air when the key is released.

Hi,
CharacterMovementComponent has a float variable AirControl,I guess it’s what you’re looking for.

I’ll add a few variables that dictate what goes on during air movement.

BrakingDecelerationFalling - How much to decelerate with no input in the air

**AirControl **- 0…1 ratio of how much control the character has in the air
AirControlBoostMultiplier - See next
AirControlBoostVelocityThreshold - If lateral velocity is less than this, then FinalAirControl = AirControl * AirControlBoostMultiplier. Basically, move faster if not moving fast enough.

This is all within the Jumping/Falling category of UCharacterMovementComponent.

Thanks both of you. That did it.