How to set a drag margin for top left anchor camera2D ?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By soulldev

Hello,
Is it possible to set up a drag margin for the top left camera ?
I want my game to has a fixed top left camera that’s attached as a child of a Node2D at position (0,0), when the player leaves the screen from right, i increment the Node2D by the 1024(the screen width) then i set the Camera2D to current and enable smoothing for certain amount of time.
But sometimes, i want the camera to be allowed to go with player, so i the Node2D as a child of player, i have many issues with this approach.
The biggest issue is : Camera do discrete cluttered jumps when do reparenting, i fixed this by changing it’s position with respect to the Player so it remains the same, but i have issues with drag margin, because i can’t change the camera position(that will do the issue again).

The built-in drag margins system in Godot Camera is very simple, if you need something more specific you might have to turn it off entirely and script the behavior yourself.

Zylann | 2019-08-14 12:38

I agree with you, but i see that GDScript is so simple in the way that it’s a bit harder to implement things from scratch, but my problem is solved anyways, Thank you! .

soulldev | 2019-08-17 13:14

:bust_in_silhouette: Reply From: Schweini

You could add another camera which is a child of the player, the current property set to false. But when you want that the camera follows the player, set current to true and currentt from the other camera to false.

Thank you, it worked!

soulldev | 2019-08-17 13:11