copy orientation problem

Can someone glance over this and tell me why this simple script is not working??? Sometimes the simple things just really kill me and at this point a fresh set of eyes may help to find a simple error I have overlooked…I’m not getting any errors, but it is also not working :frowning:

I am simply trying to copy the orientation from the main camera to the background camera....I swear I am being very slow(mentally) today and cannot seem to accomplish anything. I'm not stressed, I just feel a bit silly.
cont = bge.logic.getCurrentController()
own = cont.owner
scenes = bge.logic.getSceneList()

main_scene = scenes[1]
#ui_scene = scenes[2] # if I need to access this later...doubt it.
scn = scene[0]
cam = main_scene.objects['Camera']

own.lens = cam.lens
own.worldOrientation = cam.worldOrientation

EDIT: See, I am an idiot…no errors because I did not connect the noodles on the bricks…it was never being called…I messed with this for 20 minutes before I posted…I apologize for wasting anyones time :slight_smile:


should be:


This will copy the actual frame instead of 1 frame later.

Also i do not recommend to grab scenes like that, what if you remove scene[2] and put scene[3] in place, scene[2] does not exist and wil give errors due to [2] has been replaced with [3] and scene [3] will auto. become [2] in the scene list.

A simple solution is checking scenes by name through a small function.

def get_scene(scene_name):
    scenes = logic.getSceneList()      
    scene = None
    for sce in scenes:
        if == scene_name:
            scene = sce
    if scene == None:     
*** No scene found with the name: ' + str(scene_name) + ' ***
        return scene

Just call this with:

my_scene = get_scene('your_scene_name')

Thanks, I am still learning a lot and tend to just stumble my way through. Most of my scripts do check if the scene exsists first before doing any execution…I usually just check the len(scenes) and ensure all scenes are loaded but, upon initial implementation of something simple like this I just get sloppy and come back after I have it working…it already looks different than above code.

…as far as this function ‘cam.worldOrientation.copy()’ I had no idea of it’s existence and have been trying to find away around that single frame lag…thanks.