Closed fight4dream closed 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
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.
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.
Then it's not a bug, because the container won't be part of the colliding object of the float action
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
because there are no docs for it.
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' :)
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.
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