Skip to content
Snippets Groups Projects
Commit 3b863170 authored by David Gilbert's avatar David Gilbert :bug:
Browse files

feature(replication): Adds initial support for multiple clusters joining the same server.

For that, the attachment process is restructured.
parent f4a48b57
Branches
No related tags found
2 merge requests!4New attachment process and multiple clusters,!3feature(replication): Adds initial support for multiple clusters joining the same server.
File deleted
......@@ -8,7 +8,8 @@
{
"bFollowLocalPlayerCamera": false,
"bExitOnEsc": true,
"bOverrideViewportsFromExternalConfig": true
"bOverrideViewportsFromExternalConfig": true,
"bOverrideTransformsFromExternalConfig": false
},
"scene":
{
......
No preview for this file type
// 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());
}
......
......@@ -3,23 +3,20 @@
#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
#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:
ACaveSetup();
// Sets default values for this component's properties
UCaveSetupComponent();
UPROPERTY(EditAnywhere)
TArray<UClass*> ActorsToSpawnOnCave;
......@@ -28,6 +25,6 @@ public:
ULiveLinkPreset* LiveLinkPresetToApplyOnCave;
protected:
// Called when the game starts or when spawned
// Called when the game starts
virtual void BeginPlay() override;
};
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment