diff --git a/Source/RWTHVRToolkit/Private/Pawn/ClusterRepresentationActor.cpp b/Source/RWTHVRToolkit/Private/Pawn/ClusterRepresentationActor.cpp index d6b2f4f0a197652d70f41be824f3443568664e1a..59dc1f4eb177950063a51dd0b8ec5086681e1041 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 c3c041f83ed704ec76b9f9dc1d78f7d3e106b819..7826cb001ff5b5ea035f3e6b96920c3edb215138 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 };