Touch camera limits

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

Hello everyone!

I am using the camera script from here: http://kidscancode.org/godot_recipes/2d/touchscreen_camera/ to move the camera with touch input around. But how can I modify this script that the camera does not exceed the limits?

Thanks in advance and best wishes!

:bust_in_silhouette: Reply From: ramazan

Add to “func _process(delta)”
See “Help” from “Godot Engine” how to use “clamp”.

position.x = clamp()
position.y = clamp()