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
No related branches found
No related tags found
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
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)
{
if (RightHand)
......@@ -130,6 +142,10 @@ void AVirtualRealityPawn::OnTurnRate_Implementation(float Rate)
{
AddControllerYawInput(Rate * BaseTurnRate * GetWorld()->GetDeltaSeconds() * CustomTimeDilation);
}
if (UVirtualRealityUtilities::IsDesktopMode())
{
UpdateRightHandForDesktopInteraction();
}
}
void AVirtualRealityPawn::OnLookUpRate_Implementation(float Rate)
......
......@@ -55,4 +55,5 @@ protected:
bool bApplyDesktopRotation = false;
void SetCameraOffset() const;
void UpdateRightHandForDesktopInteraction();
};
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment