Paper2D APaperCharacter doesn't slide

Given APaperCharacter where I use AddMovementInput(MovementVector * DeltaTime); where MovementVector is either -1.0,0.0 or 1.0 on it’s X component and is called in the Tick event.

I have set

#define NormalGroundFriction 0.00f
#define SlideGroundFriction 0.00f
	Cast< UCharacterMovementComponent>(GetMovementComponent())->BrakingFriction = NormalGroundFriction;
	Cast< UCharacterMovementComponent>(GetMovementComponent())->GroundFriction = NormalGroundFriction;
	Cast< UCharacterMovementComponent>(GetMovementComponent())->bUseSeparateBrakingFriction = true;

I have also set those values to be 1.0f, 0.5f, 0.1f and 0.0001f all of which have not changed how the chracter slows down. I have added a debug print to verify that nothing else is setting the GroundVelocity to something else, it’s still 0 during the game. Also setting it to 100.0f the player still moves as before.

What am I missing? Do I need to use another update function? Don’t call it with a zero vector? Some boolean or other control mode that is affecting the player I need to modify?

Hi, oziphantom.

Check the field BrakingDecelerationWalking as well. This lowers velocity at a constant force while the character is walking; if you set this to a lower value then you should be able to see results when adjusting Braking and Ground friction.

Also: AddMovementInput / AddInputVector interfaces do not require DeltaTime in their calculations. CharacterMovementComponent handles its own time substepping; just add the normalized direction scaled against a ratio in the interval [0.0, 1.0]. For instance, when moving via an axis read value:

AddMovementInput(DirectionVector, AxisValue);

If neither of those options help, the following functions might be useful to study and override if necessary:

UCharacterComponent::CalcVelocity(float DeltaTime, float Friction, bool bFluid, float BrakingDeceleration);
UCharacterComponent::ApplyVelocityBraking(float DeltaTime, float Friction, float BrakingDeceleration);

UCharacterMovementComponent is pretty complicated because it supports networking; Just to get a general sense of what occurs for the “host” player (I am assuming your game is offline) you can follow the basic function call route of:
TickComponent → PerformMovement → StartNewPhysics → Phys[MovementMode]
Where [MovementMode] corresponds to the current EMovementMode. (PhysWalking, PhysFlying, etc.)

Good luck!

Indeed BreakingDecelerationWalking was the solution, thank you.