When I move the character this camera jitter/hiccup happens. I tried moving the movement logic from _physics_process to _process but that doesn’t help.
I also tried:
to set the camera global position to character’s position,
What is the cameras process_callback set to?
Since it is not always jittery (at least that’s how I make it out in the video), it could also be unrelated to the camera. Have you monitored the performance?
The problem is likely that your player movement is jittery. In you video only the background is ‘stuttering’, not the player itself.
How are you moving the player?
If you move the camera independent of the player, do you also get the stutters?
You could try to interpolate the position change of the camera instead of directly setting it. This should make the camera movement ‘smooth’.
You should also move the movement code back to _physics_process since move_and_slide does physics calculations. You can then optionally turn on physics interpolation to avoid jittering when physics ticks and frames are not in sync.
I switched my project to 2.5D/HD-2D style because the Jolt3D physics engine was integrated in 4.4.
I did the following:
set physics/3d/physics_engine to Jolt Physics,
enabled physics/common/physics_interpolation,
set physics/common/physics_jitter_fix to 0.0,
set physics/jolt_physics_3d/simulation/velocity_steps to 20 and
physics/jolt_physics_3d/simulation/position_steps to 4
With all of that done, I don’t experience any jitter related to this issue, but the 2D engine is the same as before, this only fixed the 3D engine jitter, not 2D.
Edit:
If this is of any help, these videos explain how you could pull off 2D in 3D engine and the benefits of that approach:
It’s hard to believe it’s not possible to pan a camera2d across a scene without intermittent stuttering, especially now that there’s 2d interpolation,
but I really appreciate you taking the time to detail your approach and solution.