Camera2D not following player

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

I have a Camera2D as a child node to the root node in my Player scene. But it doesn’t follow the player character around! I have the current property as “on” and all drag margins set to zero. I’m not sure what I’m doing wrong here. Is there another setting that I have to fix? Do I have the Camera2D node in the wrong place?

What node are you actually translating for you Player motion (is it possibly not the root node)? Is the camera a child of that node? A screen shot of your scene tree would probably be helpful here. Along with an explanation of which node is being translated…

jgodfrey | 2020-03-08 20:08

Here is a screenshot of my scene tree.Scene tree screenshotI move the “Player” node around.

exuin | 2020-03-08 21:26

Have you checked ‘current’ on the Camera2D node?

yahwhey | 2021-03-11 16:05

:bust_in_silhouette: Reply From: jgodfrey

I just replicated your scene tree exactly, and I don’t have any problem with the Camera2D node following the Player node. So, something else must be wrong with your setup. Does the camera work if you run the Player scene by itself? Are there other cameras in your game?

There’s not any other cameras in my game. However, when I run the Player scene by itself, I can’t move the player, so I can’t tell if the camera works there.

Edit: I tried making a custom camera but that didn’t work either. I also duplicated my setup into another project and that didn’t work either. Maybe there’s something wrong with my Player movement script???

Edit 2: I got it working. I have no clue how.

exuin | 2020-03-09 22:17

I had a similar thing happen to me. Turned out I had inadvertently set the Camera2D limits to 0 and so the camera couldn’t move. One thing to check if you run into this situation, future reader.

wsankey | 2020-09-20 17:33