Skip to content
Snippets Groups Projects
Commit 3e60730d authored by Daniel Rupp's avatar Daniel Rupp
Browse files

fix(interaction): change hit actor to parent, hit actor of sphere cast is a child actor

parent 2b82ad57
No related branches found
No related tags found
No related merge requests found
Pipeline #331659 failed
...@@ -28,6 +28,7 @@ void UGrabComponent::TickComponent(float DeltaTime, ELevelTick TickType, FActorC ...@@ -28,6 +28,7 @@ void UGrabComponent::TickComponent(float DeltaTime, ELevelTick TickType, FActorC
TArray<UInteractableComponent*> CurrentGrabCompsInRange; TArray<UInteractableComponent*> CurrentGrabCompsInRange;
TArray<AActor*> ActorsToIgnore; TArray<AActor*> ActorsToIgnore;
ActorsToIgnore.Add(GetOwner());
TArray<FHitResult> OutHits; TArray<FHitResult> OutHits;
const ETraceTypeQuery TraceType = UEngineTypes::ConvertToTraceType(ECollisionChannel::ECC_PhysicsBody); const ETraceTypeQuery TraceType = UEngineTypes::ConvertToTraceType(ECollisionChannel::ECC_PhysicsBody);
...@@ -43,6 +44,10 @@ void UGrabComponent::TickComponent(float DeltaTime, ELevelTick TickType, FActorC ...@@ -43,6 +44,10 @@ void UGrabComponent::TickComponent(float DeltaTime, ELevelTick TickType, FActorC
AActor* HitActor = Hit.GetActor(); AActor* HitActor = Hit.GetActor();
if (HitActor) if (HitActor)
{ {
if(HitActor->IsChildActor())
{
HitActor = HitActor->GetParentActor();// search at parent if found actor is a child actor
}
UInteractableComponent* Grabbable = HitActor->FindComponentByClass<UInteractableComponent>(); UInteractableComponent* Grabbable = HitActor->FindComponentByClass<UInteractableComponent>();
if (Grabbable && Grabbable->HasInteractionTypeFlag(EInteractorType::Grab) && Grabbable->IsInteractable) if (Grabbable && Grabbable->HasInteractionTypeFlag(EInteractorType::Grab) && Grabbable->IsInteractable)
{ {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment