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

Interactable.FloatAction.Receiver doesn't work outside of an Interactable #2079

Closed fight4dream closed 4 years ago

fight4dream commented 5 years ago

Unity 2019.2.0f 023ed36

I tried to replicate the 'Use' action such as handgun. I have everything connected just like the example scene. If i move the Interaction.FloatAction out of Interactor, everything still works. so the Interaction.FloatAction is not tightly coupled to Interactor.

However if I move Interactable.FloatAction.Receiver out of the Interactable, the Use does not work

image

thestonefox commented 4 years ago

What is the container set to in the sub consumer?

If you look at the handgun in the farm scene, it has the container set to the handgun

image

This is because the way the publisher/consumer works is:

the publisher is filled up of all the things being touched by the interactor and then publishes to any consumer that belongs to the object being touched. In the case of the handgun, the consumer container is the top level item with the rigidbody as that is what would be the collidable object.

fight4dream commented 4 years ago

you can replicate this by moving the example scene hand gun's FloatAction.Receiver outside of the gun. which means the Container is set correctly (remains set) as Interactable.Handgun as soon as it is outside of the gun, you cannot shoot anymore.

thestonefox commented 4 years ago

Then it's not a bug, because the container won't be part of the colliding object of the float action

fight4dream commented 4 years ago

okay. is it a bit non-intuitive given that we have already specified the 'container' and inspecting the components, there seems to have no indications that it is required to be inside of the container

thestonefox commented 4 years ago

because there are no docs for it.

fight4dream commented 4 years ago

how about the Interaction.FloatAction, it seems okay to live outside of an Interactor. is it also possible to make the Receiver part outside of it? if no trivial way, i'll close this issue as 'by deisgn' :)

thestonefox commented 4 years ago

Yeah this is by design because the connection between the interactor and interactable is via the collision between the two colliders, so whilst the Interactor FloatAction can be outside because its just pushing, the Receiver needs to be nested within the collider so it can check it's a valid recipient.

Let's close this with that knowledge captured in this ticket.