diff --git a/Source/RWTHVRToolkit/Private/Interaction/Interactors/DirectInteractionComponent.cpp b/Source/RWTHVRToolkit/Private/Interaction/Interactors/DirectInteractionComponent.cpp index 5de410ffdecabb93d61eb71b4f4560c38a2d6938..c8cf9ce35e45d0bc107cd73da08333ef5ba5b2d9 100644 --- a/Source/RWTHVRToolkit/Private/Interaction/Interactors/DirectInteractionComponent.cpp +++ b/Source/RWTHVRToolkit/Private/Interaction/Interactors/DirectInteractionComponent.cpp @@ -112,7 +112,8 @@ void UDirectInteractionComponent::OnBeginInteraction(const FInputActionValue& Va if (bOnlyInteractWithClosestActor) { auto MinElement = *Algo::MinElementBy( - CurrentInteractableComponentsInRange, [&](auto Element) + CurrentInteractableComponentsInRange, + [&](auto Element) { return FVector(Element->GetOwner()->GetActorLocation() - InteractionLocation).Size(); }); MinElement->HandleOnActionStartEvents(this, InteractionInputAction, Value, EInteractorType::Direct); CurrentlyInteractedComponents = {MinElement};