Search Unity

Resolved Gun in hand, without using grab : Do not shoot anymore

Discussion in 'VR' started by christDuNord, May 3, 2021.

  1. christDuNord

    christDuNord

    Joined:
    Oct 24, 2020
    Posts:
    26
    Hello.
    I am a beginner and I use the Quest 2 with XR toolkit.
    I followed this tutorial "
    " of Valem, and everything works fine.

    But what I would like is not to have to take the gun. It must always be in the hand, you can't let it go.
    It is also done and it works.

    The problem I encounter is that I can no longer fire the gun! The trigger no longer works.
    I replaced the "XR Grab interactable" component with "XR Simple interactable" but it doesn't work anymore. Impossible to shoot.

    Anyone have any idea of the problem?
    Thank you.
     
  2. PincerGame

    PincerGame

    Joined:
    Aug 7, 2018
    Posts:
    16
    Hi @christDuNord for your case, you can consider using XR socket interactor on your hands. Add a socket interactor on your hand and attach your gun at the 'Starting selected interactable' field on XR socket component. Please check out here on how you can add socket interactor on your project here.
     
  3. christDuNord

    christDuNord

    Joined:
    Oct 24, 2020
    Posts:
    26
    Hello.
    Thanks for your help.
    Alas, it is not possible to attach the gun to the 'Starting selected interactable' field on XR socket component!
    I've been blocking this problem for 2 days, which I think must be very simple -_-
    There is animation with this gun. I just want to run this animation when I press the trigger on my joypad!
    I manage to display a message in the console that I press a button, but I don't know the line of code to start the gun animation.
     
  4. christDuNord

    christDuNord

    Joined:
    Oct 24, 2020
    Posts:
    26
    I managed to get my code to work, but I messed around so much I don't know how I did;)