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"

Can I make the camera draw to a specified region of the game window?

Some background information: I've built a gameplay prototype in Unity 3D, and I'm moving to UE4 for production (mainly because I would like more robust networking and demo recording).

One aspect of my prototype that I'm having trouble duplicating in UE4 is the screen configuration. The game is played in portrait orientation, with the in-game camera rendering to the top half of the screen, and the HUD filling the bottom half to leave the player's view unobstructed.

Resizing ViewportRect in Unity

In Unity, this is very easy - all cameras simply have a ViewportRect attribute which determines what part of the (normalized) screen space they render to. But UE4 doesn't seem to expose this functionality directly. I can see where GameViewportClient uses information from FPerPlayerSplitscreenData to set up different cameras to different parts of the screen, but:

A.) I'm unsure how to control this in my own C++ classes without hacking it into the engine itself, and

B.) I don't know if I would still be able to render HUD elements in the remaining screen space.

Obviously, I could use the brute force solution of rendering the camera view to a texture and then drawing that texture in the UI, but since this is a mobile game I would like to avoid the memory and draw call overhead if at all possible.

I would greatly appreciate any insights anyone can offer! Thanks. :)

Product Version: UE 4.8
unityviewport.jpg (168.9 kB)
more ▼

asked Jul 06 '15 at 02:46 PM in Rendering

avatar image

1 1 1 1

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

1 answer: sort voted first

Hello I hope I understood what you want cuz im in hurry right now.

I printed a crosshair at a specific point on the map with blueprints using ConvertWorldLocationToScreenLocation from the Player Controller and then drawed a texture at the x and y cords of the return. In blueprints it also returns whether the location is on the screen.

You can look for ConvertWorldLocationToScreenLocation in the PlayerController from the HUD class and Draw a rectangle.

If you want the edges to be smooth you would have to combine draw line functions and draw circle funktions.

Good luck!

more ▼

answered Nov 15 '15 at 01:53 PM

avatar image

0 1 2 4

avatar image SullairVR Oct 06 '16 at 02:39 PM

I asked separately and as a result there is a pending feature request. Vote for it and hopefully it becomes a reality.


(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