Hello, everyone, I have this really simple camera script which moves the camera as player moves its mouse (duh) but this thing is I found out in the internet that there is this lerp() function that can make things even smoother, the problem is that I cant implement in my code.

Any tips?

Here is the code for camera

func _ready() -> void:
  Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
	
func _input(event: InputEvent) -> void:
  if event is InputEventMouseMotion:
    player.rotate_y(-deg_to_rad(event.relative.x * sensitivity))
    fps_camera_root_x.rotate_x(-deg_to_rad(event.relative.y * sensitivity))
    fps_camera_root_x.rotation_degrees.x = clamp(fp_scamera_root_x.rotation_degrees.x, -70, 80)

But I want to smooth this with lerp, I've read the documentation and tried to implement, here is the code now

func _physics_process(delta: float) -> void:
	fps_camera_root_y = fps_camera_root_y.rotation.x.lerp(event, delta * sensitivity)
. . .

And I get this error

How am I supposed the get all of this working? The FPS movement is working just fine, only the lerp its not.

    xyz

    Hello, xyz, good to see you again. I mean it by making the camera movement smoother when moving the mouse around.

    F0xer99 'lerp()' isn't a member function for type float. It's a global scope function. The error message is telling you that you can't call ...rotation.x.lerp() b/c member 'x' (of type float) doesn't have such a function. Instead you need to call lerp as a stand-alone function. Your code should be something like:

    fps_camera_root_y = lerp( <from>, <to>, <weight> )

    https://docs.godotengine.org/en/stable/classes/class_@globalscope.html#method-descriptions