Thank you Calinou. Opening it in 3.1alpha3 surely did some help performance wise. I didn't change anything in the code and the overall pattern of the stuttering is more obvious now, while the game itself seems to performant better. It seems like it has something to do with the camera rotation, because it only appears when rotating now.
This is the code that updates my camera rotation:
var camera_angle = 0
var mouse_sensitivity = 0.8
var camera_change = Vector2()
and
func _physics_process(delta):
aim()
and
func _input(event):
if event is InputEventMouseMotion:
camera_change = event.relative
and
func aim():
if camera_change.length() > 0:
$Head.rotate_y(deg2rad(-camera_change.x * mouse_sensitivity))
var change = -camera_change.y * mouse_sensitivity
if change + camera_angle < 90 and change + camera_angle > -90:
$Head/Camera.rotate_x(deg2rad(change))
camera_angle += change
camera_change = Vector2()
In general within _physics_process I check whether the mouse delta has changed and if so, it rotates the player's Head along the y axis and the Camera (child of Head) along the x axis accordingly by mouse_sensitivity.
The general camera movement speed is totally fine like this. I set it to 0.8 because that value feels like my usual preference for any fps game I play speed wise.
I frequently play different FPS Games and I don't think there is a single one that I played, that behaves like mine, since currently, it would be impossible for me to hit targets at long range.
That is because the camera rotation is only updated whenever I move my mouse by atleast 1px (I guess that would be it, if there was a cursor shown). So when I move my mouse very slightly there is no registration until a specific mouse drag distance. But when it then registers the mouse movement it then adds / subtracts it by mouse_sensitivity (which is 0.8 for me).
Soooo, my camera's movement speed is fine with those settings. But it causes the camera to jump in intervals (or snapping to a grid) defined by mouse_sensitivity, therefore creating gaps, making it impossible to target specific points.
Is there a way to achieve a specific camera rotation speed without losing preciseness like in actual fps games?
I hope this somehow makes my problem understandable and someone can help me. :)
27