动画clip仅仅读的解决的方法,以及动画关键帧回调的办法

之前在Asset store上面下载了一个模型,有动画,可是想在Animation窗体编辑动画,插入关键帧的时候,出现了一点问题,发现动画切片是可读的。


在网上查了一下解决方式,后来在这里找到了答案:

http://answers.unity3d.com/questions/187907/how-to-add-keyframes-on-imported-read-only-animati.html


大概解决的方法例如以下:

You have to duplicate the animationclip-asset. Select the animation clip in your imported model and press ctrl+d. Now you should have a seperate AnimationClip file. This animation clip have to be added to an instance of your model. Just drag your model asset into the scene and replace the referenced AnimationClip in the animation array. After you added the AnimationClip to your model you can open the animation editor window and select your model in the hierarchy. Select the right animation on top (if there are multiple) and you can edit anything in this animation. All changes will be saved to the .anim file since that's the animation you're using now.

You can't replace the AnimationClip on the imported model itself but you can create a new prefab out of the instanciated model in your scene. This prefab will used the assigned AnimationClip.

I have created a special AssetPostProcessor which automatically extracts the .anim files and add them automatically to the model prefab since we have 90+ animations ;)

先在Project视图中选中fbx的动画文件,然后按ctrl+d,复制动画切片,然后把模型拖到Scene视图中,然后选中Scene视图中的模型,手动改动模型所引用到的各种动画切片到你复制的动画切片,之后就会发现是可编辑的了。


插入关键帧的回调有两个办法:

1、在Hierarchy窗体中选中模型,然后打开Animation窗体,选中一个动画切片,然后将动画时间调整到须要的位置,然后按后面那个带加号的button会出现一个对话框,让你选择插入的回调函数,我这里是事先在对象上挂了一个脚本,所以这里会列出来这个脚本里的全部函数,如图:



二、是模型加载之后,进行avatar匹配,之后在Project视图中选中模型文件,然后在Inspector视图中选中Animation选项,然后在以下的Clips片段中选中你想插入的动画,然后将以下预览的红线拉到你想插入动画的帧,然后点击那个带加号的button。之后会出现一个插入函数的对话框,填入一个函数名,之后就能够在这个对象上挂一个脚本,然后填写对应的函数名就可以有关键帧回调,如图:




posted @ 2014-06-03 15:27  mfrbuaa  阅读(801)  评论(0编辑  收藏  举报