Nathan Laing
Member
Hello everyone,
I get camera jitter when scrolling the view, and/or scrolling the view to follow an object (with what is probably very well known code by now), below.
I've tried using floor on every aspect possible below, which does improve the result somewhat, but ultimately, if the scroll calculation falls below a certain amount, the camera jitters. I would like to know if there is a 'smart' way or any other means one could apply to eliminate this phenomenon.
I get camera jitter when scrolling the view, and/or scrolling the view to follow an object (with what is probably very well known code by now), below.
I've tried using floor on every aspect possible below, which does improve the result somewhat, but ultimately, if the scroll calculation falls below a certain amount, the camera jitters. I would like to know if there is a 'smart' way or any other means one could apply to eliminate this phenomenon.
Code:
// point the camera in the direction of the mouse
direction = point_direction(x, y, mouse_x, mouse_y);
xTo = mouse_x;
yTo = mouse_y;
// bigger number on division gives slower camera response
x += (xTo - x) / 8;
y += (yTo - y) / 8;
// move the view according to the calculations
view_xview = -(view_wview / 2) + x;
view_yview = -(view_hview / 2) + y;