Linking objects/actuators between scenes

Can you activate the actuator of an object in another scene? Specifically I’m trying to rotate the camera in an underlayed scene (a sky dome scene) to copy the rotation of the main character/main camera. The way I have the main camera copy the rotation of the main character is by using this python script (well, not exactly, it has more unrelated stuff in it) connected to the camera’s CamMotion actuator:
cont = logic.getCurrentController()
motion = cont.actuators[‘Motion’]
camMotion = cont.actuators[‘CamMotion’]
motion.dRot=[zrot/avgrate,0.0,xrot/avgrate]
camMotion.dRot=[-zrot/avgrate,xrot/avgrate,0.0]
I was hoping I could do something similar with the camera in the sky scene. I connected the camera & the main character’s logic by just shift-clicking the camera & the main character in the 3D view, & the logic bricks from the camera appeared magically underneath the main character’s logic! But I don’t know how to do that with objects in another scene; it sounds harder. Help is greatly appreciated!

AFAIK you can’t link logic nodes between scenes. However, you can use messages with the Message sensor and actuator to objects in other scenes, and achieve the same effect.

Well, it’s not really possible to go between scenes to activate actuators on objects, but you can just send a message with Python. If you want to copy rotations between scenes, it’s better to set it directly, though, like this:


from bge import logic
cont = logic.getCurrentController()
obj = cont.owner
sce = logic.getCurrentScene() # Get the current game scene
scelist = logic.getSceneList() # Get a list of all running scenes

for s in scelist:
     if s.name == 'SkySceneName': # Search through the scene list for the scene with the name of your sky scene
          skysce = s

cam = sce.active_camera            # Or cam = sce.objects['CameraName']
skycam = skysce.active_camera # Or skycam = skysce.objects['SkyScene'sCameraName'] < Replace 'SkyScene...' with the name of your camera in the sky scene

skycam.orientation = cam.orientation # Set the sky camera's orientation to the game camera's orientation.

This is untested, but it should work - if you go with the commented code, replace the object names (e.g. “CameraName”) with the name of the camera in that particular scene. Also, replace the ‘SkySceneName’ string with the name of your sky scene.

Thanks! That worked! I am a little disappointed you can’t link actuators between scenes, but that works great!

another thing wich is like a message, is to use a property sensor. Change the property to generate a pulse to activate the script of desire.