Hi,
My issue is that my SweepSingleByChannel always hits BP_Player
LogTemp: Display: Hit actor: BP_Player
LogTemp: Display: Released
void UGrabber::Grab()
{
FVector Start = GetComponentLocation();
FVector End = Start + GetForwardVector() * MaxGrabDistance;
DrawDebugLine(GetWorld(), Start, End, FColor::Red);
FCollisionShape Sphere = FCollisionShape::MakeSphere(GrabRadius);
FHitResult HitResult;
bool HasHit = GetWorld()->SweepSingleByChannel(
HitResult,
Start,
End,
FQuat::Identity,
ECC_GameTraceChannel12,
Sphere
);
if (HasHit)
{
DrawDebugSphere(GetWorld(), HitResult.ImpactPoint, 10, 10, FColor::Green, false, 5);
AActor* HitActor = HitResult.GetActor();
UE_LOG(LogTemp, Display, TEXT("Hit actor: %s"), *HitActor->GetActorNameOrLabel());
}
else {
UE_LOG(LogTemp, Display, TEXT("No actor hit"));
}
}
Gargoyle collision is custom and set to block for the grabber.
Trace channels - Grabber is set to Ignore
BP_Player collisions are set to ignore