diff --git a/Source/RWTHVRToolkit/Private/Pawn/VirtualRealityPawn.cpp b/Source/RWTHVRToolkit/Private/Pawn/VirtualRealityPawn.cpp index 06e03060955c7230298531463b4cf02deff8e098..661f32b860aba5b0723e63da8fd6a8f0412832d4 100644 --- a/Source/RWTHVRToolkit/Private/Pawn/VirtualRealityPawn.cpp +++ b/Source/RWTHVRToolkit/Private/Pawn/VirtualRealityPawn.cpp @@ -113,26 +113,41 @@ void AVirtualRealityPawn::UpdateRightHandForDesktopInteraction() void AVirtualRealityPawn::OnForward_Implementation(float Value) { - if (RightHand) + //the right hand is rotated on desktop to follow the cursor so it's forward is also changing with cursor position + if (RightHand && !UVirtualRealityUtilities::IsDesktopMode()) { AddMovementInput(RightHand->GetForwardVector(), Value); } + else if (Head) + { + AddMovementInput(Head->GetForwardVector(), Value); + } } void AVirtualRealityPawn::OnRight_Implementation(float Value) { - if (RightHand) + //the right hand is rotated on desktop to follow the cursor so it's forward is also changing with cursor position + if (RightHand && !UVirtualRealityUtilities::IsDesktopMode()) { AddMovementInput(RightHand->GetRightVector(), Value); } + else if (Head) + { + AddMovementInput(Head->GetRightVector(), Value); + } } void AVirtualRealityPawn::OnUp_Implementation(float Value) { - if (RightHand) + //the right hand is rotated on desktop to follow the cursor so it's forward is also changing with cursor position + if (RightHand && !UVirtualRealityUtilities::IsDesktopMode()) { AddMovementInput(RightHand->GetUpVector(), Value); } + else if (Head) + { + AddMovementInput(Head->GetUpVector(), Value); + } } void AVirtualRealityPawn::OnTurnRate_Implementation(float Rate)