Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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: alt text

Expected result, the rays trace all the way to the edges of the screen: alt text

Actual result, even when random traces near the min and max of the screen resolution they are very far away from the actual edges: alt text

The plane surface seems to be correctly at Z=0 as are all other objects: alt text

The rays do not start at the camera, they start right in front of it, but it makes little difference either way: alt text

Product Version: UE 4.18
more ▼

asked Apr 02 '18 at 10:46 PM in Blueprint Scripting

avatar image

1 1

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question