input.get_vector() not working with array

Godot Version

Godot 4

Question

so far in my game I have used the input.get_vector() method to call for ui to control my character3D. After I expanded my map I needed alternate rooms with different (still) cameras (I have created a function which allows the user to toggle these cameras, in doing so changing the state of an enum to “FORWARDS” , “LEFT” and "RIGHT.)

However, after changing the direction of the camera , the ui controls are now assigned to the wrong keys, as the character is still facing the same direction.

to fix this, i tried to create an array for my ui controls that changes depending on the state of the face_dir variable:

cc… however, the get_vector() method doesn’t seem to accept the array/ seems to only count it as one argumentrather than 4:

image

If anyone has any fixes or ulterior methods then that would be appreciated :slight_smile:

… I could try flipping the character instead, but i just wanted to know if there were any fixes for this/ if its possible to put an array in a method for future use.

Function arguments are not arrays despite the comma, you have to expand your array to produce 4 arguments. You can index each element in the array, or potentially use callv/bindv

var dir := Input.get_vector(ui_controls[0], ui_controls[1], ui_controls[2], ui_controls[3])

Make sure to paste code as text instead of screenshots

Try Input.get_vector.callv(ui_controls)