I have written a script in python that successfully saves and loads the position and rotation of my player cube and camera for use between scene transitions. However, something is going wrong with the minimum and maximum rotation values of the mouse look actuator. I have a feeling that I should be adjusting those values in python at the same time I change the camera rotation from the save, but I'm really hung up on this.
Here is the code I wrote:
import bge
from bge import logic as g
def save():
s = g.getCurrentScene()
pos = s.objects["player"].position
rotP = s.objects["player"].worldOrientation
rotC = s.objects["player_camera"].localOrientation
g.globalDict["pos"] = [pos.x, pos.y, pos.z]
g.globalDict["rotP"] = rotP.to_euler()
g.globalDict["rotC"] = rotC.to_euler()
print("SAVED")
def load():
s = g.getCurrentScene()
s.objects["player"].position = g.globalDict["pos"]
s.objects["player"].worldOrientation = g.globalDict["rotP"]
s.objects["player_camera"].localOrientation = g.globalDict["rotC"]
print("LOADED")
It's as if these values are being changed by something:
Thank you for your time. I'm really stuck on this.