0 votes

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:
Button Scene
Controller Scene

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.

Godot version 3.4.2
in Engine by (12 points)

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())

Unfortunately, nothing prints to the console in either scenario.

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.