- Home /
Question by
delphifissure · Apr 28, 2017 at 05:48 AM ·
transformscalinganimationcurvecurvestriggering animation box collider
How to use animation curve to drive object scale by distance instead of time?
How would I create a trigger box that uses an animation curve to scale objects according to the distance they've traveled across the trigger box instead of over time? So walking back and forth through the trigger would grow / shrink player according to the curve and ensure that they were consistently scaled when entering / exiting the box. Note that I'd need to create two types of triggers, one that scales according to the X-axis of the curve, the other that scales with the Y-axis.
For art reasons I can't use linear transforms, and thought that using animation curves would be a highly flexible way of handling these transforms. I've got to do tons of them.
Thanks!
Comment
Answer by mickjosh · Jul 12, 2017 at 06:58 AM
AnimationCurve Var;
Vector2 Distance
Vector2 Result;
Result.x = var.Evaluate(Distance.x);
Result.y = var.Evaluate(Diastance.y);