From 1ce174ce76b7a449eb98d136f847d5c20c583c24 Mon Sep 17 00:00:00 2001 From: David Gilbert <gilbert@vr.rwth-aachen.de> Date: Mon, 3 Feb 2025 10:06:40 +0100 Subject: [PATCH] fix(pawn): Fixes issue with setting player type to hmd, it was never actually set. --- Source/RWTHVRToolkit/Private/Pawn/RWTHVRPawn.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Source/RWTHVRToolkit/Private/Pawn/RWTHVRPawn.cpp b/Source/RWTHVRToolkit/Private/Pawn/RWTHVRPawn.cpp index f6f9f1c..ba4519c 100644 --- a/Source/RWTHVRToolkit/Private/Pawn/RWTHVRPawn.cpp +++ b/Source/RWTHVRToolkit/Private/Pawn/RWTHVRPawn.cpp @@ -122,14 +122,18 @@ void ARWTHVRPawn::SetupPlayerInputComponent(UInputComponent* PlayerInputComponen if (ARWTHVRPlayerState* State = GetPlayerState<ARWTHVRPlayerState>()) { // Might not be properly synced yet? - const EPlayerType Type = State->GetPlayerType(); + EPlayerType Type = State->GetPlayerType(); // Don't do anything with the type if it's been set to clustertype or anything. // This is already being done when connecting to the server. const bool bClusterType = Type == EPlayerType::nDisplayPrimary || Type == EPlayerType::nDisplaySecondary; - - if (!bClusterType && URWTHVRUtilities::IsHeadMountedMode()) + + if (!bClusterType) { + if (URWTHVRUtilities::IsHeadMountedMode()) + Type = EPlayerType::HMD; + + UE_LOGFMT(Toolkit, Display, "Pawn: Requesting Player Type {T}...", StaticCast<int8>(Type)); // Could be too early to call this RPC... State->RequestSetPlayerType(Type); } -- GitLab