How to use transform to rotate camera view by mouse movement input?

Here’s my code for rotating the body (Y axis) and the camera pitch (X axis) during _input:

	if _is_mouse_looking and event is InputEventMouseMotion:
		rotate_y(event.relative.x * -0.005) # rotate the whole body instead of just the cam
		_cam_pitch = clampf(_cam_pitch - event.relative.y * 0.005, -0.5 * PI, 0.5 * PI)
		_camera_3d.rotation.x = _cam_pitch # _cam_pitch is a float member var

But if you really want to use transform, or rather basis, you can do something like that

transform.basis *= Basis.from_euler(Vector3(event.relative.y, event.relative.x, 0.0) * 0.005,)

I recommend doing the pitch and the yaw in two separate commands, otherwise you will get strange rotations.