0 votes

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

in Engine by (61 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.

by (232 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 Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.