x

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"

Bind a camera actor to a monitor? (3 cameras, each for a monitor)

I have three monitors, and I have three camera actors in the game. I want to have each monitor display one of the cameras, respectively.

I already know how to get the information (id, name, resolution, etc.) about the monitors, thanks to this post https://api.unrealengine.com/INT/API/Runtime/ApplicationCore/GenericPlatform/FDisplayMetrics/GetDisplayMetrics/index.html

My question: Given the monitor id (or name) and the reference to a camera actor, how do I make the camera's scene displayed on that monitor? Do I need to have three SWindow objects?

cameras monitor information (printed string) blueprint C++ code for monitor information

Product Version: UE 4.20
Tags:
cameras.png (647.3 kB)
monitors.png (523.7 kB)
bp.png (68.5 kB)
cpp.png (9.5 kB)
more ▼

asked Sep 03 '18 at 02:15 AM in C++ Programming

avatar image

Fan.JIN
10 2 3 7

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

1 answer: sort voted first

I know a workaround: Run three game instances, each one for a camera. This is easy. Then, I use the following code to make each of them shown on corresponding monitor: Reference: https://blog.csdn.net/u014532636/article/details/80451370 (in Chinese)

 #include "Misc/CommandLine.h"

 void AMyActor::AA()
 {
     // Move window to the corresponding monitor
     if (GEngine && GEngine->GameViewport) {

         int MonitorNumber = 1;
         FParse::Value(FCommandLine::Get(), L"monitor=", MonitorNumber);

         FDisplayMetrics Display;
         FDisplayMetrics::GetDisplayMetrics(Display);

         int8 MonitorIndex = MonitorNumber - 1;
         int32 CurrentMonitorWidth = Display.MonitorInfo[MonitorIndex].NativeWidth;
         float WidthPosition = (MonitorIndex)*Display.PrimaryDisplayWidth - CurrentMonitorWidth;
         float HeightPosition = 0.0f;

         FVector2D WindowPosition = FVector2D((-1)*WidthPosition, HeightPosition);
         GEngine->GameViewport->GetWindow()->MoveWindowTo(WindowPosition);
     }
 }

Finally, add the ApplicationCore module in Build.cs file, so that the linker knows where to find the library used above.

more ▼

answered Sep 03 '18 at 08:30 PM

avatar image

Fan.JIN
10 2 3 7

(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