I currently have SceneCaptureComponent2D rendering to a texture that I’m using in a UMG widget. I want to deproject mouse clicks on that UMG widget to the 3D space in front of the SceneCaptureComponent2D. I’ve dug around the source to see if there’s anything that I can use, but I couldn’t quite find anything useful. And, unfortunately, I’m still trying to wrap my head around the math needed to make it work.
Then I populate those two variables at the end of FScene::CreateSceneRenderer (in SceneCaptureRendering.cpp)
// Copy the data needed to do deprojection.
SceneCaptureComponent->ViewRect = View->ViewRect;
SceneCaptureComponent->InvViewProjectionMatrix = View->InvViewProjectionMatrix;
return FSceneRenderer::CreateSceneRenderer(&ViewFamily, NULL);
With that in place, I can use the above and take the screen position of the click event (or whatever) and call FSceneView::DeprojectScreenToWorld.