Line trace not hitting skeletal mesh.

I have created a custom character in blender made out of cubes and imported it in UE5. It has bones and an animation. It represents the AI in my game:

When the player fires the gun, a line trace starts from the camera and hits the enemy. The AI has the inherited capsule component set to default collision preset - Pawn. The line trace is set to the Visibility channel.

I need to hit the AI and get the name of the bone that got hit.
This is the mesh’s collision:


Currently the line trace passes through the AI and no bone name is returned. If I set the trace channel to Camera, it hits the AI but still no bone returned.

I tried dragging and dropping just the skeletal mesh into the level and when I hit it, the line trace actually returns the name of the bone.

Any ideas?

You’re probably hitting the capsule, not the mesh. Have the capsule ignore the channel you’re tracing on and ensure the skeletal mesh either blocks it, or overlaps it if you need multi-line traces for penetrating shots.

Here are the presets:


The line trace still goes through. And I think it would not make any sense for the capsule collision to block the trace since it had the Visibility channel set to ignore.

I have just replaced the skeletal mesh with the tutorial character and it detects the bone.

So… there must be something going on in the physics asset BP. I did not change anything after import.
Any ideas?

Did you find a solution?

Hello, I bumped into your post while I was having the same issue and I am offering a clue which could be the solution you need.
Hit bone detection was never pulling a bone name while my line/sphere trace was detecting the actor or the component.
BUT in using the UE5 Third character BP as my player, the bones were detected.
My line/sphere trace was working but something was fishy in my character BP.

Solution:

Like you I had a Physical Asset linked to my character when I imported it, so I thought “it was ready to use…”

Well… no.

I had to set it properly in my skeletal mesh :slight_smile:

So, it has worked for me, hoping it will for you.