Controller used as a mouse

QUESTION

Hello, do anyone know how to make the controller serve as a mouse with the mouse plugged in? Any help will be appreciated.

MY SCRIPT

func _physics_process(delta: float) -> void:
	var rightStickVector = Input.get_vector("CMdown", "CMup", "CMleft", "CMright")
	get_viewport().warp_mouse(get_global_mouse_position() + rightStickVector * MOUSE_SPEED * delta)
	

What’s wrong with the code snippet you posted ?

And could you elaborate on “serve as a mouse with the mouse plugged in” ?