MarcoFazioRandom / Virtual-Joystick-Godot

A simple virtual joystick for touchscreens, for both 2D and 3D games, with useful options.
MIT License
731 stars 80 forks source link

right stick for camera rotation #40

Closed Gp-triple closed 1 year ago

Gp-triple commented 1 year ago

Hi, I'm tryng to use your plugin for a right stick that control 3d person camera. the pad doesn't perform any action if i set the action "look_left" "look_right" etc for the camera rotation. using that action with a real gamepad works fine. any suggestions?

MarcoFazioRandom commented 1 year ago

Hello, Can you double check these:

Can you show some screenshot or code so I can better understand your issue?

Gp-triple commented 1 year ago

hi the answer is yes for both the question here's a screenshot image and this is the code func _rotate_camera(delta: float, sens_mod: float = 1.0) -> void: look_dir += Input.get_vector("look_left","look_right","look_up","look_down") camera.rotation.y -= look_dir.x * camera_sens * sens_mod * delta camera.rotation.x = clamp(camera.rotation.x - look_dir.y * camera_sens * sens_mod * delta, -1.5, 1.5) player.rotation.y -= look_dir.x * camera_sens * sens_mod * delta look_dir = Vector2.ZERO

grazie

MarcoFazioRandom commented 1 year ago

Hello, I remembered the "get_vector" is bugged, It doesn't work with simulated input. There is already a closed issue for this bug in this repo and on the Godot's repo, but the bug hasn't been fixed yet.

You can use "get_axis" like in the example script.