godotengine / godot-proposals

Godot Improvement Proposals (GIPs)
MIT License
1.16k stars 97 forks source link

Optional centered Scene on "Play Scene" #1313

Open letsgamedev opened 4 years ago

letsgamedev commented 4 years ago

Describe the project you are working on: 2d Pixel Art Game

Describe the problem or limitation you are having in your project: All my Scenes like Player, Enemies, Objekt having their origin point at 0,0. Before I test the Scenes in the real game I run the single scene with "Play Scene" button (cmd+r) The problem is, that 0,0 is always at the top left side, which is correct but not very useful in that case.

Enemy in editor origin position on 0,0

Bildschirmfoto 2020-08-05 um 15 04 40

Looks useless with "Play Scene"

Bildschirmfoto 2020-08-05 um 15 04 50

Describe the feature / enhancement and how it helps to overcome the problem or limitation: It would be nice if it would be possible to play a single scene so, that the 0,0 point is in the center of the Window to see the whole object.

Describe how your proposal will work, with code, pseudocode, mockups, and/or diagrams: Maybe an option in the editor configs or instead of cmd+r it would be cmd+opt+r or so, to activate the centered version.

If this enhancement will not be used often, can it be worked around with a few lines of script?: The Workaround is to drag the object to another position, but that can lead to problems especially with coded positions.

Is there a reason why this should be core and not an add-on in the asset library?: I think this is a common problem, cause 0,0 is a natural center point for objects.

KoBeWi commented 4 years ago

that can lead to problems especially with coded positions.

What problems exactly? When instancing scenes you usually set the position anyways. The only "issue" with non-zero origin is that it's saved in the tscn.

letsgamedev commented 4 years ago

Like rotate the whole node for example. If it's at 0,0 it will rotate on the spot. if I build the object on 50,50 it will still rotate around 0,0 and so it will make a circle.

Calinou commented 4 years ago

You could create a scene with a Camera2D as root node and add it as a singleton in the Project Settings. You'll want to find a way to disable it when running other scenes, though. (If you check the Current property in other cameras, it will override the default camera, but undefined behavior will happen if you have multiple cameras with Current enabled.)

geekley commented 6 months ago

See also https://github.com/godotengine/godot-proposals/discussions/9719