I discovered something while building a very smooth camera and using the lerp function.
It seems the camera will jitter as it gets very close to the object its following if the lerp value is below 1.0
Mine is 0.05
I began to solve this by using "div" instead of "/" in any division calls inside the camera scripts, however surfaces and instances would sort of displace for a few frames as the camera was in its final few frames of settling. They appeared to be jumping/jittering around.
I solved this issue with the surfaces by simply calling their attach points from inside the camera object, but the instances continued to "jump/jitter" around a few frames.
I found a way to stop this today by simply using floor(x) and floor(y) in all the draw functions of every instance and surface on screen.
For example, instead of:
draw_sprite(sprite,index,x,y);
I'm using:
draw_sprite(sprite,index,floor(x),floor(y));
This has completely solved the jitter issue and the camera is ultra smooth now.
Im curious as to why this works. It seems this could have been built into the draw_sprite functions. Any thoughts?
It seems the camera will jitter as it gets very close to the object its following if the lerp value is below 1.0
Mine is 0.05
I began to solve this by using "div" instead of "/" in any division calls inside the camera scripts, however surfaces and instances would sort of displace for a few frames as the camera was in its final few frames of settling. They appeared to be jumping/jittering around.
I solved this issue with the surfaces by simply calling their attach points from inside the camera object, but the instances continued to "jump/jitter" around a few frames.
I found a way to stop this today by simply using floor(x) and floor(y) in all the draw functions of every instance and surface on screen.
For example, instead of:
draw_sprite(sprite,index,x,y);
I'm using:
draw_sprite(sprite,index,floor(x),floor(y));
This has completely solved the jitter issue and the camera is ultra smooth now.
Im curious as to why this works. It seems this could have been built into the draw_sprite functions. Any thoughts?