Top Down Line Trace

Hey,

I think a simple way of achieving what you want is to just find the intersection between the ray from the mouse cursor and the virtual plane at your projectile origin location Z (height).

You don’t need to trace for collision at all.

Here is a beautiful drawing:

The green horizontal bar is the plane. If we use the Line Plane Intersection blueprint node, we can find the red line vs green intersection. You could use the result as is and then do a linetrace from the green cross to this intersection point. However, I’m assuming that your projectiles have a max distance, or no max distance at all.

So what you want to actually do is normalize this result (the segment from the green cross to the intersection point), so you can then multiply it by whatever max distance you want to use.

This is how it looks in blueprint:

If you do actually want the exact intersection point, you can discard the last few nodes:

Hopefully this is clear.

Please note that in the above blueprint graph, I’m not checking whether there is an actual intersection with the plane (boolean red ‘Return Value’ output). Depending on what kinds of camera angles are possible in your game, it might be safer to check there is an actual intersection before performing the line trace.

2 Likes