Hey @Kris sorry to necro this but I tried using this in 5.4 with a scene capture 2d actor placed above the world. I have a widget that is using a material to display the render target from the scene capture 2d actor. I keep getting inaccurate results.
Here is what I’m doing:
- Set my camera scene capture 2d actor up above the scene with the capture component pointing down the actor -z axis.
- Set scene capture pushing image to render target with resolution set to 970x2048
- Set the widget resolution to be the same aspect ratio as the render target but with resolution of 256x540
- Play and click the screen where the widget is
- Pass in mouse click screen position
- Draw line trace from returned OutWorldOrigin to an end point of OutWorldOrigin+(OutWorldDirection*50000)
My line traces are always in the wrong area and they are not even close to the scale of the viewable space in the render target from the scene capture actor. However they do create the shape of the clicked widget when clicking the mouse over different parts of the widget. For example, if I click at each corner of the widget I can tell that all 4 line traces are spaced out to the correct proportion that the widget is, just that they are super small in the world and not in the correct locations.
Is there something I’m missing here?
I don’t know enough about this kind of math to know if there is something I’m doing wrong.
Also I have noticed that if I normalize the mouse click from the widget size and then map the x and y those normalized values from (0 to 1) to (-1 to 1) and multiply that by the render target size and pass that into the screen position parameter I get way more accurate line traces. However doing that causes the line traces to all be offset to the left from where I feel like I’m clicking based on the visual from the render target in the widget.