How do I add 3d camera rotation?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Danielle’sgames

I’ve been trying to get the camera to rotate, in a first person game, when the mouse moves. I’ve tried using different tutorials, but none of the code made it so that the camera would rotate left to right and vice versa. Does anybody know how to do that?

Hello Tato64,

I apologize for taking so long to reply to this, but I just wanted to thank you for the link and say that the camera now rotates when the mouse moves.

Danielle’sgames | 2021-07-16 16:54

if this is 3D I know how to get a variable to record the movement of the mouse and send the mouse back to the center of the scene. Just make sure you have a way of making this cease to happen or you may have to press ALT F4 to exit the window when you are done.
I do not yet know how to translate that into movement.

var facing = get_viewport().get_mouse_position() - get_viewport().size/2.0
get_viewport().warp_mouse(get_viewport().size/2.0)