3D camera jitters

Godot Version



I know a cause is due to the character movement rendered as physics_process while the camera is on process… I still can’t figure out how to interpolate the physics fps into the camera’s. My monitor’s refresh rate is 165hz and physics are untouched (so they run at 60?).

Here’s a video demonstrating the issue.

You could change some project settings in Physics > Common. there’s Physics ticks per second (60) and jitter fix in the advanced settings.

That’s what I want to avoid: increase ticks (worsening the performance on weaker hardware) or forcing a 60fps cap to my game.

Looks like there’s a solution on Reddit, and a linked ongoing github issues discusison on making this easier/part of the engine. As a 60hz monitor nerd I am surprised there isn’t a good default for this, VR toolkit just recommends increasing the physics ticks to 144

var old_position: Vector3

func _physics_process(_delta: float) -> void:
    old_position = position

func _process(_delta: float) -> void:
    var t := Engine.get_physics_interpolation_fraction()
    sprite.position = old_position.lerp(position, t)

Eventually I learned that nothing has interpolation when running under _physics_proccess. I tested with an immobile camera and lowering the physics ticks, and my player character does jitter at the assigned framerate.

Apparently lerp only works with floats…? In any case, the code you posted still helped me to understand more quickly how this video for interpolating the camera (and that alone is NOT enough, as stated on my first paragraph) works, and there’s a Godot 4 version code in the comments, which mentions the interpolate_with method - for Transform, which is what I’ll also need.

I did a quick test and it does interpolate, now I’ll just have to spend the time to adapt the references into my game, haha.