From 8dd3010c03bbd82aa1d6df3e4c40d6d6a8469db7 Mon Sep 17 00:00:00 2001 From: Kris Helwig <helwig@vr.rwth-aachen.de> Date: Tue, 8 Apr 2025 13:03:11 +0200 Subject: [PATCH] refactor(pawn): changes from a delegate approach to an interface approach --- Source/RWTHVRToolkit/Private/Pawn/RWTHVRPawn.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/Source/RWTHVRToolkit/Private/Pawn/RWTHVRPawn.cpp b/Source/RWTHVRToolkit/Private/Pawn/RWTHVRPawn.cpp index dc9c902..31874d9 100644 --- a/Source/RWTHVRToolkit/Private/Pawn/RWTHVRPawn.cpp +++ b/Source/RWTHVRToolkit/Private/Pawn/RWTHVRPawn.cpp @@ -18,6 +18,10 @@ #include "Utility/RWTHVRUtilities.h" #if PLATFORM_SUPPORTS_CLUSTER +#include "DisplayClusterRootActor.h" +#include "ScalableConfigInterface.h" +#include "IDisplayCluster.h" +#include "Game/IDisplayClusterGameManager.h" #include "Components/DisplayClusterSceneComponentSyncParent.h" #endif @@ -85,7 +89,16 @@ void ARWTHVRPawn::SetScale(float NewScale) FVector NewScaleVector = FVector(UniformScale, UniformScale, UniformScale); GetWorldSettings()->WorldToMeters = InitialWorldToMeters * UniformScale; SetActorRelativeScale3D(NewScaleVector); - OnScaleChanged.Broadcast(OldScale, NewScale); + +#if PLATFORM_SUPPORTS_CLUSTER + const ARWTHVRPlayerState* State = GetPlayerState<ARWTHVRPlayerState>(); + if (URWTHVRUtilities::IsHeadMountedMode() && State && State->GetCorrespondingClusterActor()) + { + const auto ClusterRootActor = IDisplayCluster::Get().GetGameMgr()->GetRootActor(); + IScalableConfigInterface* ConfigInterface = Cast<IScalableConfigInterface>(ClusterRootActor); + ConfigInterface->OnScaleChanged(NewScale); + } +#endif } float ARWTHVRPawn::GetScale() { return UniformScale; } -- GitLab