0 votes

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).

asked Aug 13 in Engine by soulldev (49 points)

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.

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! .

1 Answer

+1 vote

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.

answered Aug 13 by Schweini (100 points)

Thank you, it worked!

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.