Skip to content
Snippets Groups Projects
Commit 9ea93a8b authored by Kris Tabea Helwig's avatar Kris Tabea Helwig
Browse files

fix(movement): Fixes a bug where the movement velocity is dependent on the controller rotation

parent 77e27346
Branches
Tags
1 merge request!103Walk Movement Controller Rotation Dependency Fix
Pipeline #456754 passed
...@@ -41,8 +41,11 @@ void UCollisionHandlingMovement::TickComponent(float DeltaTime, enum ELevelTick ...@@ -41,8 +41,11 @@ void UCollisionHandlingMovement::TickComponent(float DeltaTime, enum ELevelTick
{ {
// you are only allowed to move horizontally in NAV_WALK // you are only allowed to move horizontally in NAV_WALK
// everything else will be handled by stepping-up/gravity // everything else will be handled by stepping-up/gravity
// so remove Z component for the input vector of the UFloatingPawnMovement // so rotate the input vector onto horizontal plane
InputVector.Z = 0.0f; const FRotator InputRot = FRotator(InputVector.Rotation());
const FRotator InputYaw = FRotator(0, InputRot.Yaw, 0);
InputVector = InputRot.UnrotateVector(InputVector);
InputVector = InputYaw.RotateVector(InputVector);
ConsumeInputVector(); ConsumeInputVector();
AddInputVector(InputVector); AddInputVector(InputVector);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment