From 9436d168751a9fd28de97a2683571c3aea8091e2 Mon Sep 17 00:00:00 2001 From: baz Date: Mon, 25 Nov 2024 02:38:50 +0000 Subject: [PATCH] Set timeline start point OnOverlap --- Source/vampires/Pickup.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Source/vampires/Pickup.cpp b/Source/vampires/Pickup.cpp index 01c3200..faa37e3 100644 --- a/Source/vampires/Pickup.cpp +++ b/Source/vampires/Pickup.cpp @@ -78,6 +78,14 @@ void APickup::OnOuterBeginOverlap(UPrimitiveComponent* OverlappedComponent, AAct { PickupLocation = GetActorLocation(); PlayTimeLine(); + + double dist = FVector::Distance(GetActorLocation(), PlayerCharacter->GetActorLocation()); + + if (dist < OuterSphereComponent->GetScaledSphereRadius()) + { + double ratio = FMath::Abs((dist / OuterSphereComponent->GetScaledSphereRadius()) - 1.0f); + TimelineComponent->SetNewTime(ratio); + } } }