diff --git a/Source/RWTHVRToolkit/Private/Pawn/RWTHVRPawn.cpp b/Source/RWTHVRToolkit/Private/Pawn/RWTHVRPawn.cpp index ee080a87..c6653b37 100644 --- a/Source/RWTHVRToolkit/Private/Pawn/RWTHVRPawn.cpp +++ b/Source/RWTHVRToolkit/Private/Pawn/RWTHVRPawn.cpp @@ -35,6 +35,14 @@ ARWTHVRPawn::ARWTHVRPawn(const FObjectInitializer& ObjectInitializer) : Super(Ob LeftHand = CreateDefaultSubobject(TEXT("Left Hand MCC")); LeftHand->SetupAttachment(RootComponent); + + // 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); } 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*/