Hi,
I’ve encountered a game scripting problem.
In my game, I have two active scenes:
Scene 1 - the main scene containing the player-camera (with mouse-look)
Scene 2 - the overlay scene, containing the player-HUD (with a static camera)
In the overlay screen I have a simple compass script that works off the screen vector of the camera in the other active scene.
How do I gain access to the camera object in Scene 1 from the script linked to an object in Scene 2?
Regards,
Journeyman
How do you get the values from the dictionary. The tutorial doesn’t show you how.
This didn’t work:
scrVector = GameLogic.globalDict.get(“scrVector”)
obj.vX = scrVector(“vX”)
obj.vY = scrVector(“vY”)
obj.vZ = scrVector(“vZ”)
Okay!
I think I’ve figured it out.
This looks hopefull…
Fragment from Overlay scene script:
import Rasterizer
import GameLogic
co = GameLogic.getCurrentController()
activeScenes = GameLogic.getSceneList()
get access to the main scene
levelScene = activeScenes[0]
get a list of the objects in the scene
objList = levelScene.objects
get the camera object
mainCamera = objList[“OBCamera”]
get the screen vector
scrVector = mainCamera.getScreenVect(0.5, 0.5)
FunkyWyrm
(FunkyWyrm)
July 12, 2009, 3:17am
5
Yeah, that looks like it. GameLogic.getSceneList() is a pretty new function designed to access any scene in memory. That means that the scene has to be added as background or overlay or main scene to be accessible, but this seems like it’s ok with your current needs.