diff --git a/Source/RWTHVRToolkit/Private/Pawn/RWTHVRPawn.cpp b/Source/RWTHVRToolkit/Private/Pawn/RWTHVRPawn.cpp index 6208098604717f8da222341f57405d74acca6cbe..ea27c0ebab4a765daf2055bad92d6b68bb9211ea 100644 --- a/Source/RWTHVRToolkit/Private/Pawn/RWTHVRPawn.cpp +++ b/Source/RWTHVRToolkit/Private/Pawn/RWTHVRPawn.cpp @@ -50,11 +50,10 @@ 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>(this); - // SyncComponent->SetupAttachment(RootComponent); - SyncComponent->RegisterComponent(); - SyncComponent->AttachToComponent(RootComponent, FAttachmentTransformRules::SnapToTargetNotIncludingScale); + SyncComponent = Cast<USceneComponent>(AddComponentByClass(UDisplayClusterSceneComponentSyncParent::StaticClass(), + false, FTransform::Identity, false)); + AddInstanceComponent(SyncComponent); #endif }