6th of December Update
So after yesterday's meeting with Jonny and Tobias, I had a few options of where to go next, including an idea of how to mirror the hands using the LeapTransform mirror method. What I had been doing wrong was over complicating it by creating a new LeapTransform object with the current hands Basis and then mirroring it and trying to assign it back to the Hands.Basis (not possible due to it being readOnly). The obvious solution courtesy of Jonny was to apply directly to the Hand basis. However that still didnt work.
In the mean time i'd implemented a short term fix where I simply had two leap controllers, one of which I mirrored by setting the scale to -1.
As hopefully you can see the bottom hands are the mirrored pair and the top hands are the non mirrored. The mirrored hands seems to have a single joint that functions weirdly so for now we decided to leave that idea. Next we posed a question on the Leap forums, Unity forums and a message via the contact us form for Leap asking for a little bit more information on the methods that didn't appear to be doing much.
And luckily we managed to get a reply within an hour, however it happened to be very vague and didnt really provide any further clarification, we've reached out in response however haven't heard back.
After this Jonny told me that I should have a good look through the code and try and work out the workflow of leap through to unity. We saw quickly that the LeapServiceProvider script seemed to be where the Leap was getting the data and constructing the hands. This was all done in a LateUpdate method call rather than Update which was occuring after we tried to make a transformation in the Update function in my code.
In this code I found a method called TransformFrame which appears to be setting up the frame that we then use to render the hands. Within this method there was a call to MirrorZ method which wasn't working for me so I decided to comment it out and see what happened. The result was that the hands were flipped upside down. So out of curiosity I added the MirrorX method and I suddenly had hands that were mirrored. We decided to try and change my code from an update to LateUpdate to see if that would affect anything but it didn't.
The temporary solution for now is that I added a bool to the LeapProviderScript that represented whether a set of hands should be mirrored and then just chucked a conditional into the TransformMirror method to use mirrorX if that box is checked.
The way I had previously been recreating 4 limbs was by using two hand controllers which rendered two sets of hands at different positions. This was probably a bit unecessary so I went through stripping components and parts of the Prefab off for the mirrored set of hands until I had the bare minimum needed to position the hands. The final product was this:
The next step is to do with the temporal warping which I think I saw Chris had an issue with. The hands in the original should stay in place when you turn your head, this is done with a script. Because the frame is mirrored this has been reversed so the hands move in the opposite direction. There must be a way somewhere to negate this in the TemporalWarpingScript I imagine.
I also want to start on the UI which I havent done yet and come up with some different configurations of the hands so that it's possible to just mirror the left hand across to the right without having four hands and vice versa and then turn on the four hands.
Comments
Post a Comment