Hello all,
I am working on a game, played via touch screen (Touch Controls Turning Only) and from a first person perspective.
My game contains two types of scenes so far:
- Panorama Scenes in which the player can turn around … and look up and down slightly. For this purpose I set "Constrain pitch-rotation (degrees)" to a sensible value (in my case of -7/+7), and everything works fine. From these Panorama Scenes, the player can switch to …
- Still Scenes in which I do not want the player to move at all, so I change the Movement Method to "None" OnStart (and back to "First Person" on leaving the scene). This works fine, too. But:
If my player has "looked up" (Pitch: +7) in a Panorama Scene and then touches a hotspot to change to a Still Scene, the camera still "looks up" (Pitch: +7) in the Still Scene. I would like to reset the Pitch to 0 though.
As I cannot switch cameras in first person mode (except for cutscenes), I wonder if there is a way to reset the first person camera pitch via an action list action on Scene Switch. Is this possible? Or is there another way that I do not see?
Thank you.
Comments
{
//subscribe your method
UnityEngine.SceneManagement.SceneManager.sceneLoaded += OnSceneSwitch;
}
{
//unsubscribe your method
UnityEngine.SceneManagement.SceneManager.sceneLoaded -= OnSceneSwitch;
}
{
Debug.Log("Scene changed!");
Debug.Log("Scene is: " + scene.name);
//initialize the cameras
if (scene.name == "01-Home") // this is an example
{
//if it's scene "01-Home", lock pitch.
_cam.pitchLock = RotationLock.Locked;
}
}
AC.KickStarter.player.GetComponentInChildren<FirstPersonCamera>().SetPitch (0f);
Placing this line into the Run function of a custom Action would allow you to call it as part of your OnStart cutscene.