@Dismantled said:
Get buttons working without using signals. In the Vr tutorial no signals were used?
Unfortunately, I don't know how to get it working entirely without signals. In the Godot VR tutorial, the signals are connected in code using the connect
function:
connect("button_pressed", self, "button_pressed")
connect("button_release", self, "button_released")
It might be possible to use just _input
, but I haven't tested so I cannot say for sure.
I figured how to print the values for the joysticks and the throttle! ...
Great! I actually never figured out how to get the joystick throttle, but the tutorial didn't need it so I skipped it. I'll definitely keep this in mind for any future VR projects. Thanks for sharing the code!
Is there a way to print the trigger_throttle so it only displays once(in real-time) not a new update every-time I press it?
I don't know anyway right off, without using a Label node. According to this Godot QA answer, the draw_string
function might help, but personally I have not used it so I cannot say for sure.
The easiest way is probably just to make a Label node and assign it to that, but that might be hard to see in VR.
Another thing you could try is exposing the variable to the editor using the export
keyword in the definition of the variable (assuming it is a class variable and not a function variable) and then use the remote view in the editor to see the value. Not idea, but it could help.
I can't think of any other ways right now, but I'll keep thinking and will update here if I find something.
Edit: Looking at the code, you'll need to change it a bit to use the export
keyword, assuming you want to go that route. Something like this should work:
extends ARVRController
export (float) var trigger_throttle = 0
func _input(event):
var trackpad_vector = Vector2(-get_joystick_axis(1), get_joystick_axis(0))
var joystick_vector = Vector2(-get_joystick_axis(5), get_joystick_axis(4))
trigger_throttle = get_joystick_axis(2)
print(joystick_vector)
#print(trigger_throttle)
Then you can inspect the exported variable in the editor while the game is running by using the remote view.