- Home /
Choreography of Model-Animation stored in a file
I need to be able to store all of the data of an animation of a model in a file (Similar to how Source-Engine games store the animations for models in a vcf, or Valve Coreography File)
I load in OBJ files and Materials associated with those OBJ files at runtime. These are the models that i need to be able to attach a choreography file (script) to. Is there an easy way to do something like this?
Answer by TonyLi · Aug 31, 2013 at 09:18 PM
You're probably going to hate this answer at first, but I strongly feel the best approach is to give yourself a little time to research how animation works in Unity, rather than trying to fit it into a Source Engine mental model.
In many ways, especially with the introduction of Mecanim in Unity 4.0, Unity's animation system is much stronger than Valve's.
Some good first reads would be:
High level overview: https://unity3d.com/unity/animation/
Technical overview: https://docs.unity3d.com/Documentation/Manual/MecanimAnimationSystem.html
Thank you for the links. I'm checking them out. However, i'm not looking for a system by which i have to compile an animation within the editor. The OBJ models that i load in at runtime will have animations (choreography files) that won't necessarily be found in my game (The player has the ability to create custom animations, essentially).
In that case, it's still entirely possible, but a bit complicated. I'd recommend using the legacy animation system. You can load the animation data from files at runtime and manually create a Unity AnimationClip composed of AnimationCurves.
FaceFX (a third party facial animation product) does this very thing in this Unity demo project: http://files.facefx.com.s3.amazonaws.com/unity-demo/unity-demo-facefx.zip
The forum thread for that project is here: http://forum.unity3d.com/threads/78076-New-FaceFX-Integration-With-Unity
Look in the file Editor/FaceFXControllerScriptGUI. It converts X$$anonymous$$L animation data that was generated by FaceFX into Unity animation clips. It works at edit time, but there's no reason why you couldn't do the same thing at run time.
Then again, if the tool that your players will use to create custom animations can create Unity-format AnimationClips, you can just read them and add them to the character's Animation component.
Thank you for your help TonyLi! Thanks for all of the references, i'll check them all out.
I hope they point you in the right direction. If so, please consider accepting the answer in case it can help others searching on the same question.
Your answer
Follow this Question
Related Questions
3ds max chariter texture and animation problem 1 Answer
Load model & animation during runtime 1 Answer
Reading anim files at runtime 0 Answers
Material from .obj not being imported in Android App 0 Answers
Can I scale an animation with a model? 3 Answers