Direction-dependent MaxSpeed for character movement component.?

I am trying to do a movement system where max speed is dependent on direction. I have a set max speed for each “main” direction (Left, right, Forward and Backward), and the MaxSpeed of directions between those is an intermediate value, of the adjacent directions’ proportional to the angle of the direction (The closer the movement direction is to one of the main directions, the bigger the weight of that directions value.
What would be the simplest way to calculate the speed for a given direction?
The speeds are currently stored as floats in an attribute set in order to be affected by gameplayabilities.
Thank you for your time.

MaxSpeed is really designed to be based on the physics mode so I think the best way to handle this would be with a custom movement component that overrides :::CalcVelocity() and performs the direction based speed clamping.

Simple approach if you are using a standard pawn movement component - you can just scale the inputs to achieve different move speeds in Fwd/Back or Left/Right directions. The below functions do so with two self-explanatory variables “moveForwardRate” and "moveRightRate ". The inputs are the standard controller/keyboard axis output from -1 to 1 and functions are in a sub-class of Unreal’s “ACharacter” class.



/**
* Move forward.
*/
void AFirstPersonCharacter::MoveForward(float value)
{
 AddMovementInput(GetActorForwardVector(), value * _moveForwardRate * _sprintMultiplier);
}

/**
* Move right.
*/
void AFirstPersonCharacter::MoveRight(float value)
{
 AddMovementInput(GetActorRightVector(), value* _moveRightRate * _sprintMultiplier);
}