How do I center camera on an object within limits while also using linear interpolation?

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:

If you really want to do it, then you’ll need to either:

  1. 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.
  2. Use the “Room-based camera movement” extension and set up camera rooms.
  3. 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.
1 Like

I understand. I will have to look into this more. Thank you for the reply. :slight_smile:

1 Like