Oh man. I found quite a few mistakes in my distance-based scaling formula. Not only was I lerping instead of inverse lerping my distance value before plugging it into an evaluation curve, I also was incorrectly calculating the distance!
I’ll figure out how to properly correct the distance-based scaling tomorrow. Put simply, the way it needs to work is that as a hand moves further away from the body, the scaling dampens proportionately to the distance. However, in order for that to work properly, I need to make sure scale increases and decreases at the same rate.
In total, the motion-based scale should be calculated by a combination of three factors:
- Velocity at which a hand moves
- Hand distance from the body
- Alignment of the opposite hand with a hand’s velocity vector
What I implemented today was a smooth falloff for velocity…aka factor #3. I dropped a line from the point where the hand’s velocity vector ray hits the collider of the opposite hand to a point along the line connecting the two hands that forms a perpendicular intersection of the two lines. How did I do that? I asked ChatGPT. Next, I calculate the distance from the intersection point to the collider hit point, then inverse lerp that distance from the radius of the spherical collider to zero in order to determine as a percentage how aligned the hands were to a given hand’s movement. That percentage gets multiplied into my scaling value to dampen it accordingly.
I’d post a video but stuff still doesn’t look right yet (plus I’m already home and just about ready for bed). Once I fix factor #2, I suspect things will work as intended.