ExtendRealityLtd / VRTK

An example of how to use the Tilia packages to create great content with VRTK v4.
https://www.vrtk.io/
MIT License
3.69k stars 993 forks source link

DisallowedGrabInteractors does not work at all #2045

Closed MyAlpaca5 closed 5 years ago

MyAlpaca5 commented 5 years ago

Environment

Steps to reproduce

  1. Open Farm Example Scene.
  2. Find one Interactable Object. In my case, I use Hammer(Interactable Objects/Tools/Hammer).
  3. Expand DisallowedInteractors.
  4. Assign RightInteractor(VRTK Setup/TrackedAlias/RightControllerAlias/RightInteractor) to UnityObjectObservableList.Elemets of DisallowedTouchInteractors and DisallowedGrabInteractors.
  5. Start Game

Expected behavior

When Right Controller touches the Hammer, outline should not appear. When Right Controller grabs the Hammer, nothing should happen.

Current behavior

When Right Controller touches the Hammer, outline does not appear. When Right Controller grabs the Hammer, I pick up the Hammer.

PS:

  1. this behavior is not only subject to Hammer, I tried different Interactables, they are all failed to disallow Right Controller to grab them. However, They are all successful to ignore Right Controller when touching them.
  2. When I do the same thing to the Saw, I can not only grab the saw, but also the saw is highlighted when I ungrab it.

github

thestonefox commented 5 years ago

The issue here is that when you touch something it passes through the Interactor object but when you grab something it actually passes through the

Interactor/InteractionLogic/Interaction.Grabbing/AttachmentOrigin object

So if you were to set that object as your disallowed grab interactor then it would ignore the grab.

This is a bit confusing so I'll have a think if it's easy enough to make it so it also uses the interactor too.

MyAlpaca5 commented 5 years ago

Never even notice there is a AttachmentOrigin object before, DisallowedGrabInteractors is working as it is supposed to be now. @thestonefox Just wandering if there is anyway to check which Interator is grabbing one specific Interactable. I know you could find which Interactor is touching one specific Interactable in Interactable.TouchLogic/Interactable.TouchReceiver/EventLogic/TouchingActions/TouchCollection. However, have not found similar Collection object in Interactable.GrabLogic

thestonefox commented 5 years ago

Yeah it's not very clear or intuitive that you need to use AttachmentOrigin, I think that can be improved somehow.

As for knowing touching/grabbing interactors, just use the collections on the interactable facade:

https://github.com/ExtendRealityLtd/VRTK/blob/master/Prefabs/Interactions/Interactables/SharedResources/Scripts/InteractableFacade.cs#L132-L136