Skip to content
Snippets Groups Projects
Commit 6aa47574 authored by Ehret's avatar Ehret
Browse files

update right hand, so interaction component is attaches to the mouse

parent 3a08aadd
Branches
Tags
3 merge requests!22Get changes and fixes from 4.26 into 5 as well,!16update 4.27 branch to newest changes in 4.26,!15Improve desktop test interaction
...@@ -99,6 +99,18 @@ void AVirtualRealityPawn::SetCameraOffset() const ...@@ -99,6 +99,18 @@ void AVirtualRealityPawn::SetCameraOffset() const
CameraComponent->SetWorldLocationAndRotation(Location, Rotation); CameraComponent->SetWorldLocationAndRotation(Location, Rotation);
} }
void AVirtualRealityPawn::UpdateRightHandForDesktopInteraction()
{
APlayerController* PC = Cast<APlayerController>(GetController());
if (PC)
{
FVector MouseLocation, MouseDirection;
PC->DeprojectMousePositionToWorld(MouseLocation, MouseDirection);
FRotator HandOrientation = MouseDirection.ToOrientationRotator();
RightHand->SetWorldRotation(HandOrientation);
}
}
void AVirtualRealityPawn::OnForward_Implementation(float Value) void AVirtualRealityPawn::OnForward_Implementation(float Value)
{ {
if (RightHand) if (RightHand)
...@@ -130,6 +142,10 @@ void AVirtualRealityPawn::OnTurnRate_Implementation(float Rate) ...@@ -130,6 +142,10 @@ void AVirtualRealityPawn::OnTurnRate_Implementation(float Rate)
{ {
AddControllerYawInput(Rate * BaseTurnRate * GetWorld()->GetDeltaSeconds() * CustomTimeDilation); AddControllerYawInput(Rate * BaseTurnRate * GetWorld()->GetDeltaSeconds() * CustomTimeDilation);
} }
if (UVirtualRealityUtilities::IsDesktopMode())
{
UpdateRightHandForDesktopInteraction();
}
} }
void AVirtualRealityPawn::OnLookUpRate_Implementation(float Rate) void AVirtualRealityPawn::OnLookUpRate_Implementation(float Rate)
......
...@@ -55,4 +55,5 @@ protected: ...@@ -55,4 +55,5 @@ protected:
bool bApplyDesktopRotation = false; bool bApplyDesktopRotation = false;
void SetCameraOffset() const; void SetCameraOffset() const;
void UpdateRightHandForDesktopInteraction();
}; };
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment