That’s normal with this technique, we’re tracing from the camera into this green plane. The intersection cannot be resolved if the trace does not hit the plane.
Your request is quite unclear at this point. Do you want to trace against the geometry instead - as in the wall in the background? Do note that the cursor is in 2d and you want to interact with 3d world. You need to take that extra D from somewhere.
Do you only need to perform this test ahead of the player? Perhaps you could describe the gameplay goal? Are we shooting penalties, aiming with the cursor?
