Search Unity

Question Grab an object via script

Discussion in 'VR' started by Marta_Cozzi, Dec 21, 2023.

  1. Marta_Cozzi

    Marta_Cozzi

    Joined:
    Oct 16, 2023
    Posts:
    2
    How can I force the grab of a XRGrabInteractable through its script? I need the object to be selected normally, then by pressing a button the object is released and placed in front of the camera, where it can be rotated. Then I want the object to be grabbed again by pressing a button. I need help understanding this last part.
     
  2. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    5,050
    You can Select the object using the XR Interactable and XR Interaction Manager
     
  3. Marta_Cozzi

    Marta_Cozzi

    Joined:
    Oct 16, 2023
    Posts:
    2
    I used them for the first two parts of the interaction, but I couldn't figure out how to do the last part, when you grab the object again.
     
  4. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    5,050
    You need to do interactable.EnterSelect I think
    Or xrManager.EnterSelect
     
  5. Max-om

    Max-om

    Joined:
    Aug 9, 2017
    Posts:
    499