Multiple Game Cameras with the Oculus Rift

Hey folks,

Here’s what I want to do: A game I’m working on is an asymmetric two player game, where one player is in the Rift (w/controller), and one player uses a normal monitor (w/mouse & keyboard). I’ve been doing this networked on 2 machines, but for a variety of reasons, I want to make a version where both players can play on one machine.

I’ve done some researching and I’ve been able to get this working on my machine. I have 3 cameras with appropriate viewport rects, I have the game running with the -popupwindow flag to remove borders, and I’m setting the screen’s resolution to the appropriate resolution.

However, I want something more robust. I’m making a lot of assumptions in my prototype scene. I’m assuming that:

  • I'm running Windows (-popupwindow is marked as working on Windows only)
  • I know the resolution of my main monitor and my Rift and their layout ahead of time
  • The game window will always position itself in the right place

Anyone have any tips as to how I can make this more robust? Are there (preferable graphics card/OS invariant) ways I can get individual display information? I’ve played around with the Display class, but it’s not quite what I want (it reads my 2 normal monitors as one really wide display, when I really want the information on the displays separately). Any way to get behavior like -popupwindow on Mac? I’ve found ways to move the Unity window on Windows (http://forum.unity3d.com/threads/84252-Window-manipulation-in-unity), but I have no idea how to do so on Mac.

I know there are a lot of questions here, but I’m hoping that there are others who have attempted this that may have answers. I think these types of games are very exciting, I would just love to make something I can easily share, and not require users to manually enter in their display configuration in some batch file/pre-game screen, for instance.

Thanks.

There is a mono dll (System.windows.forms.dll) if you add it to a plugins folder in unity you should be able to get info about the primary screen using Screen.primaryScreen or Screen.Allscreens to access all of them.

The dll is located here: C:\Program Files (x86)\Unity\Editor\Data\MonoBleedingEdge\lib\mono\gac\System.Windows.Forms