Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | JulioYagami |
Could you be more specific please? Add the details in your question description.
SIsilicon | 2019-02-28 00:13
Mouse position:
Either query the mouse events in some controls _input()
handler or use get_viewport().get_mouse_position()
from i.e. a _physics_process()
handler in a script.
Then put the mouse coordinates relative to the viewports size and use the relative difference to the center to add angles to some variables (i.e. rot_x, rot_y). (referring to mouse_x and mouse_y)
Then (in _physics_process()
) rotate the cameras transform.basis first (!) around the y-axis (using the rot_x) and then around the x-axis (using rot_y).
(one way to do)
Rotating around the y-axis basically means looking left and right.
Rotating around the x-axis basically means looking up and down. (if you have “up” and “down” which i.e. isn’t the case in 3d space games)
wombatstampede | 2019-02-28 16:34