Line trace goes through blueprint actors

Hello,

I’ve been struggling with setting up a line trace to detect certain blueprint actors.
I have a blueprint master class “KeyEvent_Master” that contains a static mesh and two collision spheres. I created a child BP of this class with a phone static mesh, and I want to check if the player is looking at it directly once they are in the first collision radius. The second collision sphere is supposed to be the radius that can be traced by the player.

In the overlap event I’m binding an event from the character BP to a custom event, because I only want to trigger the event on a certain character input (zooming in) which already works fine.

If the player gets out of the radius, the event gets unbound and nothing will happen on input. If the player is zooming in, the line trace will be executed. I’m printing out the hit component to check if the player is hitting the BP actor.

This is just a simplified line trace function I’m using globally.

So I set the collision of the static mesh and the sphere to receive the line trace input to block for the visibility and camera channel, but my problem is that the line trace always ignores the WHOLE BP actor.

If I zoom in onto a static mesh instead of the BP actor, it indeed traced it correctly. But I can’t seem to find any difference between my BP actor and other static meshes as the collision is set up correctly…

I hope someone has another idea what could have gotten wrong…

If I understand it correctly, the trace function is inside the Blueprint you want to trace, so it is trying to trace itself. But you have ‘ignore self’ activated on the trace function.

btw. there is a ‘Line Trace Component’ function so you just trace against this one component and not everything else in the level. Also there is a ‘get forward vector’ for most objects, so you don’t need to get the rotation :wink:

Now I feel dumb! That was exactly the issue! I must have been blind.
Thank you so much! :wink: