当前位置:网站首页>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);
}
}
边栏推荐
- 接口自动化2.0
- 51单片机教室人数进出统计检测数码管显示装置红外传感器
- Gradle学习 (一) 入门
- Common class String overview
- 以STM32F103C6T6为例通过配置CubeMX实现EXIT外部中断
- Deep learning TensorFlow entry environment configuration
- 一个基于.Net Core跨平台小程序考试系统
- 【图像识别】训练一个最最简单的AI使其识别Vtuber
- pytorch-11. Convolutional Neural Network (Advanced)
- LeetCode refers to offer 10-I. Fibonacci sequence (simple)
猜你喜欢
随机推荐
卷积神经网络(CNN)实现服装图像分类
Tensorflow 2.0 使用流程详解
ASP.NET有关于文件上传、下载、全选、删除选中重要干货(亲测有效)
探索性数据分析EDA
我不喜欢我的代码
【简易笔记】PyTorch官方教程简易笔记 EP4
Notes for RNN
LeetCode 100. The same tree (simple)
51单片机RS485远程双机多机温度采集主从机多节点蜂鸣器报警
LeetCode 剑指offer 21.调整数组顺序使奇数位于偶数前面(简单)
STM32单片机RGB红蓝调光植物补光系统红光蓝光PWM调色调节亮度
栈和队列
LeetCode 100.相同的树(简单)
Collection Map
系统架构和问题定位
样条曲线(下)之插值问题(贝塞尔曲线、B样条和一般样条曲线插值)
LeetCode 162. Finding Peaks (Moderate)
力扣——统计只差一个字符的子串数目
STM32F407ZG GPIO输出相关实验
LeetCode refers to the offer 21. Adjust the order of the array so that the odd numbers are in front of the even numbers (simple)









