Closed TresSims closed 3 years ago
Hi @TresSims !
I'll look into this and get back to you during the next few days.
Please consider sharing further details or a screenshot of the blueprint if that's possible, as the more details the easier it'll be for me to reproduce your issue.
Thanks!
Hi @jjimenezg93
Thanks for your response! I'm more than happy to provide any information I can to help.
This screenshot shows the setup of my blueprint, including the event
This is currently happening using both the virtual hands in the play in editor experience as well as after the application is built and run on a Hololens 2 device.
I also tried modifying that file to use a counter of how many times the "On Begin Grab" and "On End Grab" events fire for the one handed interaction mode to keep track of how many pointers are interacting with the component at once, but both events were firing seemingly simultaneously, meaning my counter never registered any pointers interacting with the component.
I am happy to share any further information I can but am not sure what else would be relevant, so please let me know!
Thanks!
Hi again @TresSims,
I've realised that you have both a UxtGrabTarget
and a UxtGenericManipulator
. The latter inherits from the former and, with this setup, they're both receiving an OnBeginGrab
event and calling NotifyManipulationStarted
(from here). This function tells other manipulator components in the actor that they have to release their manipulation because a new one started. I replicated a simplified version of your setup and this is what's causing the issue.
If all you need is basic manipulation behaviour that allows you to grab your actor around, you could remove the UxtGrabTarget
. Then, instead of subscribing to the OnBeginGrab
/OnEndGrab
events of that component, you could subscribe to the same events in the UxtGenericManipulator
.
This should be enough unless you specifically need to have both grab targets acting on different primitives in the actor simultaneously. That's not supported at the moment, so could you please confirm that this is not your intention?
Please let us know if removing that component fixes your issue and the resulting setup fits your needs.
Thank you!
Thanks for your help @jjimenezg93 ,
I do have a reason for having both. The UxtGenericManipulator
I am using as you have described for the basic manipulation behavior, but I want separate logic to trigger when the object is grabbed with two hands, so I added the UxtGrabTarget
that would only trigger those events when it is interacted with using both hands.
The idea is that when you are grabbing the object with one hand, you can move it around and manipulate it as you would expect, but when you grab the object with two hands, it "unfolds" into something else.
This was something that I had working in what must have been a previous release, however I can see now that I have set this up in a weird way, is there a more recommended way to implement this type of functionality?
Thanks again for you help!
Hi @TresSims,
I think that this is the behaviour that you're looking for:
The cube starts as magenta and grabbing it with a single hand allows movement but doesn't change the color. When you grab with two hands, its color changes to yellow and transformations are disabled (I think that this would be equivalent to your "unfold"). Then it goes back to red whenever interaction ends (fold back?).
This is the Blueprint that I used:
Pleae note the configuration of the UxtGenericManipulator
, which allows both one and two hand interactions but disables transformation with two hands, so you can add your custom logic for it. The call to GetSecondaryGrabPointer
will only return true
when there are 2 pointers, so it's a slightly simpler trick than getting the array of pointers and taking its length, but that should work exactly the same.
You probably want some more specific conditions for OnEndGrab
, for example keeping a counter of pointers that were grabbing and doing one thing when 2 were released and something different when only 1 is. I think that the component should give you enough flexibility for this kind of checks.
An alternative would be implementing your own manipulator in C++, potentially inheriting from UxtManipulatorComponentBase
.
Please let us know if this works for you.
Thank you!
That will work perfectly, thank you so much for your support!
Using UE4.26.2 and UXT 0.12.0 the Begin Grab event is not firing when configured with the two handed flag set using blueprints.
EDIT: Upon further investigation it appears that the Begin and End grab events are being fired simultaneously, preventing you from ever entering a state where the component recognizes two hands grabbing the blueprint at the same time.