当前位置:网站首页>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为当前速度,此值由函数在每次调用时进行修改*/
}边栏推荐
- PyTorch框架的 torch.cat()函数
- Characteristics and Development Prospects of Korea's Cyber Security System
- competed中访问ref为undefined
- 【二叉树】树的子结构
- 韩国网络安全体系特征与发展前景
- 获取数组最后一项别再用array.length-1了
- axi4c
- 小满nestjs(第六章 nestjs cli 常用命令)
- How are data integration APIs key to enterprise digital transformation?
- Number of daffodils within a thousand
猜你喜欢

DP-Differential Privacy概念介绍

URL Protocol web page to open the application

PCL学习之滤波Filtering

2.3 监督学习-2

Prometheus Operator 通过additional 添加target

【kali-密码攻击】(5.1.1)密码在线破解:Hydra(图形界面)

【kali-权限提升】(4.2.7)社会工程学工具包:权限维持创建后门、清除痕迹

Two methods of implementing inverted strings in C language

访问控制知识

Ali Ermi: Without accept, can a TCP connection be established?
随机推荐
source install/setup.bash时出现错误
Cholesterol-PEG-Thiol,CLS-PEG-SH,胆固醇-聚乙二醇-巯基用于改善溶解度
一种基于连接和安全熵的网络空间整体安全认识和方法
Prometheus Operator 通过additional 添加target
奥特曼卡牌隐藏的百亿市场
如何在WPF中设置Grid ColumnDefinitions的样式
Environment: Flink version: 1.15.1 jar package: flink-sql-connector-oracle
How are data integration APIs key to enterprise digital transformation?
ClickHouse一种高性能分布式join查询模型(Colocate Join)
STM32WB55的FUS更新及协议栈固件烧写方法
Openharmony Lightweight System Experiment--GPIO Lighting
【分享】入驻集简云开发者平台,如何使用Session Auth配置授权?
听音识情绪 | 程序员手把手教你搭建神经网络,更快get女朋友情绪,求生欲max!
Queue topic: Implementing stacks with queues
Visual studio 2022 debugging skills introduction
Haven't tried line art videos this year??
顺序表的定义和基本操作
【深度学习】pix2pix GAN理论及代码实现
MySQL, which is asked on both sides of the byte, almost didn't answer well
DP-Differential Privacy概念介绍