Scenes have no "relation" to each other. You need to define a relationship by yourself.
I guess you want to mean the same relative coordinates or both cameras (example: the middle of one camera is the middle of the other camera). This shows an advanced example: https://youtu.be/rnjzoQM273A
I guess you do not need such high sophisticated solution. I simply assume:
- The scale, orientation and location of both scenes is supposed to be the same and remains constant
This helps to simplify the system quite a lot.
It allows to copy the current world position (orientation and scale) from one scene to the other without converting it.
objectInSceneB.worldTransform = objectInSceneA.worldTransform.copy()
But there is a small but important issue. When you do it that way the target object might be rendered before it received the new position. That creates a one frame delay. While it does not sound a lot, it is very noticeable especially on cameras.
To solve that I created an invisible "master" object in one scene. Each scene (including the scene with the master) gets a visible "slave" object. Then I constantly copy from master to all slaves. This still creates a delay between the master and the slaves, but all slaves receive the change at the same time. As only slaves are visible there is no visible issue.
In your case I recommend following:
- have one master camera (the user does not look through this camera) in one of the scenes [call it "Camera.master"]
- have one slave camera at each single scene (= active cameras)
- copy from master to all slaves
scenes = bge.logic.getSceneList()
slaveCameras = [scene.active_camera for scene in scenes]
for scene in scenes:
masterCamera = scene.cameras.get("Camera.master")
masterKey = masterCamera.get("master")
for slaveCamera in slaveCameras:
if slaveCamera.get("slave") == masterKey:
slaveCamera.worldTransform = masterCamera.worldTransform.copy()
Run your game.
To include/exclude slave candidates you can define a master key. At the master object setup a property "master" (e.g. String: "camera"). Then setup a property "slave" with the same value at each slave that should be synchronized. In your case do not setup the property slave at the camera of the overlay scene (or at least not with the same value).
This even works dynamically. You can change the properties in-game to enable/disable synchroinization on-the-fly.