当前位置:网站首页>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);
}
}
边栏推荐
猜你喜欢
随机推荐
LeetCode 1894. Find the student number that needs to be supplemented with chalk
pytorch-08. Load dataset
开源免费WMS仓库管理系统【推荐】
Flutter Package 插件开发
2021-04-15 jacoco代码覆盖率统计和白盒测试
详解 Hough 变换(上)基本原理与直线检测
2022李宏毅机器学习hw1--COVID-19 Cases Prediction
Unity中采用二进制存档与读档
详解 Hough 变换(下)圆形检测
系统架构和问题定位
LeetCode 1720. Decoding XORed Arrays (Simple)
51单片机智能远程遥控温控PWM电风扇系统红外遥控温度速度定时关机
A little knowledge point every day
Convolutional Neural Network (CNN) for Clothing Image Classification
ASP.NET连接SQL Server的步骤
STM32F407ZG TIM通用定时器
一个基于.Net Core跨平台小程序考试系统
卷积神经网络(CNN)实现服装图像分类
【fiddler4】使用fiddler设置简单并发
LruCache与DiskLruCache结合简单实现ImageLoader