UE5 CryptRaider - Sweep hits BP_Player

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

Have you checked the collision on both the capsule and mesh?

Collision capsule and both character meshes are set to ignore. The gargoyle is set to block.

Did i miss something? :frowning:

Are you sure GameTraceChannel2 is the correct channel?

Using the channel set in DefaultEngine.ini

Oh I see, you’re using 12 not 2

omg im so blind … thank you!

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms