Hello, guys. I need some help with cameras. I want the camera to center on the player within limits. However, the game ended up looking quite stiff so I want the camera to also be smooth with some delay. The current ‘CENTER THE CAMERA ON AN OBJECT WITHIN LIMITS’ action follows the player already, but it doesn’t seem to allow for linear interpolation. How do I go about doing this? Thanks in advance.
The easiest thing to do would be to check out the new smooth camera extension that got released with the last GDevelop version.
From some research I recently did, I generally recommend against using linear interpolation expressions (lerp) for cameras because it’s super framerate limited and most people apparently use it wrong. (Lerp is not supposed be gradual movement that slows down as it gets closer, it’s meant to be equal movement the entire time, hence the “linear” portion.) You can read more about that here if you’d like: https://gamedevbeginner.com/the-right-way-to-lerp-in-unity-with-examples/
If you really want to do it, then you’ll need to either:
- Set up limits in your conditions for min/max x/y positions, then use the X/Y camera actions (not the “center on” action) with lerp.
- Use the “Room-based camera movement” extension and set up camera rooms.
- Set up camera rooms manually for your limits, and then do #1 above. You can see about setting up camera rooms by looking at Not-A-Vania.
I understand. I will have to look into this more. Thank you for the reply.