I am trying to port a very simple game from godot 3 to 4. I have a very simple physics system for a sliding object in 3d, but for some reason it randomly will slow down far faster than it should when in contact with the ground, sometimes even then to speed back of for a few frames before slowing again. I checked and it isnt a framerate issue. The objects seem to have a set velocity that they drop to before the speed drops off as expected. I never had this issue in godot 3, and there has been functionally no changes to the code that manages the velocity.
Below is all the code i have written that affects the velocity.
func _process(delta):
var collInfo = move_and_collide(velocity * delta)
if collInfo:
velocity = velocity.bounce(collInfo.get_normal())
velocity *= airResistance
velocity.y += gravity

I have also noticed a bug that when colliding with a cylinder the object gains more velocity than it had before the collision, which means that if there are multiple cylinders laid down next to each other the object will end up rolling back and forth between them repeatedly. I saw in the documentation that collision for cylinders is buggy, so im not sure if that is the cause for this, but it was not an issue in the version I made in godot 3.
Any advice on how to fix this or what is causing this would be greatly appreciated

    zoron
    I don't see anything wrong with the code. Eventually you could try to first run test_move() and then calculate the bounce and move the object directly there, skipping the actual collision from really happening.

    But I would suggest testing if the Jolt Physics Engine (https://github.com/godot-jolt/godot-jolt) would solve your issue. I switched to it recently and it helped me with situations where my objects occasionally fly into the air with a speed of light when squeezed between two other objects. Maybe it will help you too. Installation is simple and I can't see any downsides from using it.

    I tried Jolt, but it didnt help. I did more testing and the velocity of the object is actually deteriorating correctly, but for some reason whenever it is in contact with the ground it seems to get slowed down without actually effecting the velocity. This is also the reason for it bouncing repeatedly on the cylinders, as it is getting slowed down as it is trying to slide down the curve, but the gravity is accelerating it still when it shouldnt be. Does godot happen to have a built in friction system now that wasnt present in 3?