From 609a157a6d97265a359fa83be3b1b49b86c321c7 Mon Sep 17 00:00:00 2001 From: jehret Date: Wed, 29 Nov 2023 16:41:54 +0100 Subject: [PATCH 1/3] fix(pawn): add sync component to pawn --- Source/RWTHVRToolkit/Private/Pawn/RWTHVRPawn.cpp | 6 ++++++ Source/RWTHVRToolkit/Public/Pawn/RWTHVRPawn.h | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/Source/RWTHVRToolkit/Private/Pawn/RWTHVRPawn.cpp b/Source/RWTHVRToolkit/Private/Pawn/RWTHVRPawn.cpp index ee080a87..3af65be4 100644 --- a/Source/RWTHVRToolkit/Private/Pawn/RWTHVRPawn.cpp +++ b/Source/RWTHVRToolkit/Private/Pawn/RWTHVRPawn.cpp @@ -35,6 +35,12 @@ ARWTHVRPawn::ARWTHVRPawn(const FObjectInitializer& ObjectInitializer) : Super(Ob LeftHand = CreateDefaultSubobject(TEXT("Left Hand MCC")); LeftHand->SetupAttachment(RootComponent); + + // add a nDisplay + SyncComponent = + CreateDefaultSubobject(TEXT("Parent Display Cluster Sync Component")); + SyncComponent->SetupAttachment(RootComponent); + } void ARWTHVRPawn::Tick(float DeltaSeconds) diff --git a/Source/RWTHVRToolkit/Public/Pawn/RWTHVRPawn.h b/Source/RWTHVRToolkit/Public/Pawn/RWTHVRPawn.h index 20011926..9cf9340a 100644 --- a/Source/RWTHVRToolkit/Public/Pawn/RWTHVRPawn.h +++ b/Source/RWTHVRToolkit/Public/Pawn/RWTHVRPawn.h @@ -5,6 +5,9 @@ #include "CoreMinimal.h" #include "LiveLinkRole.h" #include "Pawn/Navigation/CollisionHandlingMovement.h" + +#include "Components/DisplayClusterSceneComponentSyncParent.h" + #include "RWTHVRPawn.generated.h" class UInputMappingContext; @@ -48,6 +51,9 @@ class RWTHVRTOOLKIT_API ARWTHVRPawn : public APawn UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Pawn|Camera") UCameraComponent* HeadCameraComponent; + UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Pawn|Camera") + UDisplayClusterSceneComponentSyncParent* SyncComponent; + // LiveLink functionality /* Set whether nDisplay should disable LiveLink tracking*/ From 30245c2c509c573e80ad5982fdc03eaf9dee502d Mon Sep 17 00:00:00 2001 From: jehret Date: Wed, 29 Nov 2023 17:32:31 +0100 Subject: [PATCH 2/3] style(clang-format) --- Source/RWTHVRToolkit/Private/Pawn/RWTHVRPawn.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/Source/RWTHVRToolkit/Private/Pawn/RWTHVRPawn.cpp b/Source/RWTHVRToolkit/Private/Pawn/RWTHVRPawn.cpp index 3af65be4..721823fe 100644 --- a/Source/RWTHVRToolkit/Private/Pawn/RWTHVRPawn.cpp +++ b/Source/RWTHVRToolkit/Private/Pawn/RWTHVRPawn.cpp @@ -40,7 +40,6 @@ ARWTHVRPawn::ARWTHVRPawn(const FObjectInitializer& ObjectInitializer) : Super(Ob SyncComponent = CreateDefaultSubobject(TEXT("Parent Display Cluster Sync Component")); SyncComponent->SetupAttachment(RootComponent); - } void ARWTHVRPawn::Tick(float DeltaSeconds) From e31ba9ffc21d50b13170759578aee452115cd701 Mon Sep 17 00:00:00 2001 From: David Gilbert Date: Wed, 29 Nov 2023 18:01:09 +0100 Subject: [PATCH 3/3] docs(pawn): adds some more comments on qhy we need sync comp --- Source/RWTHVRToolkit/Private/Pawn/RWTHVRPawn.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Source/RWTHVRToolkit/Private/Pawn/RWTHVRPawn.cpp b/Source/RWTHVRToolkit/Private/Pawn/RWTHVRPawn.cpp index 721823fe..c6653b37 100644 --- a/Source/RWTHVRToolkit/Private/Pawn/RWTHVRPawn.cpp +++ b/Source/RWTHVRToolkit/Private/Pawn/RWTHVRPawn.cpp @@ -36,7 +36,10 @@ ARWTHVRPawn::ARWTHVRPawn(const FObjectInitializer& ObjectInitializer) : Super(Ob LeftHand = CreateDefaultSubobject(TEXT("Left Hand MCC")); LeftHand->SetupAttachment(RootComponent); - // add a nDisplay + // 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. SyncComponent = CreateDefaultSubobject(TEXT("Parent Display Cluster Sync Component")); SyncComponent->SetupAttachment(RootComponent);