boku-ilen / godot-vr-toolkit

A few useful nodes that should ease implementing VR in Godot. UI, Teleport and other useful tools.
GNU General Public License v3.0
11 stars 2 forks source link

Add a feedback (vibration) to the controller if it hovers a new UI-element #3

Open MathiasBaumgartinger opened 4 years ago

MathiasBaumgartinger commented 4 years ago

The ARVRControllers of https://github.com/GodotVR/godot_openvr have a property rumble which can be set in order to make the controller vibrate. As our controller-UI-input is only a faked mouse-input it is not quite that simple finding out the id of the controller that currently hovered the new UI element. Sadly the mouse_entered function does not provide the event.device property.

MathiasBaumgartinger commented 4 years ago

0f9db6631e68dd72d99dc9d0a1cb95e546b56e76 does this, i have found a little workaround that only one controller can be active per viewport. Seems a little hacky with a global-access dictonary (singleton) on the controllers and the ui itself setting one active controller at a time via the _gui_input(event):-function and event.device. I will rewrite this at another time maybe.

MathiasBaumgartinger commented 4 years ago

Might reconsider refactoring this and see if there is a more elegant way to this, i cannot seem to find one right now however.

MathiasBaumgartinger commented 4 years ago

Also there seems to be a bug when hovering with 2 interactions as this will result in one controller permanently vibrating.