Skip to content
Snippets Groups Projects
Commit 59aa41f6 authored by David Gilbert's avatar David Gilbert :bug:
Browse files

fix(cave): Adds #if guards around nDisplay code in Toolkit

parent 27e6d4f1
Branches
No related tags found
2 merge requests!107UE5.4-2024.1-rc1,!98Improved join/attachment logic for clusters to support multi-cluster connections at some point
Pipeline #440841 passed
...@@ -2,15 +2,17 @@ ...@@ -2,15 +2,17 @@
#include "Pawn/ClusterRepresentationActor.h" #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 "DisplayClusterRootActor.h"
#include "IDisplayCluster.h" #include "IDisplayCluster.h"
#include "Config/IDisplayClusterConfigManager.h" #include "Config/IDisplayClusterConfigManager.h"
#include "Core/RWTHVRPlayerState.h"
#include "Game/IDisplayClusterGameManager.h" #include "Game/IDisplayClusterGameManager.h"
#include "Kismet/GameplayStatics.h" #endif
#include "Logging/StructuredLog.h"
#include "Utility/RWTHVRUtilities.h"
// Sets default values // Sets default values
AClusterRepresentationActor::AClusterRepresentationActor() AClusterRepresentationActor::AClusterRepresentationActor()
...@@ -41,6 +43,8 @@ void AClusterRepresentationActor::AttachDCRAIfRequired(const ARWTHVRPlayerState* ...@@ -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 // - 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. // have replicated this actor to our client, we're good to go.
#if PLATFORM_SUPPORTS_CLUSTER
if (!URWTHVRUtilities::IsRoomMountedMode()) if (!URWTHVRUtilities::IsRoomMountedMode())
return; return;
...@@ -82,17 +86,12 @@ void AClusterRepresentationActor::AttachDCRAIfRequired(const ARWTHVRPlayerState* ...@@ -82,17 +86,12 @@ void AClusterRepresentationActor::AttachDCRAIfRequired(const ARWTHVRPlayerState*
bIsAttached = AttachDCRA(); bIsAttached = AttachDCRA();
} }
#endif
} }
#if PLATFORM_SUPPORTS_CLUSTER
bool AClusterRepresentationActor::AttachDCRA() 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()) if (URWTHVRUtilities::IsRoomMountedMode())
{ {
UE_LOGFMT(Toolkit, Display, "{Name}: Trying to attach DCRA", GetName()); UE_LOGFMT(Toolkit, Display, "{Name}: Trying to attach DCRA", GetName());
...@@ -125,7 +124,6 @@ bool AClusterRepresentationActor::AttachDCRA() ...@@ -125,7 +124,6 @@ bool AClusterRepresentationActor::AttachDCRA()
DCRA->SetActorEnableCollision(false); DCRA->SetActorEnableCollision(false);
} }
#endif
return true; return true;
} }
...@@ -159,3 +157,5 @@ ADisplayClusterRootActor* AClusterRepresentationActor::SpawnDCRA() ...@@ -159,3 +157,5 @@ ADisplayClusterRootActor* AClusterRepresentationActor::SpawnDCRA()
} }
return RootActor; return RootActor;
} }
#endif
...@@ -8,7 +8,9 @@ ...@@ -8,7 +8,9 @@
class ARWTHVRPlayerState; class ARWTHVRPlayerState;
#if PLATFORM_SUPPORTS_CLUSTER
class ADisplayClusterRootActor; class ADisplayClusterRootActor;
#endif
UCLASS() UCLASS()
class RWTHVRTOOLKIT_API AClusterRepresentationActor : public AActor class RWTHVRTOOLKIT_API AClusterRepresentationActor : public AActor
...@@ -24,8 +26,11 @@ public: ...@@ -24,8 +26,11 @@ public:
void AttachDCRAIfRequired(const ARWTHVRPlayerState* OptionalPlayerState = nullptr); void AttachDCRAIfRequired(const ARWTHVRPlayerState* OptionalPlayerState = nullptr);
private: private:
bool bIsAttached = false;
#if PLATFORM_SUPPORTS_CLUSTER
bool AttachDCRA(); bool AttachDCRA();
ADisplayClusterRootActor* SpawnDCRA(); ADisplayClusterRootActor* SpawnDCRA();
bool bIsAttached = false; #endif
}; };
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment