Add nFozzy Flipper Corrections#305
Conversation
Codecov Report
@@ Coverage Diff @@
## master #305 +/- ##
=======================================
Coverage 66.00% 66.00%
=======================================
Files 136 136
Lines 8423 8423
Branches 868 868
=======================================
Hits 5560 5560
Misses 2625 2625
Partials 238 238 Continue to review full report at Codecov.
|
|
Very nice - happy to see this included! |
|
Me too 😄 BTW, welcome back, Rob! |
| private static float LinearEnvelope(float xInput, ref BlobArray<float2> curve, float defaultValue = 1F) | ||
| { | ||
| if (curve.Length <= 0) | ||
| return defaultValue; | ||
|
|
||
| if (xInput <= curve[0].x) //Clamp lower | ||
| return curve[0].y; | ||
| if (xInput >= curve[curve.Length - 1].x) //Clamp upper | ||
| return curve[curve.Length - 1].y; | ||
|
|
||
| int L = -1; | ||
| for (int ii = 1; ii < curve.Length; ii++) //find active line | ||
| if (xInput <= curve[ii].x) | ||
| { | ||
| L = ii; | ||
| break; | ||
| } | ||
|
|
||
| if (L < 0) | ||
| return defaultValue; | ||
|
|
||
| if (xInput > curve[curve.Length - 1].x) // catch line overrun | ||
| L = curve.Length - 1; | ||
|
|
||
| float y = PSlope(xInput, curve[L - 1].x, curve[L - 1].y, curve[L].x, curve[L - 1].y); | ||
|
|
||
| return y; | ||
| } |
There was a problem hiding this comment.
This one doesn't seem to be used? Ditch in favor of the next method?
There was a problem hiding this comment.
This one was the direct port of nFozzy's code. Th eother one is an optimization only valid if the segments of the curve are evenly distributed on x axis. So it will depend on what we plan for the curves to come. It is indeed not used right now as the Blobs are filled evenly splitting the aniamtioncurves.
… is the best place to do so...
…Left flippers (aka, polarity curve was defined for right one), it is the opposite. Fixed
… to FlipperCollisionAuthoring instead of FlipperCorrectionAuthoring.
|
Thanks to all involved, merging. |



This is a first raw implementation of nFozzy's flipper corrections: polarities and velocities.
It is improved by using Unity's "Animation curves". Some preset cruves are still missing.