Hi,
I am new to unity and have been holding off (Due to laziness).
It seems there is no clear way to extract transform data from animations in game unless they have been played or sampled. This doesn’t seem efficient especially if your character is already in an animation and you need the pose at 10 frames later than the current.
How do i go about extracting data from the animation clip?
BTW using GetComponent(bone name) doesn’t seem valid as the bone likely appears in multiple frames.
Regards
Victor
Tempted to write my own animation system from scratch.
I know you can use AnimationCurve.Evaluate(time) to get a value at a specific time. This only gets you halfway there, but I hope it helps.
Really? Man thats alot of help. Thanks
It just seems a buit messy.
Hold on a sec how do you get the curve?
Does anyone know how to get this please?
I usually use the AnimationState.normalizedTime or whatever it’s called to do time-to-frame translation. From what I understand, you can’t get the current frame of an animation in a neat way.
Edit: That in no way answered your question, sorry. No idea about the bone transforms.
It is still usefull information. The animation class seems a bit to protected. Rune was lucky his api work post animation/late update. Cos there is almost no clean way to get things done
First of all I found Unity still has some lack on Animation functionality! Like:
- You can’t access frame based info.
- There is no way to add event to specific frame number but you can do it from Editor. If it’s imported animation then you need to do dupe and then add event in specific frame etc! Which is not handy in my opinion. Dev should be able to add Event from code on specific frame. Because when you add an Event in a certain time, you can’t change the fire time of the event. If you need to change the fire time on the fly, then animation event totally useless!
I didn’t try to use AnimationCurve yet but you can check!
I tried. Its totally useless. I dont get how they missed this part. The guys at mixamo did not even spot it.
We will just have to make ours. now if unity would kidnly expose how they read the fbx files or their .anim file it would be nice.
Also why is imported animation read-only?