Godot Version
4.2.2
Question
I noticed a stuttery fps when I played a level in my game with lots of enemies. Their script has a pretty large _physics_process function, so I tried to see what happened if I deleted it and found that my fps became super smooth. I then profiled it and noticed my Physics Time (which seems to be linked to the _physics_process function) fluctuated between 0ms and 5ms. I then reduced the _physics_process function to only a few simple lines and it still fluctuated between 0ms and, this time, 1.5 ms. Faster, but it still felt slightly stuttery. Does anyone know why this happens and is there any way to make the _physics_process time more stable?
I would also like to mention that my physics fps is 60. This is the _physics_process function:
func _physics_process(delta):
if target == null:
dist_from_target = 10000
else:
dist_from_target = Vector2(target.position.x, target.position.z).distance_to(Vector2(position.x, position.z))
if not is_active() or not alive:
return