|Topic was automatically imported from the old Question2Answer platform.
I am moving a camera2D using ScreenDrag like this:
if event is InputEventScreenDrag:
The camera is moving perfectly and it stops perfectly according to the limits I set.
The problem is that if I continue to drag across the screen after the camera reached the limit, the camera is not moving like it should, but somehow the event.get_relative is still getting added to the camera position.
This means that when the camera reaches limit_left and I drag left 3 more times, I have to drag the camera right 3 times and on the fourth drag it only starts to move right. It is like it is undoing the extra 3 left drags first.
Can you please show me how to avoid this. How can I stop event.get_relative() being added when the camera reaches its limits. I tried using something like clamp but i got the same results.
Thanks in advance
Hey, in your code snippet, what is MyCam and what node is the script attached to? Is MyCam an instance of Camera2D, or of a parent Node2D? My answer assumes that “MyCam” is a custom camera implementation, but after taking another look at the docs I’m not sure whether I was correct to assume that…
jhigginbotham64 | 2019-10-18 04:19