Instantiated player camera odd movement

Godot Version

4.2

Question

Node Setup
The player node has a Camera2D as a child.

When I instantiate the player the game loads but the camera moves across screen to get to the player. Have I missed a setting somewhere that makes the Camera2D just load in the place of the player and not move across screen?

Thanks!

1 Like

Does the camera smoothly go to the player or just warp to him?

1 Like

If yes you may try calling “reset_smoothing()” on the camera and it should instantly reach the player. I hope I have been of help

Update:
I tried to replicate the problem by creating a sprite with a camera child with position smoothing in a 2d scene, then moved the sprite to a new position and the camera smoothly moved to the player, then I tried to move the sprite and immediately afterwards calling “reset_smoothing()” on the camera and it moved both camera and sprite to the new location instantly

2 Likes

Spot on! Created a script for the Camera. This resolved the issue instantly.

extends Camera2D


func _ready():
	reset_smoothing()

Thank you!

You’re welcome

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.