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"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

Plane Trace between two points on the screen

This is less of a technical problem and more of a math problem. I want to do a trace between two points on the screen, infinitely in distance from the direction from the cameras vector. I've been trying to use a box trace that is very thin. But my problem is trying to affect the box rotation that it is aligned to the camera.

Basically I want to shoot out a rectangle from 2 points on my screen and get everything in between them. If there is an actual way to do this other than a box trace I would appreciate that too.

If I'm not explaining this well enough, I can post images when I get home from work.

Product Version: UE 4.21
more ▼

asked Jan 14 '19 at 04:09 PM in Blueprint Scripting

avatar image

329 7 8 12

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

2 answers: sort voted first

Use the camera forward vector. Use the LookAt node to look at that forward vector to get a rotation for the cube that always faces the same as the camera.

plane trace from face

Here's a full paste of my solution. - Plane-trace from camera

ue-answerpic49a.png (175.4 kB)
more ▼

answered Jan 14 '19 at 07:58 PM

avatar image

2.1k 38 17 52

avatar image 16bit Jan 15 '19 at 02:34 AM

Hey Thanks Ben,

Since I wanted the ray to cast from a location to location and not from screen to location I had to go through the the up vector instead. The results are perfect. Thanks a ton.

alt text

ss.png (129.5 kB)
(comments are locked)
10|2000 characters needed characters left
Viewable by all users

You can try something like this: alt text

It creates a virtual box between 2 points and gets all overlapping actors with the required collision preset. Is you want this box to be closer to a plane, just don't use the Box Extent Z, simply give it a value of a few units, and don't use Box Pos Z, set it to the Camera Z Location.

But this box uses world coordinates, so if those two points are quite far one from another, the box extent will be very large, and its other corners may overlap lots of actors, so keep that in mind.

cubetrace.png (101.2 kB)
more ▼

answered Jan 14 '19 at 08:20 PM

avatar image

1.8k 12 7 8

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
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