If my camera is following my player how can I make it stop at the edge of worlds?

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

My camera is following my player but when my player reaches the end of the world I want the camera to stay still while the player just walks to the end. How can I do this?

That depends on how you normally move your camera. Do you move it by script (I.e. in the _process() func) or is it simply a child node of the player?

When you move it by script then you can just add & set a conditional variable to stop the normal processing. When the camera is a child of the player you could save its global_transform, remove it from the player, add it to the scene and restore its global transform. Or generally switch it to script.

wombatstampede | 2019-11-13 07:39

:bust_in_silhouette: Reply From: zen3001

make the camera a child of a kinematicbody, and create walls that only collide with the cam’s kinematicbody, I don’t understand tho why you that would be a problem if it’s allways following the player anyways