From d25d49f6414a84a75a864fe3f3c6f6334e94d16b Mon Sep 17 00:00:00 2001 From: Ehret <jw210150@WIN.RZ.RWTH-AACHEN.DE> Date: Thu, 28 Apr 2022 11:17:47 +0200 Subject: [PATCH] use head forward/right etc. in destop mode, otherwise adjusting the right hand to the mouse cursor also influences the forward travel direction, which feels weird --- .../Private/Pawn/VirtualRealityPawn.cpp | 21 ++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/Source/RWTHVRToolkit/Private/Pawn/VirtualRealityPawn.cpp b/Source/RWTHVRToolkit/Private/Pawn/VirtualRealityPawn.cpp index 06e03060..661f32b8 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) -- GitLab