Skip to content

Add nFozzy Flipper Corrections#305

Merged
freezy merged 23 commits into
masterfrom
test/nFozzyLike
Jun 18, 2021
Merged

Add nFozzy Flipper Corrections#305
freezy merged 23 commits into
masterfrom
test/nFozzyLike

Conversation

@syllebra
Copy link
Copy Markdown
Collaborator

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.

image

@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 11, 2021

Codecov Report

Merging #305 (6bc2ebb) into master (29aaf23) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           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.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 29aaf23...6bc2ebb. Read the comment docs.

@freezy freezy changed the title Test/n fozzy like Add nFozzy Flipper Corrections Jun 11, 2021
@freezy freezy self-requested a review June 11, 2021 22:14
@djrobx
Copy link
Copy Markdown
Collaborator

djrobx commented Jun 12, 2021

Very nice - happy to see this included!

@freezy
Copy link
Copy Markdown
Owner

freezy commented Jun 12, 2021

Me too 😄

BTW, welcome back, Rob!

Comment on lines +104 to +131
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;
}
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one doesn't seem to be used? Ditch in favor of the next method?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, keeping it for now then.

@freezy
Copy link
Copy Markdown
Owner

freezy commented Jun 14, 2021

I've removed FlipperCorrectionAuthoring and put all the data into FlipperCorrectionAsset (formerly AnimationCurveAsset). IMO this makes it easier for authors to handle profiles. A profile is basically the asset.

So it can now be enabled under in the collider component:
image

And edited in the inspector:

Selection is easier as well:

I'll add the documentation and after that it should be good to merge.

@freezy freezy force-pushed the test/nFozzyLike branch from 91dcd3a to baca2b6 Compare June 15, 2021 21:09
@freezy freezy force-pushed the test/nFozzyLike branch from baca2b6 to a040461 Compare June 15, 2021 21:12
@freezy
Copy link
Copy Markdown
Owner

freezy commented Jun 18, 2021

Thanks to all involved, merging.

@freezy freezy merged commit 8a9f7aa into master Jun 18, 2021
@freezy freezy deleted the test/nFozzyLike branch June 18, 2021 05:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants