Hello boys and girls,

I am pretty new to Godot but I am blown away by how good it feels to work with it ... so far. :)

Anyway, after following the Godot FPS Controller Tutorial (by Jeremy Bullock on YouTube) I stumbled across the issue of having little stutters when turning the camera. It's not consistent and I have the feeling it depends on how fine I move the mouse. It gets more obvious when aiming and moving at the same time. It vibrates and the camera shakes.

I've read many posts with similar issues, but only a few had videos in them to fully check whether it is a similar problem. Also I read that it could probably be because of vSync and/or FPS limitation. I checked out many different settings. Nothing fixed the issue. FPS counter constantly stays at 60 FPS.

To demonstrate the problem I uploaded a video.

As you can see while only moving it is smooth and as it should be. [0:02 - 0:16] While only it is smooth but sometimes feels a little bit laggy (maybe same issue). [0:17 - 0:37] While doing both at the same time it feels laggy consistently shaky [0:38 - 0:37]

I had a very nice start with Godot one week ago, following several tutorials and experimenting by myself, and everything seemed to work out perfectly since then, but this issue triggers me for 2 days now and I don't want to continue not knowing how to handle the problem.

Hopefully someone can help me. <3

27

I remember seeing reports about this being fixed in the master branch (what will become Godot 3.1 in the future), so you could try opening your project in 3.1alpha3 or a daily build. However, as it's not 100% backwards-compatible, you may have to change a few things so it runs properly again. Also, be sure to make a backup of your project before opening it in a new version!

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

4 years later