The Godot Q&A is currently undergoing maintenance!

Your ability to ask and answer questions is temporarily disabled. You can browse existing threads in read-only mode.

We are working on bringing this community platform back to its full functionality, stay tuned for updates. | Twitter

0 votes

When I'm making scenes, I tend to position the scene origin to the center of a character, but when I run a scene on its own, it means I can't see most of it.

Is there a workflow I'm missing, or should I be using something like a Position2D for marking the centers of scenes?

Godot version 3.2.3
in Engine by (18 points)

1 Answer

0 votes

You need to add Camera2D and check Current in its properties.

by (1,656 points)

Either I am misunderstanding, or you are?

You are saying that every single scene I make, I need to attach a Camera2D to it and mark it as current? Only one camera can be current from my understanding.

I have a Camera2D in my World that works correctly. I am talking about when building a Scene by itself.

enter image description here
Here's my scene in editor. The Origin is top left, but I center that on the sprite for easy centering, but running the scene (not the game), cuts off 3/4 of it.

I'd like to confirm that if I add a Camera2D to my player, it totally borks the level, because my game is based on a camera being in level, not on the player (sidescrolling shooter)


Then you can fix it by next code in singleton:

func _ready():
    if get_tree().root.find_node("name of your camera2D in scene") == null:
        var camera :=
        get_tree().root.call_deferred("add_child", camera)
        camera.current = true
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.