diff --git a/Source/RWTHVRToolkit/Private/Pawn/Navigation/CollisionHandlingMovement.cpp b/Source/RWTHVRToolkit/Private/Pawn/Navigation/CollisionHandlingMovement.cpp index 4f86fc4ff143a386230494fbd2fe9de95c8f9b5c..d75c4d401caf16d8485458db2ed4f4e78c4689d3 100644 --- a/Source/RWTHVRToolkit/Private/Pawn/Navigation/CollisionHandlingMovement.cpp +++ b/Source/RWTHVRToolkit/Private/Pawn/Navigation/CollisionHandlingMovement.cpp @@ -41,8 +41,11 @@ void UCollisionHandlingMovement::TickComponent(float DeltaTime, enum ELevelTick { // you are only allowed to move horizontally in NAV_WALK // everything else will be handled by stepping-up/gravity - // so remove Z component for the input vector of the UFloatingPawnMovement - InputVector.Z = 0.0f; + // so rotate the input vector onto horizontal plane + const FRotator InputRot = FRotator(InputVector.Rotation()); + const FRotator InputYaw = FRotator(0, InputRot.Yaw, 0); + InputVector = InputRot.UnrotateVector(InputVector); + InputVector = InputYaw.RotateVector(InputVector); ConsumeInputVector(); AddInputVector(InputVector); }