The title describes what I want to do. I want the camera in my main scene to send it’s rotation to a camera in the second(skybox) scene and for the second scene’s camera’s rotation to be equal to the first’s.
own.sendMessage(‘subject’, str(own.worldOrientation.to_euler()))
and use a message sensor in the other scene
if message.positive:
Rot = eval(message.bodies[0])
camera.worldOrientation = Rot
http://www.tutorialsforblender3d.com/GameModule/GameLogicModule_13.html
basically, one object sends it rotation each frame, and the other rotates to match it, you can check ‘run first’ in the logic sending the message and I think** that it should recieve the message in the same frame it is sent,
You could use a message system, but you could also use a script to check the other scene itself.
import bge
otherScene = None
for x in bge.logic.getSceneList():
if x.name == "nameOfOtherScene":
otherScene = x
otherSceneObjects = otherScene.objects
break
thisCam = bge.logic.getCurrentController.owner
if otherScene != None:
thatCam = otherSceneObjects['thatCam']
thisCam.worldOrientation = thatCam.worldOrientation
yeah, I just thought about it…
never tried scene.name , does that work?
Be aware that this method will create a delay on the “slave” camera. As it is a camera this will be annoying visible.
I suggest you use an invisible master object (e.g. an empty or an additional non-active camera) to perform the rotation/motion. Copy the orientation to both, the camera in the master’s scene and the other cameras.
As all cameras receive the same value at the same frame, there is no visible delay.
The delay still exists between the master object and all cameras. This is less visible than a delay over the complete screen.
You need a method to identify the cameras (here I just use the active cameras). Apply this Python module to the master object always triggered by an always sensor [true level triggering enabled].
camera.py
import bge
def copyOrientation():
master = bge.logic.getCurrentController().owner
for slave in findSlaves():
slave.worldOrientation = master.worldOrientation
def findSlaves():
# implement whatever you want here
slaves = []
for scene in bge.logic.getSceneList():
slave = scene.active_camera
slaves.append(slave)
return slaves
(untested ;))
…actually, I’ve never tried, either. I mean, I HAVE, but that was back in Blender 2.66. Might have been added since then.