I’ve done a little research on this, but to no avail so far. Is there any to split up one game window so you see two different views? i.e. A helicopter game, where you shoot a missle and a little box in the corner is devoted to a camera mounted behind the missle.
You can set up multiple viewports, but it requires (a little) python:
# Assuming "cam" is the camera you want to create a viewport for
cam.setViewport(left, bottom, right, top) #<-- The screen coords of the corners
cam.enableViewport(1)
If you need a demo, just ask.
Piran
Can you use that To do split screen mode? Like for 2 players, Setting up 2 veiws.
Yes, for each camera you can set it’s viewport to whatever part of the screen you like. So you can have two (or more) completely independant views at the same time.
Piran
Maybe post a demo so I could see how it works Can you configure it so one screen is on the top and one on the bottom, or one on right and left. Also can you configure it so there’s borders where the screen splits? That is very usefull!
From what he’s posted of the code, it looks like you can
Because what you are actually doing is drawing the BOX like shape of a viewport of each camera using those 4 points. So I think that you can draw a viewport for a camera anywhere that they will fit.
That’s it, your defining the left, bottom, right and top extents of the view in screen coordinates (pixels).
http://www.light-trap.co.uk/piransprojects/Viewports.blend
You’ll have to fake the borders, but thats easy enough, just put a simple plane along the edge of the view with whatever colour you like.
Have fun!
Piran
But what about this: Is it possible to toggle this on/off? Like press Key 1 to bring the window up, and press it again to deactivate it or remove it.
Just set the second window to something like (0,0,0,0) for it to disappear.
Thanks a lot Piraniac; I have incomplete knowledge of blender’s python handles
no, I think it would actually be more like
cam.disableViewport(1)
then tell the other viewport to expand back to screenwidth and height
Almost, the parameter to “enableViewport” is a bool, so to disable:
cam.enableViewport(0)
Added a toggle, use space to switch between one and two views:
http://www.light-trap.co.uk/piransprojects/Viewports2.blend
Piran
oh, heh. Where do you get all these cool controls? Is there a listing somewhere?