Solving the hand scaling issue has actually meant solving why hand scaling wasn’t working. I’m figuring it out, piece by piece. First issue: I was storing previous player hand positions within the scaler script instead of in the player constructor. There’s only one scaler instance in the scene at a time, so when I had multiple players, they were constantly overwriting each other’s old positions.
Solving that piece revealed several more tricky issues. First, there is a jitter in hand position caused by the unprecise fidelity of the constantly changing Kinect data. This jitter isn’t noticeable from the camera view, but when calculating velocity based on changes in position on a frame by frame basis, it corrupts the raycasts.
To fix this, I can ensure a minimum displacement before calculating velocity.
Orthogaphic view from above
Alas, now the next issue—even when it feels like I’m moving my hands along the same plane, I’m not. Life is certainly trickier in 3D.
Ahh….Life is much better with proper debugging.
To get this working again, I swapped my spherical hand colliders with some elongated rectangles that covered way more surface area. Like my debugging ray objects, I had to refrain from making them children of the hands, instead opting to set their position to match the hands each frame while avoiding inheritance of the hand rotations.
I also needed to stop relying so heavily on the body alignment to get this to work again. Since the movements no longer occur on a 2D plane, it was much rarer for the body to align with the hand velocities. Now, I only reference the body alignment when it’s above a certain amount. An unneeded vestige, perhaps, but it works.
I tweaked several parameters affecting the scale amount, but the biggest change was to the distanceDamper. Now, that’s calculated based on a ratio between hand distance and body size (and tapered relative to how far apart the hands are). With all these parameters, it’s no wonder I rely on luck so much. Just look at this one:
If that seems overly complex, try to fathom how much worse the original project was. (Hint: a LOT)
I finally got my original energy ball project working again.
I’m not sure how it got so broken, but there were missing packages, missing sprites, broken materials, unbinded transforms, and no scriptable render pipeline assigned in quality settings. Now that it’s running again, I can break down step by step to figure out just how the energy ball looks so smooth and how the particles flow around the SDF so well.
These are the positions of the left and right hands in the above screenshot
At this maximum stretch, it seems they’re roughly 16 units apart. If I aim to replicate the scale, then I’ll need to increase the size of the player in V2 by roughly 2.5x.
Last thing I’ll note here before logging off for the night—the particle emitters never shut off in V1. When both hands are closed, their transforms actually become children of the WayOut point.