Skip to content
Snippets Groups Projects
Commit 2dc017ba authored by Jonathan Ehret's avatar Jonathan Ehret
Browse files

make desktop hand movement configurable

parent 2b47149f
Branches
No related tags found
1 merge request!33extract rotation movement to reduce code duplication
...@@ -93,9 +93,17 @@ void AVirtualRealityPawn::UpdateRightHandForDesktopInteraction() ...@@ -93,9 +93,17 @@ void AVirtualRealityPawn::UpdateRightHandForDesktopInteraction()
FVector MouseLocation, MouseDirection; FVector MouseLocation, MouseDirection;
PC->DeprojectMousePositionToWorld(MouseLocation, MouseDirection); PC->DeprojectMousePositionToWorld(MouseLocation, MouseDirection);
FRotator HandOrientation = MouseDirection.ToOrientationRotator(); FRotator HandOrientation = MouseDirection.ToOrientationRotator();
if(bMoveRightHandWithMouse)
{
RightHand->SetWorldRotation(HandOrientation); RightHand->SetWorldRotation(HandOrientation);
RightHand->SetRelativeLocation(HeadCameraComponent->GetRelativeLocation()); RightHand->SetRelativeLocation(HeadCameraComponent->GetRelativeLocation());
} }
if (bMoveLeftHandWithMouse)
{
LeftHand->SetWorldRotation(HandOrientation);
LeftHand->SetRelativeLocation(HeadCameraComponent->GetRelativeLocation());
}
}
} }
void AVirtualRealityPawn::SetCameraOffset() const void AVirtualRealityPawn::SetCameraOffset() const
......
...@@ -41,6 +41,12 @@ public: ...@@ -41,6 +41,12 @@ public:
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Pawn|Camera") UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Pawn|Camera")
UCameraComponent* HeadCameraComponent; UCameraComponent* HeadCameraComponent;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Pawn|Desktop Movement")
bool bMoveRightHandWithMouse = true;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Pawn|Desktop Movement")
bool bMoveLeftHandWithMouse = false;
protected: protected:
virtual void SetupPlayerInputComponent(UInputComponent* PlayerInputComponent) override; virtual void SetupPlayerInputComponent(UInputComponent* PlayerInputComponent) override;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment