From 3c7b20053a58ac01be0eb23fac0419b929f580fe Mon Sep 17 00:00:00 2001
From: David Gilbert <gilbert@vr.rwth-aachen.de>
Date: Tue, 6 Feb 2024 16:03:43 +0100
Subject: [PATCH] fix(cave): RegisterComponent now doesn't throw a nullptr
 anymore because SyncComponent was added as transient

---
 Source/RWTHVRToolkit/Private/Pawn/RWTHVRPawn.cpp | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/Source/RWTHVRToolkit/Private/Pawn/RWTHVRPawn.cpp b/Source/RWTHVRToolkit/Private/Pawn/RWTHVRPawn.cpp
index 28eb764a..62080986 100644
--- a/Source/RWTHVRToolkit/Private/Pawn/RWTHVRPawn.cpp
+++ b/Source/RWTHVRToolkit/Private/Pawn/RWTHVRPawn.cpp
@@ -50,9 +50,11 @@ void ARWTHVRPawn::BeginPlay()
 	// 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 = NewObject<UDisplayClusterSceneComponentSyncParent>();
-	SyncComponent->SetupAttachment(RootComponent);
+	SyncComponent = NewObject<UDisplayClusterSceneComponentSyncParent>(this);
+	// SyncComponent->SetupAttachment(RootComponent);
 	SyncComponent->RegisterComponent();
+
+	SyncComponent->AttachToComponent(RootComponent, FAttachmentTransformRules::SnapToTargetNotIncludingScale);
 #endif
 }
 
-- 
GitLab