- Home /
Animation Curve Data Recording
So, I'm interested in recording the data in an animation curve to a text file. My users are going to create a drawing. The goal is for the drawing to be able to be replayed in the same time frame it was recorded -- but then for the creator of the drawing to be able to control the speeds/rates at which the drawing plays back, as defined by an animation curve.
So, as stated, I'd like to record numbers that describe that curve. I'm trying to think about the most efficient way of doing this -- clearly one cheap way of doing it would be to have an array of any number of pre-set "CurveDataObjects", each of which has a name and a curve -- so that the text file being imported by my application might just read "Apply curve 55", and know which curve to utilize. Basically this is the same thing that teachers do on report cards -- instead of writing "This student never did homework" on 20 different report cards, they just write the number "55" and the computer knows to print that comment. But that's the only way I can think of to do it, aside from converting one curve into 300 different keys, writing these values to a file, and then creating an approximate curve with those.
What do you think? What would your solution be?
I thought this was an excellent unique question, so Upvoted. But am a little confused. Are you collecting a set of waypoints and playing them back at desired speed, or from the waypoints storing the X and Y values to an animationCurve and calculating the tangent in and out of that waypoint for the animationCurve? I did something of an answer for reading a curve and copying that curve to another gameObject in edit mode, I'm sure it could be modified to output the curve data to a text file (if that is what you are after) : http://answers.unity3d.com/questions/320689/derive-an-equation-from-a-graph.html
I cannot see how a master key system (CurveDataObjects) would work for you unless you are using predefined curves to draw.
Hey! Thanks. Yes, that's what I mean -- using predefined curves to draw.
Essentially, the drawing class I'm using is from here (http://www.everyday3d.com/blog/index.php/2010/03/15/3-ways-to-draw-3d-lines-in-unity3d/), and it creates a series of meshes. These can be displayed iteratively, giving the effect of looking like something is being drawn. What I'm hoping to do is, after the user has drawn something (a line, for example), for them to be able to adjust the way that line looks like it is being drawn-- perhaps in reality they've drawn it as the same constant speed, but they want it to look like the drawing is speeding up at the end. Rather than using any one static tween (Quintic, Quadratic, etc), I'd like the user to be able to define a custom tween. I understand how my user might be able to edit a curve in the editor, but what I don't understand is how to transfer that animation to a text file without creating a heck of a lot of waypoints. Does that make more sense?
Your answer
Follow this Question
Related Questions
Transition based off day length speed? ( day/night system) 1 Answer
Does Unity provide a means to determine the time since the last user interaction? 2 Answers
How can I make it so that inputs only function once per second? 2 Answers
Comparing a player made image to an original image 1 Answer
How can I use multiple GetButtonDown keys simultaneously? 2 Answers