unity3d - 如何在非运动学的刚体上使用动画?
问题描述
我没有动画经验,我正在尝试在我使用 AddForce 移动的角色上插入动画。如果我插入步行动画,动画会移动刚体,她决定它移动的速度。如果在动画师中我不应用“Root Motion”,则动画不会移动角色,我可以使用 AddForce 移动它,但动画与角色的速度不同步。如何将动画的速度与我移动刚体的速度联系起来。我希望如果我改变我用来移动角色的“速度”参数,动画的速度也会改变,始终保持同步。
解决方案
我认为这对你有用:
float speed;//you must set this value with rigidbody's velocity
Animator animator;
void Start()
{
animator=getComponent<Animator>();
}
void Update()
{
animator.speed=speed;//you can change it with speed/10 to make more realistic
}
推荐阅读
- regex - 正则表达式:省略街道地址直到城市?
- java - 如何在特定时区的特定时间(如 12:00:00.000)获取日期实例?
- sql - 使用查询/代码动态创建的 SQL 作业
- java - 我应该如何在 Google Play 管理中心启用我的 AdMob 真实 ID?
- xamarin.forms - 有没有办法在 Xamarin Forms 中使用相机功能而无需下载任何额外的 NuGet 包?
- java - Spring Boot 应用程序未在外部 Tomcat 中启动(在 Tomcat 8.5 和 10 中均已尝试)
- canvas - 如何在画布中旋转渐变,注意:不是画布本身
- docker - 在同一个 Docker 网络中发出 HTTP 请求
- arm - 用于高速微控制器测试台控制器/数据采集器的系统架构
- azure - 从 Azure DevOps 设置应用服务连接字符串