diff --git a/Source/RWTHVRToolkit/Private/Pawn/Navigation/ScalingComponent.cpp b/Source/RWTHVRToolkit/Private/Pawn/Navigation/ScalingComponent.cpp index b5ce41191503c545a4856476ed59f808e28aff79..74eaa7901a92040059c2bbd3dc12a0bbe9c7b3c4 100644 --- a/Source/RWTHVRToolkit/Private/Pawn/Navigation/ScalingComponent.cpp +++ b/Source/RWTHVRToolkit/Private/Pawn/Navigation/ScalingComponent.cpp @@ -84,6 +84,15 @@ void UScalingComponent::BeginPlay() AddEqualSizedComponent(VRPawn->LeftHand); AddEqualSizedComponent(VRPawn->RightHand); + // in case of cave, also at this to the equal sized components + if(VRPawn->CaveSetupActor) + { + UE_LOG(LogTemp,Display,TEXT("Cave Setup Actor is valid and will be added to equal Sized objects")) + //AddEqualSizedActor(VRPawn->CaveSetupActor); + } else + { + UE_LOG(LogTemp,Display,TEXT("Cave Setup Actor is invalid in ScalingComponent::BeginPlay()")) + } } @@ -239,6 +248,14 @@ void UScalingComponent::AdjustEqualSizedWorldObjects(float ScaleRatio) CurrActor->SetActorScale3D(CurrentScaling * ScaleRatio); } + if(VRPawn->CaveSetupActor) + { + + UE_LOG(LogTemp,Display,TEXT("Adjust Equal Sized World Objects: cave setup is scaled manually")) + FVector CurrentScaling = VRPawn->CaveSetupActor->GetActorScale3D(); + VRPawn->CaveSetupActor->SetActorScale3D(CurrentScaling * ScaleRatio); + } + // adjust scene components for (USceneComponent* CurrComponent : EqualSizedSceneComponents) { diff --git a/Source/RWTHVRToolkit/Private/Pawn/RWTHVRPawn.cpp b/Source/RWTHVRToolkit/Private/Pawn/RWTHVRPawn.cpp index 56d56cf05728cc0ce2140f47d0b39a19e0dc665c..16270f07e90f5d1453defa37191fccc9ff894422 100644 --- a/Source/RWTHVRToolkit/Private/Pawn/RWTHVRPawn.cpp +++ b/Source/RWTHVRToolkit/Private/Pawn/RWTHVRPawn.cpp @@ -248,8 +248,8 @@ void ARWTHVRPawn::AttachDCRAtoPawn() if (!FoundActors.IsEmpty()) { - const auto CaveSetupActor = FoundActors[0]; - FAttachmentTransformRules AttachmentRules = FAttachmentTransformRules::SnapToTargetNotIncludingScale; + CaveSetupActor = FoundActors[0]; + FAttachmentTransformRules AttachmentRules = FAttachmentTransformRules::SnapToTargetIncludingScale; CaveSetupActor->AttachToActor(this, AttachmentRules); UE_LOGFMT(Toolkit, Display, "VirtualRealityPawn: Attaching CaveSetup to our pawn!"); } diff --git a/Source/RWTHVRToolkit/Public/Pawn/RWTHVRPawn.h b/Source/RWTHVRToolkit/Public/Pawn/RWTHVRPawn.h index 490dffdf9445a9578e43cf15f6b062b73b70baf1..b462771e5ea40b648a6b9c97bc1b35a73d9a92f5 100644 --- a/Source/RWTHVRToolkit/Public/Pawn/RWTHVRPawn.h +++ b/Source/RWTHVRToolkit/Public/Pawn/RWTHVRPawn.h @@ -83,6 +83,9 @@ public: UPROPERTY(BlueprintReadOnly, EditAnywhere, Category = "Pawn|LiveLink") TSubclassOf<AActor> CaveSetupActorClass; + UPROPERTY() + AActor* CaveSetupActor; + protected: virtual void SetupPlayerInputComponent(UInputComponent* PlayerInputComponent) override; void AddInputMappingContext(const APlayerController* PC, const UInputMappingContext* Context) const;