In the Player Blueprint:
The method is completely geometry independent. No depth was specified in the request so I’ve used player’s current location rather than ground level. Depending on how it will work in the game (elevation, landscape complexity, slopes… this may need to be adjusted by shifting Plane Origin).
In short:
- create an up-facing plane at player location
- trace from the camera to the mouse cursor projected into the world
- when the trace hits the plane, we get both magnitude and direction of the resulting vector
- only show the result if vector length is greater than specified distance
An alternative here is to line trace to get hit’s surface data. But again, this depends on what the end goal is. Do include more detail if the original solution is not suitable.