Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | gfan | |
Old Version | Published before Godot 3 was released. |
Hello,
i have made an simple fps game i can look around with the mouse movement. I want to setup this for mobile too. Is it possible to change the mouse movement to a virtual button?
This is my code.
if event.type == InputEvent.MOUSE_MOTION and Input.get_mouse_mode() == Input.MOUSE_MODE_CAPTURED:
#pitch and yaw
yaw = fmod(yaw - event.relative_x * view_sensitivity, 360)
pitch = clamp(pitch - event.relative_y * view_sensitivity, -85, 85)
holder_sway_ang += Vector3(event.relative_y, event.relative_x, 0)
get_node("Yaw").set_rotation(Vector3(0, deg2rad(yaw), 0))
cameraNode.set_rotation(Vector3(deg2rad(pitch), 0, 0))
And how this works.
Sorry i’m a complete newbie to Godotengine
regards
gfander