Currently trying to work on a dynamic camera system for a 2D platformer
I have it currently setup where the camera naturally follows the player, and once the player enters a specific area, the camera would then change to one zoomed out and stationary.
Im currently trying to smoothly transition between these two cameras.
My current setup is that there is a transitioning camera that copies the position and zoom of the current camera before interpolating itself towards the newer camera, changing to the target camera once it reaches a specific threshold.
This attempt still appears to cause some issues involving stuttering and jutting.
If there is any other way I could approach creating a smooth transition between two cameras id love to know
Heres a gif of the current problem with the described approach.
When the camera is zooming out its supposed to be moving towards the position of the player camera. Instead it stays still.
Here’s the string of code that is meant to handle its position
Ok ive fixed the issue, Basically what I’ve done is that when transitioning back to the camera that follows the player, instead of using a transitional camera I instead change the zoom and global_position of the camera attached to the player and make that the current camera that interpolates to the desired position and zoom.
Reason why it wasnt working with the transitional camera is that the camera’s target position does not update if it is not the currently selected camera.
For anyone else having issue with cameras, heres my code for the functions handling camera changes.
Basically when a player enters a trigger zone, it goes through the NewCam function.
If the bool CamTrans is true, then itll go through the other function every frame processed
Though it is a little messy its how I am now handling this.