From 59aa41f6854d55ec555cdad512d2a6d52f32a00d Mon Sep 17 00:00:00 2001 From: David Gilbert <gilbert@vr.rwth-aachen.de> Date: Tue, 6 Aug 2024 17:05:28 +0200 Subject: [PATCH] fix(cave): Adds #if guards around nDisplay code in Toolkit --- .../Pawn/ClusterRepresentationActor.cpp | 26 +++++++++---------- .../Public/Pawn/ClusterRepresentationActor.h | 7 ++++- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/Source/RWTHVRToolkit/Private/Pawn/ClusterRepresentationActor.cpp b/Source/RWTHVRToolkit/Private/Pawn/ClusterRepresentationActor.cpp index d6b2f4f0..59dc1f4e 100644 --- a/Source/RWTHVRToolkit/Private/Pawn/ClusterRepresentationActor.cpp +++ b/Source/RWTHVRToolkit/Private/Pawn/ClusterRepresentationActor.cpp @@ -2,15 +2,17 @@ #include "Pawn/ClusterRepresentationActor.h" +#include "Core/RWTHVRPlayerState.h" +#include "Kismet/GameplayStatics.h" +#include "Logging/StructuredLog.h" +#include "Utility/RWTHVRUtilities.h" +#if PLATFORM_SUPPORTS_CLUSTER #include "DisplayClusterRootActor.h" #include "IDisplayCluster.h" #include "Config/IDisplayClusterConfigManager.h" -#include "Core/RWTHVRPlayerState.h" #include "Game/IDisplayClusterGameManager.h" -#include "Kismet/GameplayStatics.h" -#include "Logging/StructuredLog.h" -#include "Utility/RWTHVRUtilities.h" +#endif // Sets default values AClusterRepresentationActor::AClusterRepresentationActor() @@ -41,6 +43,8 @@ void AClusterRepresentationActor::AttachDCRAIfRequired(const ARWTHVRPlayerState* // - If we are a client, this actor has been spawned on the server only. Therefore I assume that if we // have replicated this actor to our client, we're good to go. +#if PLATFORM_SUPPORTS_CLUSTER + if (!URWTHVRUtilities::IsRoomMountedMode()) return; @@ -82,17 +86,12 @@ void AClusterRepresentationActor::AttachDCRAIfRequired(const ARWTHVRPlayerState* bIsAttached = AttachDCRA(); } +#endif } +#if PLATFORM_SUPPORTS_CLUSTER bool AClusterRepresentationActor::AttachDCRA() { - -#if PLATFORM_SUPPORTS_CLUSTER - // Add an nDisplay Parent Sync Component. It syncs the parent's transform from master to clients. - // This is required because for collision based movement, it can happen that the physics engine - // for some reason acts different on the nodes, therefore leading to a potential desync when - // e.g. colliding with an object while moving. - if (URWTHVRUtilities::IsRoomMountedMode()) { UE_LOGFMT(Toolkit, Display, "{Name}: Trying to attach DCRA", GetName()); @@ -125,7 +124,6 @@ bool AClusterRepresentationActor::AttachDCRA() DCRA->SetActorEnableCollision(false); } -#endif return true; } @@ -158,4 +156,6 @@ ADisplayClusterRootActor* AClusterRepresentationActor::SpawnDCRA() } } return RootActor; -} \ No newline at end of file +} + +#endif diff --git a/Source/RWTHVRToolkit/Public/Pawn/ClusterRepresentationActor.h b/Source/RWTHVRToolkit/Public/Pawn/ClusterRepresentationActor.h index c3c041f8..7826cb00 100644 --- a/Source/RWTHVRToolkit/Public/Pawn/ClusterRepresentationActor.h +++ b/Source/RWTHVRToolkit/Public/Pawn/ClusterRepresentationActor.h @@ -8,7 +8,9 @@ class ARWTHVRPlayerState; +#if PLATFORM_SUPPORTS_CLUSTER class ADisplayClusterRootActor; +#endif UCLASS() class RWTHVRTOOLKIT_API AClusterRepresentationActor : public AActor @@ -24,8 +26,11 @@ public: void AttachDCRAIfRequired(const ARWTHVRPlayerState* OptionalPlayerState = nullptr); private: + bool bIsAttached = false; + +#if PLATFORM_SUPPORTS_CLUSTER bool AttachDCRA(); ADisplayClusterRootActor* SpawnDCRA(); - bool bIsAttached = false; +#endif }; -- GitLab