30 FPS physics and movement jitter issue
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_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
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.:
test_onlyparameter 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),
motion/sync_to_physicsand 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?