Set timeline start point OnOverlap

This commit is contained in:
baz 2024-11-25 02:38:50 +00:00
parent 3642b9418b
commit 9436d16875
1 changed files with 8 additions and 0 deletions

View File

@ -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);
}
}
}