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

fix(cave): Fixes crash when playing normally in desktop

parent 992d2776
Branches
Tags
2 merge requests!107UE5.4-2024.1-rc1,!98Improved join/attachment logic for clusters to support multi-cluster connections at some point
Pipeline #440347 failed
......@@ -78,7 +78,7 @@ void ARWTHVRPawn::NotifyControllerChanged()
// Only cluster types are valid here as they are set on connection.
// For all other player types this is a race condition
if (Type == EPlayerType::nDisplayPrimary || GetNetMode() == NM_Standalone)
if (Type == EPlayerType::nDisplayPrimary || Type == EPlayerType::nDisplaySecondary)
{
UE_LOGFMT(Toolkit, Display, "ARWTHVRPawn: Attaching Cluster to Pawn {Pawn}.", GetName());
AttachClustertoPawn();
......@@ -266,14 +266,17 @@ void ARWTHVRPawn::AttachClustertoPawn()
if (const ARWTHVRPlayerState* State = GetPlayerState<ARWTHVRPlayerState>())
{
if (!State->GetCorrespondingClusterActor())
const auto ClusterActor = State->GetCorrespondingClusterActor();
if (!ClusterActor)
{
UE_LOGFMT(
Toolkit, Error,
"ARWTHVRPawn::AttachClustertoPawn: GetCorrespondingClusterActor returned null! This won't work on "
"the Cave.");
return;
}
const FAttachmentTransformRules AttachmentRules = FAttachmentTransformRules::SnapToTargetNotIncludingScale;
bool bAttached = State->GetCorrespondingClusterActor()->AttachToComponent(GetRootComponent(), AttachmentRules);
bool bAttached = ClusterActor->AttachToComponent(GetRootComponent(), AttachmentRules);
// State->GetCorrespondingClusterActor()->OnAttached();
UE_LOGFMT(Toolkit, Display,
"ARWTHVRPawn: Attaching corresponding cluster actor to our pawn returned: {Attached}", bAttached);
......
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment