diff --git a/Content/BP_CaveSetup.uasset b/Content/BP_CaveSetup.uasset deleted file mode 100644 index e460e3d99b640f1e6996f0f243a89a6e2b4900cf..0000000000000000000000000000000000000000 Binary files a/Content/BP_CaveSetup.uasset and /dev/null differ diff --git a/Content/Config/ExampleConfigs/NDC_CaveUnwrap.ndisplay b/Content/Config/ExampleConfigs/NDC_CaveUnwrap.ndisplay index 72f605563e2f335dfbb27c6b83dcd378062fe453..76f41033352e2a62a07198def9a74a0fbb1e8669 100644 --- a/Content/Config/ExampleConfigs/NDC_CaveUnwrap.ndisplay +++ b/Content/Config/ExampleConfigs/NDC_CaveUnwrap.ndisplay @@ -8,7 +8,8 @@ { "bFollowLocalPlayerCamera": false, "bExitOnEsc": true, - "bOverrideViewportsFromExternalConfig": true + "bOverrideViewportsFromExternalConfig": true, + "bOverrideTransformsFromExternalConfig": false }, "scene": { diff --git a/Content/Config/aixcave.uasset b/Content/Config/aixcave.uasset index 14b3a291ae507cbd495770b0d5c3e24777756ca2..5cd1ab9bc2f7aa0d28138cd7482c7c95a7cde317 100644 Binary files a/Content/Config/aixcave.uasset and b/Content/Config/aixcave.uasset differ diff --git a/Source/RWTHVRCluster/Private/CaveSetup.cpp b/Source/RWTHVRCluster/Private/CaveSetupComponent.cpp similarity index 73% rename from Source/RWTHVRCluster/Private/CaveSetup.cpp rename to Source/RWTHVRCluster/Private/CaveSetupComponent.cpp index 369f4e998f801a5638b02ac41ed79fb92fc61c89..9688e36d93c1be44597328a166a66e8b5ba3edd2 100644 --- a/Source/RWTHVRCluster/Private/CaveSetup.cpp +++ b/Source/RWTHVRCluster/Private/CaveSetupComponent.cpp @@ -1,26 +1,22 @@ // Fill out your copyright notice in the Description page of Project Settings. -#include "CaveSetup.h" - +#include "CaveSetupComponent.h" +#include "LiveLinkPreset.h" #include "Logging/StructuredLog.h" #include "Utility/RWTHVRClusterUtilities.h" -// Sets default values -ACaveSetup::ACaveSetup() +UCaveSetupComponent::UCaveSetupComponent() { - PrimaryActorTick.bCanEverTick = false; - SetActorEnableCollision(false); - - // Actor needs to replicate, as it is attached to the pawn on the server. - bReplicates = true; + PrimaryComponentTick.bCanEverTick = false; + SetIsReplicatedByDefault(false); } -// Called when the game starts or when spawned -void ACaveSetup::BeginPlay() +void UCaveSetupComponent::BeginPlay() { Super::BeginPlay(); + if (!URWTHVRClusterUtilities::IsRoomMountedMode()) { UE_LOGFMT(RWTHVRCluster, Display, "CaveSetup: Not in RoomMountedMode, doing nothing."); @@ -33,7 +29,7 @@ void ACaveSetup::BeginPlay() if (const auto World = GetWorld()) { const auto Actor = World->SpawnActor(ActorClass); - Actor->AttachToActor(this, FAttachmentTransformRules::SnapToTargetNotIncludingScale); + Actor->AttachToActor(GetOwner(), FAttachmentTransformRules::SnapToTargetNotIncludingScale); UE_LOGFMT(RWTHVRCluster, Display, "CaveSetup: Spawned Actor {Actor} on the Cave and attached it.", Actor->GetName()); } diff --git a/Source/RWTHVRCluster/Public/CaveSetup.h b/Source/RWTHVRCluster/Public/CaveSetup.h deleted file mode 100644 index 793d72c9ff419ce35aade0784a2d076cbff3a37e..0000000000000000000000000000000000000000 --- a/Source/RWTHVRCluster/Public/CaveSetup.h +++ /dev/null @@ -1,33 +0,0 @@ -// Fill out your copyright notice in the Description page of Project Settings. - -#pragma once - -#include "CoreMinimal.h" -#include "LiveLinkPreset.h" -#include "GameFramework/Actor.h" -#include "CaveSetup.generated.h" - -/** - * Simple Actor that needs to be added to the level which spawns Cave-related actors - * such as the CaveOverlay. - * It attaches itself to the Primary Node's Pawn and then replicates on the server. - */ - -UCLASS(hideCategories = (Rendering, Input, Actor, Base, Collision, Shape, Physics, HLOD)) -class RWTHVRCLUSTER_API ACaveSetup : public AActor -{ - GENERATED_BODY() - -public: - ACaveSetup(); - - UPROPERTY(EditAnywhere) - TArray<UClass*> ActorsToSpawnOnCave; - - UPROPERTY(EditAnywhere, BlueprintReadWrite) - ULiveLinkPreset* LiveLinkPresetToApplyOnCave; - -protected: - // Called when the game starts or when spawned - virtual void BeginPlay() override; -}; diff --git a/Source/RWTHVRCluster/Public/CaveSetupComponent.h b/Source/RWTHVRCluster/Public/CaveSetupComponent.h new file mode 100644 index 0000000000000000000000000000000000000000..8e2e30ebf6a31cc337fb76fba5a70794190dc199 --- /dev/null +++ b/Source/RWTHVRCluster/Public/CaveSetupComponent.h @@ -0,0 +1,30 @@ +// Fill out your copyright notice in the Description page of Project Settings. + +#pragma once + +#include "CoreMinimal.h" + +#include "CaveSetupComponent.generated.h" + +class ULiveLinkPreset; + +UCLASS(ClassGroup = (Custom), meta = (BlueprintSpawnableComponent), + hideCategories = (Rendering, Input, Actor, Base, Collision, Shape, Physics, HLOD)) +class RWTHVRCLUSTER_API UCaveSetupComponent : public UActorComponent +{ + GENERATED_BODY() + +public: + // Sets default values for this component's properties + UCaveSetupComponent(); + + UPROPERTY(EditAnywhere) + TArray<UClass*> ActorsToSpawnOnCave; + + UPROPERTY(EditAnywhere, BlueprintReadWrite) + ULiveLinkPreset* LiveLinkPresetToApplyOnCave; + +protected: + // Called when the game starts + virtual void BeginPlay() override; +};