当前位置:网站首页>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为当前速度,此值由函数在每次调用时进行修改*/
}边栏推荐
- 为什么数字钱包需要引入小程序生态
- Redis 大的情况下,key 要如何处理?
- Access Characteristics of Constructor under Inheritance Relationship
- 大健康产业商业供应链管理系统数字化提升产业链运作效率推动供应链标准化建设
- AttributeError: module 'click' has no attribute 'get_os_args'
- 智能家居设备安全分析技术综述
- 下秒数据:湖仓一体带来的现代数据堆栈变革开始了
- hdu 2094 产生冠军(STL map || 拓扑 || STL set)
- 明明加了唯一索引,为什么还是产生重复数据?
- 2.3 监督学习-2
猜你喜欢
随机推荐
【二叉树】树的子结构
DSPE-PEG-Azide, DSPE-PEG-N3, phospholipid-polyethylene glycol-azide can react directly with DBCO
competed中访问ref为undefined
axi4c
获取数组最后一项别再用array.length-1了
请问一下flink cdc mysql source 报这种错怎么处理呢?我都设置了useSSL=f
[Essay] To the friends of the 19th issue
不经意传输协议OT
真香|持一建证书央企可破格录取
纸业供应链协同管理系统:重构纸业智慧供应网络,支撑企业数字化转型升级
Toronto Research Chemicals盐酸乙环胺应用说明
『百日百题 · 基础篇』备战面试,坚持刷题 第五话——循环语句(2)!
顺序表的定义和基本操作
Cholesterol-PEG-Thiol, CLS-PEG-SH, Cholesterol-PEG-Sulfhydryl for improved solubility
新出现的去中心化科学能够为科学领域带来什么?
技术分享 | 接口自动化测试如何处理 Header cookie
MySQL笔记-06 基础SQL操作
Laravel DB批量更新的方法
How are data integration APIs key to enterprise digital transformation?
An overall security understanding and method of cyberspace based on connection and security entropy








