Why is my camera position offset to bottom-right in Play Mode?

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

Following a tutorial from youtube by Eli Cuayong.

The camera view is seen godot editor view with camera2D node at position (0, 0) godot-editor Imgur: The magic of the Internet

The camera is meant to be centered at positions (0, 0) but when I start play mode, the screen starts offset to bottom-right play-mode Imgur: The magic of the Internet

What is the anchor mode set at?

shifitzel | 2022-09-18 19:49

Thanks for your reply!

The anchor mode is set to Drag Center

yshen | 2022-09-19 16:35

:bust_in_silhouette: Reply From: shifitzel

Can you copy and paste the .tres file? Thanks.


[gd_resource type="Environment" load_steps=2 format=2]

[sub_resource type="ProceduralSky" id=1]

background_mode = 2
background_sky = SubResource( 1 )

yshen | 2022-09-20 09:24

Sorry I meant the comera2d .tscn.

shifitzel | 2022-09-20 10:56

Oh yeap sure thing.

I don’t have a camera2d.tscn in the project.

The project has a world node that contains:

  1. PlayerNode
  2. Camera2D
  3. WallNode (5x)
  4. CanvasLayer

In the World and WallNodes, there is only a _physics_process function that moves the WallNodes by a Vector2.

In the PlayerNode, there are logic to:

  1. Move the playerNode vertically (falling down usually and UP on ‘space’ keypress
  2. Detect collision with the Walls
  3. Reset the Walls that go out of bound
  4. Display the score via CanvasLayer

As such there is no reference to the Camera2D except being a child of the World node.

Hope this helps, thank you

yshen | 2022-09-20 11:50

If you isolate the Camerra2d does it work?

shifitzel | 2022-09-22 01:38

I’m not sure how to isolate the node, would you be able to guide me?

yshen | 2022-09-22 12:52

Create a new scene. Copy and paste the Camera2d into the scene. See if the camera is shifted right when you run that new scene.

shifitzel | 2022-09-23 14:30

Yes it seems like the camera is still shifted to the bottom-right. I’ll reply with the links of the editor and playmode view when they are uploaded.

yshen | 2022-09-24 12:33

I would suggest playing around with the camera settings and seeing if anything changes.

shifitzel | 2022-09-28 00:54