# Collision on static mesh not being detected

**URL:** <https://forums.unrealengine.com/t/collision-on-static-mesh-not-being-detected/1687036>\
**Category:** C++\
**Tags:** Trace, line-trace, collision-detection, unreal-engine, collision-responses, Collision, staticmesh, CPP, question\
**Created:** [February 13, 2024, 9:53pm UTC](https://forums.unrealengine.com/t/collision-on-static-mesh-not-being-detected/1687036 "2024-02-13T21:53:48Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![TheoRat3](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/theorat3/32/897542_2.png) [@TheoRat3](https://forums.unrealengine.com/u/TheoRat3)\
**Post date:** [February 13, 2024, 9:53pm UTC](https://forums.unrealengine.com/t/collision-on-static-mesh-not-being-detected/1687036/1 "2024-02-13T21:53:48Z")

</div>

I’m making an ability where weak points are spawned on to enemy skeletal meshes. However when spawned my line trace doesn’t seem to be detecting them. I made it so that my weak point blueprint class blocks the line trace I use for bullets, but still the bullets are passing right through the weak points and hitting the enemies. I assume it’s an issue with the static mesh I use for the weak points collision, but I’m having a hard time remedying the issue. I tried adding a simple box collision, and when spawning the weakpoints some enemies got launched in the air so clearly some kind of collision is happening, just not with my line trace.

Weak point mesh

 ![Screenshot (812)](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/f/e/2fed8e4324ca4564ecb24028e74c90b4551a4382.jpeg)

weak point BP collision panel

 ![Screenshot (813)](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/e/3/1e3c851b7bce3f040ef3be595fe3bc14323ff471.png)

The line trace logic from my Gun.CPP

```auto
void AGun::PullTrigger()
{
	APawn* OwnerPawn = Cast<APawn>(GetOwner()); 
	if(!OwnerPawn) return;
	AController* OwnerController = OwnerPawn->GetController();
	if(!OwnerController) return;

	FVector Location;
	FRotator Rotation;
	OwnerController->GetPlayerViewPoint(Location, Rotation);

	FVector End = Location + Rotation.Vector() * MaxRange; 

	FHitResult Hit;
	bool bHitSuccess = GetWorld()->LineTraceSingleByChannel(Hit, Location, 
    End, ECollisionChannel::ECC_GameTraceChannel1);

	if(bHitSuccess)
	{	
		FVector ShotDirection = -Rotation.Vector();
		
		AActor* HitActor = Hit.GetActor();
		if(HitActor)
		{
			if(HitActor->IsA(AWeakPoint::StaticClass()))
			{
                //Not going off
				UE_LOG(LogTemp, Warning, TEXT("WeakPoint Hit")); 
				HitActor = HitActor->GetOwner();
				FPointDamageEvent DamageEvent(Damage, Hit, ShotDirection, 
                nullptr);
				HitActor->TakeDamage(Damage * 1.75, DamageEvent, 
                OwnerController, this);
				
			}
			
			else
			{
				FPointDamageEvent DamageEvent(Damage, Hit, ShotDirection, 
                nullptr);
				HitActor->TakeDamage(Damage, DamageEvent, OwnerController, 
                this);
			}
		}
	}
}

```

My entire WeakPoint.Cpp, which is basically just a static mesh and nothing more:

```auto
AWeakPoint::AWeakPoint()
{
	PrimaryActorTick.bCanEverTick = true;

	Mesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("Mesh"));
	RootComponent = Mesh;

}

void AWeakPoint::BeginPlay()
{
	Super::BeginPlay();
	
}

{
	Super::Tick(DeltaTime);
}

```

---

<div class="post-metadata">

**Author:** ![EgoidLee](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@EgoidLee](https://forums.unrealengine.com/u/EgoidLee)\
**Post date:** [February 14, 2024, 1:07am UTC](https://forums.unrealengine.com/t/collision-on-static-mesh-not-being-detected/1687036/2 "2024-02-14T01:07:09Z")

</div>

If the mesh has volume like bound square or sphere, it makes easy detection each collision, too thin or skinny objects seems to be avoidance detection I guess.
