detect pawn left/right movement? (multiplayer)

My character when given input from a key, can sprint (run real fast) based off a replicated bInputSprint bool that changes based when pressing LeftShift and to begin sprinting the following below must return true;


 bool somechar::IsSprinting() const
 {
     //make sure player even wants to sprint
     //make sure player is actually moving
     //make sure player is not moving backwards
     //make sure player is not moving sideways X FORUMS-> is there a better way to do this??
     //make sure player is not moving sideways X FORUMS-> is there a better way to do this??
     //finally make sure the player has enough stamina
 
     return (bInputSprint) &&
         !GetVelocity().IsZero() &&
         (GetVelocity().GetSafeNormal2D() | GetActorForwardVector()) > -0.1 &&
         (GetVelocity().GetSafeNormal2D() | GetActorRightVector()) < 0.6 &&
         (GetVelocity().GetSafeNormal2D() | GetActorRightVector()) > -0.6 &&
         Stamina > 0;
 }

This works and both the server and client animations are happy… player sprints and all is great.

As you can see i am trying to block the player from using MoveRight() (A or D left/right strafe movement) while sprinting. The above somewhat works but when you turn the camera this also affects the players RightVector!!! So just by turning the camera too sharply you can cancel sprinting! The number 0.6 is the closest i can get between disabling left/right movement and almost keeping the camera from stopping sprint, but there has to be a better way.

I tried the following below (this is from a playercontroller input component, it passes A or D input to the pawn)


void somechar::MoveRight(float Val)
 {
     if (Val != 0.0f && pawn != NULL && !IsMoveInputIgnored() && !pawn->IsSprinting())
     {
         pawn->MoveRight(Val);
     }
 }

but this is all input aka clientside, checking for IsSprinting() here to block left and right movement is not ideal…

did you figure this out? I think I might have the same problem