当前位置:网站首页>Unity_平滑移动
Unity_平滑移动
2022-08-09 19:20:00 【不可_收_圾】
/*用场景中target物体位置为基准进行偏移后的位置作为位移目标点位置*/
public Transform target;
public float smoothTime = 0.75F;//移动花费的时间,越小速度越快
private Vector3 velocity = Vector3.zero;
void Start()
{
}
void Update()
{
Vector3 targetPosition = target.TransformPoint(new Vector3(0, 0, -10));//在target物体位置基础上把Z轴偏移-10距离的位置点
transform.position = Vector3.SmoothDamp(transform.position, targetPosition, ref velocity, smoothTime);
/*velocity为当前速度,此值由函数在每次调用时进行修改*/
}边栏推荐
- Next second data: the transformation of the modern data stack brought about by the integration of lake and warehouse has begun
- 为什么数字钱包需要引入小程序生态
- Access Characteristics of Constructor under Inheritance Relationship
- 奥特曼卡牌隐藏的百亿市场
- 小满nestjs(第四章 前置知识装饰器-实现一个GET请求)
- Openharmony Lightweight System Experiment--GPIO Lighting
- 没有 accept,我可以建立 TCP 连接吗?
- ClickHouse一种高性能分布式join查询模型(Colocate Join)
- 小满nestjs(第五章 nestjs cli)
- 『百日百题 · 基础篇』备战面试,坚持刷题 第五话——循环语句(2)!
猜你喜欢
随机推荐
hdu 2094 产生冠军(STL map || 拓扑 || STL set)
新出现的去中心化科学能够为科学领域带来什么?
小满nestjs(第四章 前置知识装饰器-实现一个GET请求)
MySQL, which is asked on both sides of the byte, almost didn't answer well
时序攻击
新起之秀 DPU,正在掀起数据中心变革!
buuctf (Adventure 2)
以技术创新加速国家“碳中和”建设进程,华为云创新中心助力欣冠精密实现云智控“气”
[Essay] To the friends of the 19th issue
Toronto Research Chemicals盐酸乙环胺应用说明
看完这波 Android 面试题;助你斩获心中 offer
Overview of Security Analysis Technology for Smart Home Devices
SqlServer 2016 安装相关问题
奥特曼卡牌隐藏的百亿市场
【IoT毕设】STM32与机智云自助开发平台的宠物智能喂养系统
基于光通信的6G水下信道建模综述
字节二面问的MySQL,差点没答好
分数阶混沌系统李雅普指数和分岔图
2.2 监督学习-1
如何从800万数据中快速捞出自己想要的数据?



![[Free column] Xposed plug-in development for Android security [from scratch] tutorial](/img/7b/a036ac664c7e27ed7d87e7ee18c05d.png)





