I created a menu using widget blueprint and then added it to a actor so that i can place it in 3d world. I want the menu in 3d world because I want to place 3d models and also to create parallax effect in menu (like destiny menu).
I placed this actor at (0, -1000, 0) position so that it is visible and i can place other elements in between this actor and camera.
I want the this actor to fill the whole viewport. I set the draw size of the widget same as viewport size.
the menu widget size is 1920x1080 so i divided this with viewport size and set the scale but that didnt work either.
how can i make this 3d widget to fill the viewport?
Oh no worries I got it. For anyone who needs answer i’m answering my own question.
By trigonometry, i found that the width of the viewport should be exactly double the distance between camera and the actor.
And once i have width length is easy to find
ActorWidth = 2.0f * DistanceBetweenCameraAndActor;
ActorLength = (ViewportLength/ViewportWidth) * ActorWidth;
If resolution changes the size has to be calculated again. So I created a function called ResizeMenuDrawSize and call this function everytime the viewport size changes.
Completely math-incompetent person here, but wouldn’t this depend on the FOV of the camera?
I’m very new to unreal and I dont really understand much what is going on. I tried changing the position and fov of camera and nothing happened -_-.
I clicked on camera and in bottom right corner, camera preview just shows skybox and nothing else, yet in viewport i can see the UMG widget rendering :-o i have no clue how this is rendering if not by camera
BAC is FOV
|AD| - distance to the widget
|BC| - the required size of the widget
BAD is half FOV
|BD| = |AD| * tan(BAD)
|BC| = 2 * |BD|