EDIT: 8 hours passed, got an "answer" which didn't even answer anything, and a -1 for using move_and_slide
in _process
- at this rate the entire Godot community will burn me to ashes for doing something that is perfectly acceptable by devs.
Anyway, I found a good fix for it, just use this instead.
It basically makes all jumping take place without move_and_slide
, so delta can be applied where it actually makes sense, which is at the gravity handling part.
How it works right now
EDIT: YES. I do physics calculations in _process
, and I won't change it, unless there is a way to make it lag free.
I implemented all movement, but only jumping has some problems.
To make it smooth I use this expression:
velocity = move_and_slide(lerp(velocity, desired_velocity, friction), upwards_direction)
I only set desired_velocity
, this makes all moment as smooth as friction
want's it to be.
To make it fair I simply set friction = 10 * delta
, which will make everything accelerate, and deaccelerate at the same speed no matter how fast the game runs.
I made it latency-free, and universal by just planting everything in _process
, as _physics_process
would result in jittery movement and latency on monitors with refresh rate higher than 60.
My entire player.gd
can be found here.
The jumping
I simply use this line to get myself to speed:
desired_velocity.y += 40 * mvmnt_amplifier
And this handles gravity, and deacceleration:
desired_velocity=Vector3(0, gravity_strength*10, 0)
All of it results in smooth, and latency free jumping expirence, with one problem.
The problem
At 144 fps I jump ~4.5 units, when at 30 I jump whopping ~51.3 units high.