I made it so the body only scales when it’s between the hands. To do that, I check the distance between the left hand and right hand, between the left hand and body, and between the right hand and body. If the first distance is greater than each of the later two, I proceed to scaling.

Once I wrote my three scaling factors yesterday, it became very easy for me to fix the scaling issues. It also helped me rename my variables. Now, the motion-based scaling is calculated as the following:

float scaleAmt = displacementScaler * distanceDamper * hitAccuracyDamper * controller.so.pulseScaleDamper;

Also, last night before I went to bed, I had an epiphany. Look:

Isn’t it simple?!? I’ll increase horizontal scale of a body when scaling upwards, and decrease horizontal scale when scaling downwards! I’ll need to make sure the body’s scale is uniform by the end of the scaling, but I think I should be able to do that relatively simply with my scale damping already in place.


Tags: gamedev unity programming vfx animation