How can I spawn just outside of screen in specific plane
I need to spawn stuff outside of the player screen in Z = 0 plane in any direction. I have set up a blocking plane at Z = 0. I try to cast rays (line trace/ray cast) from the camera position to the plane to determine the edges of the screen. The camera is pointing directly down from Z = 2000.
I created the end vector needed for the rays by calculating vector rotations through FOV. Another approach I tried was by using Deproject Screen to World with using coordinates from 0 to max screen resolution from Get Viewport Size. Both failed in the same way. The FOV is 90 degrees as expected and the screen size is as expected when debugging (0-1920 width).
The problem I have is that the projected screen is too small. I suspect that the trace end vectors are at fault, but I do not know why or how. As I just want to spawn outside of the screen, any alternative solution is welcome.
My code which is hooked to On Tick:
Expected result, the rays trace all the way to the edges of the screen:
Actual result, even when random traces near the min and max of the screen resolution they are very far away from the actual edges:
The plane surface seems to be correctly at Z=0 as are all other objects:
The rays do not start at the camera, they start right in front of it, but it makes little difference either way:
asked Apr 02 '18 at 10:46 PM in Blueprint Scripting
Follow this question
Once you sign in you will be able to subscribe for any updates here