Smooth Camera Transitions Between Actors
Hey all, I was curious if anyone has any ideas on seamless/smooth transitions between characters.
For instance my playing field is 3 screens long. On the farthest left position is one character. When you want to switch to another character I want the camera to smoothly zip over to the second camera (lets say for 1 second). I figure I want to use an interpolate behavior but I can't figure out how to use that for the camera. I've tried a few things like spawning an invisible actor with camera controls in it, that shoots over to the other character- then when it hits its transfers the camera control to the other actor. But it feels clunky and unreliable. Any ideas? Thanks!
For instance my playing field is 3 screens long. On the farthest left position is one character. When you want to switch to another character I want the camera to smoothly zip over to the second camera (lets say for 1 second). I figure I want to use an interpolate behavior but I can't figure out how to use that for the camera. I've tried a few things like spawning an invisible actor with camera controls in it, that shoots over to the other character- then when it hits its transfers the camera control to the other actor. But it feels clunky and unreliable. Any ideas? Thanks!
Comments
I set up X,Y attributes for each actor (i.e. actor position x, actor position y). Attributes are real. Do this for all of your actors. I then created dummy actors which serve as camera transitioners.
In this example I'm going to go from actor 1 on the left screen to actor 2 on the other side of the screen. The switch will happen when let's say a user taps on actor 1.
> When user touches actor 1, SPAWN (dummy actor camera transition) from the central x,y position of actor 1.
>Inside the Camera Transitioner dummy actor I said INTERPOLATE the x and y position of self for .7 seconds (or however long you want) to the x y coordinates of actor 2. Again it finds these coordinates by looking at the actors x,y real attributes we set up.
>Then I said AFTER .7 seconds CONSTRAIN your position x and y to actor 2's X and Y (real attribute) and then Destroy yourself. This FORCES the computer to lock the camera onto your second actor. This is crucial if the actor moves. And then destroy.
That's pretty much it.
Keep in mind that you'll also need to add your "control camera" behaviors into the actors. So for instance when actor 1 is active have it be controlled by the camera. When you touch actor and SPAWN the transitioner, have the transitioner actor control the camera.
Hope this helps!