control the character with the mouse

Using the XY value of the input axis event works fine for mouse. Other hardware in particular joysticks might drift by a small factor each frame but this can be filtered out by ignoring low values. This is irrelevant since the topic is for a mouse but if this is your wish:

then you could also consider using this instead for your cursor position, to deproject from 2D to 3D world space:

UGameplayStatics::DeprojectScreenToWorld