Curve曲线和脚本控制Root Motion——动画(Mecanim)系统学习篇

应用情况:

当我们的模型资源中动画不带位移时,我们还想通过Root Motion控制人物移动使人物移动和动画播放很吻合时。

具体步骤:

                  1.给要运用的人物模型添加Animator并设置相应的Animator Controller。
                   2.在导入的模型的动画设置中添加Curve,命名为WalkSpeed(命名看自己喜好)。

在这里插入图片描述
3.在人物的动画控制器中添加float类型的参数,命名为WalkSpeed注意:与上面命名要一致)。
在这里插入图片描述
4.给人物添加脚本,代码如下:

private Animator anim;

void Awake()
{
	anim = GetComponent<Animator>();
}

void OnAnimatorMove()
{
	Vector3 movement = transform.position;
	movement.z += anim.GetFloat(“WalkSpeed”) * Time.deltaTime;
	transform.position = movement;
}

然后人物就能随着动画很协调的移动了。

希望对大家有所帮助!!!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Requires Unity 5.3.0 or higher. Make Skeleton & Vertex Animations right inside the Unity Editor. [New Online Manual] [v1.9.1] Constraints System Skele: Character Animation Toolssignificantly speeds up animator/indie's animation workflow in several ways: 1. Enable developers to make / modify character animations in UnityEditor. Reduce software switching and tedious import/export/split work 2. [BETA] Integrated Timeline editorGreatly accelerate authoring productivity for complex multi-character scenes (cutscenes / finishing moves / etc) 3. Mesh-Morpher tools to make blendshape-like animations without bones 4. Export skinned meshes and animations as DAE archive 5. Utilize the clips you bought from store, modify them to your needs, convert clip type, export to external softwares, etc. 6. Constraints system working in both edit-mode & game-mode. 7. Spline Editor to edit movement path. ******************* Humanoid rig needs special treatment:Please read the two FAQ posts: (1)How to Edit Humanoid clips? (2)Best workflow for Humanoid models? ******************* Main Features: 1. Make animation for your rigged characters with FK/IK support. flag, stick, dragon, ghost, mech, bird, fish, robot, human... you could manipulate ANY rigged models. 2. Modify animations. Modify Generic/Legacy animations directly; with our converter, you could also modify and export clips you bought from assetstore too. Modify and get the result immediately. 3. Make blendshape-like vertex animations directly in Unity Editor. 4. Integrated with Timeline Editor [BETA]. Edit the cutscene right inplace, and easily integrate with code/fx/audio/gui/etc. 5. Visualize the bone link, the vertices, and bone weights, etc. 6. Reduce the folder size, you don't need to include duplicate meshes for each animation. 7. Make/Save/Load poses on disk 8. Convert MuscleClip(Humanoid clip) to and fro Legacy/Generic clip 9. Generate RootMotion from RootBone curves 10. Export character mesh and character ani
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值