当前位置:网站首页>Unity中实现Animation Clip动画片段的倒播(该案例可以防止动画延迟)
Unity中实现Animation Clip动画片段的倒播(该案例可以防止动画延迟)
2022-08-10 05:35:00 【三和尚】
第一步:游戏物体身上的Animator Controller设置
第二步:代码的编写
/// <summary>
/// 正播放动画
/// </summary>
private void PlayCarAnimator(Animator anim,string animName)
{
anim.SetFloat("isDoor", 1f);
if (anim.GetCurrentAnimatorStateInfo(0).normalizedTime < 0)
{
anim.Play(animName, 0, 0);
}
}
/// <summary>
///倒播放动画
/// </summary>
private void PlayBackAnimator(Animator anim, string animName)
{
anim.SetFloat("isDoor", -1f);
if (anim.GetCurrentAnimatorStateInfo(0).normalizedTime > 1)
{
anim.Play(animName, 0, 1);
}
}
边栏推荐
- Convolutional Neural Network (CNN) for mnist handwritten digit recognition
- LeetCode 面试题17.14 最小k个数(中等)
- pytorch-09. Multi-classification problem
- pytorch-07.处理多维特征的输入
- 作为测试,常用的adb命令
- Pytorch配置与实战--Tips
- pytorch-11. Convolutional Neural Network (Advanced)
- LeetCode 2011. Variable Value After Action (Simple)
- LeetCode 162. Finding Peaks (Moderate)
- 51单片机营养液自动配置搅拌系统TDS浓度采集自动加水加营养液
猜你喜欢
随机推荐
STM32单片机LORA无线远程火灾报警监控系统DS18B20MQ2火焰检测
LeetCode 292.Nim 游戏(简单)
pytorch-05. Implementing linear regression with pytorch
LeetCode 94.二叉树的中序遍历(简单)
每日刷题(day01)——leetcode 53. 最大子数组和
Convolutional Neural Network (CNN) for mnist handwritten digit recognition
树结构——2-3树图解
String common methods
pytorch-09. Multi-classification problem
树结构——二叉查找树原理与实现
LeetCode 938. Range Sum of Binary Search Trees (Simple)
Flutter的生命周期
探索性数据分析EDA
二维卷积定理的验证(下,cv2.filter2D())
Gradle学习(二)Groovy
LeetCode 面试题17.14 最小k个数(中等)
栈和队列
LeetCode 1351.统计有序矩阵中的负数(简单)
STM32单片机OLED经典2048游戏单片机小游戏
Likou - Number of Provinces