So my player keeps jittering every so often when I have move_and_slide inside of physics process. But when I have it in process it doesn't. I tried setting the physics fps to 60 and setting the game fos to 60 but no fix.
How to fix KinematicBody2d jitter?
Whats the refresh rate of your monitor?
cybereality Its 60mhz
How did you create your map? Is it 2D or 3D?
cybereality Its 2d. Sorry forgot to state that.
Update: i recreated my code on a laptop and it didnt do it. While on my desktop it does.
- Edited
KrazyDev 60mhz
Wow! Whats the resolution? I kid, you likely meant 60Hz.
I presume your laptop doesn't manage a perfectly smooth 60fps in physics thread and that causes the jitter.
What are the specs of your computers and how intensive is the game? Is it possibly a performance issue? I usually do my movement code in _process(), because _physics_process() doesn't work well on high refresh monitors and introduces very slight amount of lag. But it should not cause jitter. It could also be a physics engine issue, like if there are bumps or small gaps in the floor that are causing collision issues. But I'm not sure.
cybereality I set the force fps and physics fps to 200 and seamed to fix it. Would using move_and_slide inside of _process break or cause any future problems? I would like to add online multiplayer to my game and dont want to add anything that'll kick me in the but in the future.
- Edited
Ideally you want physics functions in _physics_process() otherwise there is a small chance that the screen update and physics engine could get out of sync (causing things to go through walls or jitter, or other bugs). However, in practice, I found _process() to produce better results. I'd also recommend reading this:
https://docs.godotengine.org/en/stable/tutorials/physics/interpolation/index.html