- Home /
How to keep player moving in the same direction after camera change
So basically, I am creating a game that uses static cameras that change when the player character reaches a certain point on the screen, similar to Final Fantasy X/X-2. For now I am using the third person controller prefab that comes free with unity, for testing purposes as I haven't created my own character/movement script yet. However I have modified it by taking out the third person camera/camera script so that I can use my static cameras.
So far so good, the character moves in the direction that the player pushes, relevant to the direction of the camera. However, when I change cameras from one to the other, the player controls immediately change to being relevant to the direction of the new camera. This causes problems, such as when the camera changes from behind the player character, to a camera in front of them, they immediately change direction, (relevant to the second camera).
I have recently been playing Final Fantasy X-2, and this accommodates for this problem by continuing to move the player in the same direction, relevant to the first camera, until they let go of all directions, at which point the controls change to being relevant to the new camera.
Example: http://www.youtube.com/watch?v=QbMbBV3ozHw
At 21:34, the player is pushing the UP button to move the character forward. When the camera suddenly changes to the opposite direction (as the character moves through the door), they continue in the same direction even though the user is still pushing the UP button. The same thing happens again at 21:40 (this time with the DOWN button), when the camera is once again flipped to the opposite direction.
Does anybody have any advice for how I could modify the third person controller script to allow for this? Or would it be better to wait until I create my own control script? In this case, can anybody provide some tips for incorporating this into my own script?