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