How to make a VR controller recognized by a RigidBody?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By AutumnRivers

Hello everyone, I’m currently making a VR game where one of the features has the user physically pressing a button in their other hand. The button should then spawn something above or below the enemy as an attack. There’s an issue with it, though - I can’t even get the button to recognize the controller.

I’ve tried adding a RigidBody as a child to the controller, and I’ve got all the contact monitors for both the controller and the button scene set up, but neither is working properly.

I have some images of the scenes below:


Both of them have a Collision Mask of 2 & 3 and are both on layers 2 & 3. I have a piece of code set up in the Button’s script to detect when something collides with it and then report what collided:

func _ready():
    self.connect('body_entered', self, '_button_hit')

# ...

func _button_hit(obj):
    print(obj.get_type())
    if obj.get_type() == 'ARVRController' && obj.controllerHand == 'left':
        _use_gag()

As of right now, not only has _use_gag never fired, I’ve never gotten anything in the console about my button colliding with anything. I’ve hit the button multiple times with my left controller, and nothing. I’m pretty much stuck on what to do next, so any help would be greatly appreciated.

Any consequence of this? (does this part work?)
print(obj.get_type())

or here

    if obj.get_type() == 'ARVRController' && obj.controllerHand == 'left':
        _use_gag()
       print(obj.get_type())

ramazan | 2022-02-09 10:48

Unfortunately, nothing prints to the console in either scenario.

AutumnRivers | 2022-02-09 19:44