Search Unity

Question Manual Interaction / Force Select Help

Discussion in 'XR Interaction Toolkit and Input' started by David_Giangrave, Mar 8, 2021.

  1. David_Giangrave

    David_Giangrave

    Joined:
    Feb 21, 2020
    Posts:
    6
    Desired Feature
    I'm looking to setup a system where the user can select an item from their inventory and equip it to their hand. The item is a prefab of an intractable and the hand is a direct controller interactor. When this manual interaction occurs, I want the item locked into their hand such that they cannot drop it until a custom event occurs.

    Force Select Attempt
    I first attempted to use ForceSelect in the interaction manager to force the object into the users hand after it is instantiated. The problem appears to be after one frame, the object gets dropped. This is because the `XRBaseControllerInteractor` never sets `ToggleSelectActive` (line 507-514). Due to this, the next update frame select active will evaluate to false and the interactor will clear resulting in the object immediately being dropped.

    XRBaseInteractor.StartManualInteraction
    Using the manual interaction method on the interactor the update will be overrided by the `
    m_IsPerformingManualInteraction` variable. This forces the interactor to remain in the users hand, however if the player performs a select action such as dropping the object, the manual interaction variable does not prevent the drop and remains true. The result is the object will drop but as soon as that interactor hovers over another object, it instantly snaps to the interactor as if it was selected.

    Prevent Drop During Manual Interaction?
    In my interpretation, if a manual interaction is in progress, allowSelect should be false, meaning the user cannot select or drop any objects, basically locking in the state of the interactor until a manual end event occurs.

    I leave you with these questions:
    What do you think, should manual interaction lock the state of the interactor? Should force select use some manual interaction logic or is it different? Is there a better way to go about my desired feature? Let me know!
     
  2. stevendimmerse

    stevendimmerse

    Joined:
    Aug 7, 2018
    Posts:
    9
    I get the same issue with Force select, it seems like there are still some bugs with force select where it sometimes detaches from the socket after a few frames or sometimes will attach at the wrong angle.

    In the end for my project I created renderers attached to the socket and enabled/disabled them as needed which works but is not what I wanted to do
     
  3. Drumsmasher17

    Drumsmasher17

    Joined:
    Jun 3, 2015
    Posts:
    7
  4. garrido86

    garrido86

    Joined:
    Dec 17, 2013
    Posts:
    233
    Last edited: Nov 2, 2021