30 FPS physics and movement jitter issue

trvkvtrvkv Posts: 5Member
edited August 2019 in Programming


I'm a newcomer to the forum and this is my first question, so I'm saying "hi" to everybody there :) I'm also quite a newbie in game development and Godot, so please forgive me if my question will be stupid, or not precise enough.

If similar question was raised in the past (guess it's quite possible), please tell me, I will happily check every clue by myself.

Every Godot tutorial I saw or read was describing the KinematicBody2D move_and_slide or move_and_collide methods as those which will make my game character move. I was using those successfully for some time, but then I spotted an issue which looks unsolvable for me using those two mentioned methods (or at least move_and_slide):

When I changed my physics FPS from default 60 units to 30 (or lower), I spotted a jitter during the body movement. I'm (kind of) aware the origin of the issue: the screen frame rate is no longer synced to physics process. Physics updates every two (or few) frames, and so the animation is no longer fluid.

The problem is that it looks like my animation is completely tied to the physics process. As far as I understand it's not the best possible way of developing a game; the physics process should calculate the future position of the body (but not moving the body) and the 'move' animation should be done by interpolating body current position (in _process method?) to the one predicted by the physics engine... Am I on the right track or not?

I got few clues how to solve the issue, eg.:

  • use test_move function or move_and_collide with test_only parameter to query after collisions (most probably, this means that I need to handle the collision by myself - to make the body actually collide, without uncontrollable behaviour and shifting it's position a little),
  • use AnimationPlayer with motion/sync_to_physics and animate the movement inside the player (but how to do that?? Got no tutorial and no clue at all how to start with it...),

but both of them seems rather complicated and uncertain.

Please give me your thoughts about that. What are the ways to solve that issue?

Tags :


  • CalinouCalinou Posts: 376Admin Godot Developer
    edited August 2019

    If you want to preserve smooth physics after decreasing the physics FPS, you will need to implement physics interpolation somehow.

    If you use a daily build (or Godot 3.2 in the future), you can use this smoothing add-on to this effect.

  • trvkvtrvkv Posts: 5Member
    edited August 2019

    Well, the good news is that Godot dev guys started to handle that. I will try the addon, thanks :)

    EDIT: Btw. I wasn't aware that at current stage of Godot development it's not possible. But still, it will be available in time which is good.

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file