untiy3D 让角色动起来,角色动画的使用
1.untiy 商店下载动画模型
2.导入项目
模型拖入到场景中
3.创建动画器控制器
4.动画控制器挂载到plarer上
5.把动画idle和pickup拖入到动画器
6.右键动画创建过渡效果(Make Transition)
6.设置参数用条件控制
7.当选中参数时启动过渡
运行效果
119
(二)用脚本控制动画过渡
创建脚本
运行项目当按下键盘f键时 启动动画过渡
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PalerJb: MonoBehaviour
{
// Start is called once before the first execution of Update after the MonoBehaviour is created
void Start()
{
}
// Update is called once per frame
void Update()
{
if (Input.GetKeyDown(KeyCode.F)) {
// 触发pickup参数
GetComponent<Animator>().SetTrigger("pickup");
}
}
}
运行效果,当每次按下键盘的F键时
44449