Python: distortion problem while initializing two cameras. (Blender 2.60a).

Hello everyone!

I have two scripts to set two different cameras while playing.

Too see it in action please download the .blend file attached to this post. (CameraProblem.blend) press “p” and then press “2” to set both cameras.

The scripts work fine but since the .blend file starts using the right camera it gets distorted when I initialize the scripts at the same time.

Here is a pic to give you an idea:

The left camera script:

## Updated to Blender 2.6 by Andre Ortiz and HG1
# import bge
import bge

# get controller
cont = bge.logic.getCurrentController()

# get owner
own = cont.owner

# get Window width    
width = bge.render.getWindowWidth()

# get Window height
height = bge.render.getWindowHeight()

# set viewport
own.setViewport(0, 0, int(width * 1/2), int(height))

# enable viewport
own.useViewport = True

And the right camera script:

## Updated to Blender 2.6 by Andre Ortiz and HG1
# Import  bge
import bge

# get controller
cont = bge.logic.getCurrentController()

#Get the owner
own = cont.owner

# get Window width    
width = bge.render.getWindowWidth()

# get Window height
height = bge.render.getWindowHeight()

# set viewport
own.setViewport(int(width * 1/2), 0, int(width), int(height))

# enable viewport
own.useViewport = True

Thank you very much for your time,

Ortiz

Attachments

CameraProblem.blend (412 KB)

the “active camera” is a bit different ,from other camera,think is this is the problem
I try your blend, the same problem have the cam left if is selected (and CTRL+0)

while is correct if active camera is the 3a (new)

EDIT:
3a camera …without script :wink:

Yep MarcoIT! To use a third camera is the solution. :slight_smile: Thank you very much for your help. See the attached .blend below people.

ANSWER:

Attachments

CameraProblemB.blend (391 KB)