I saw some joystick-related code in this example:
This is some untested code, which hopefully helps:
const JOYPAD_DEADZONE = 0.15
const FOLLOW_SECS = 0.5
var joypad_vec = Vector2()
if Input.get_connected_joypads().size() > 0:
joypad_vec = Vector2(Input.get_joy_axis(0, 2),Input.get_joy_axis(0, 3))
This code first gets the joystick coords and puts them into x,y of a vector2.
You might have to adjust the axis-values depending on the joystick and axes you use.
If the values are not too close to the center (DEADZONE) then that vector is normalized (set to length 1).
You also might have to multiply the z-value with -1. This depends on where "forward" is on your mesh.
One way is now to create a rotated basis. The angle of rotation is determined by using the vector2 method "angle_to" which determines the smallest angle between basis.z (
current_vec) and the joystick "vector". I chose the
Vector2.angle_to() because this hopefully returns a signed angle (opposed to Vector3()). (See here: https://github.com/godotengine/godot/issues/31519 )
The slerp value is determined by the time which you allow to reach the joystick angle. FOLLOW_SECS should be that time in seconds. (So if you hold the joystick steady in one direction, the basis should be rotated in that direction after 0.5 secs)
Code may contain errors. But I hope that it runs in general.