How to get the screen location of a viewport?
I'm currently implementing a plugin and I need to transform some coordinates in operating system screen space to the active viewport. I've gotten as far as finding a reference to the viewport I'm interested in:
I'm guessing this will always resolve to the viewport in question (disregarding any potential situations where it might be null). The question then becomes; How do I transform my screen coordinates to local coordinates in this viewport?
I first approached the question from the mouse angle. Since the unreal engine somehow is able to transform the mouse coordinates (expressed in "operating system screen space") to viewport space coordinates, I should be able to piggyback on that code to transform my coordinates... right?
Well it turned out to not be that easy. I think I've found the part of the code that does this, in SceneViewport.cpp:
This class is the actual type of GEngine->GameViewport->Viewport it seems.
Does anyone know of a better solution, or of a good way to make this work?
Rama suggested using the:
Class of functions on FSceneView, but the screen referenced here is just another coordinate system inside the viewport itself, and are not related to the O/S screen pixels.
Best regards, Temaran
I haven't tried it myself, but I'm pretty sure you need
answered Dec 25 '14 at 03:05 PM
SceneView Screen to Pixel
If you can get your FSceneView, then you want these two functions:
answered May 25 '14 at 01:30 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here