Version: 2021.3
public static Vector2 SmoothDamp (Vector2 current, Vector2 target, ref Vector2 currentVelocity, float smoothTime, float maxSpeed= Mathf.Infinity, float deltaTime= Time.deltaTime);

参数

current 当前位置。
target 尝试达到的目标。
currentVelocity 当前速度,此值由函数在每次调用时进行修改。
smoothTime 达到目标所需的近似时间。值越小,达到目标的速度越快。
maxSpeed 可以选择允许限制最大速度。
deltaTime 自上次调用此函数以来的时间。默认情况下为 Time.deltaTime。

描述

随时间推移将一个向量逐渐改变为所需目标。

向量通过某个类似于弹簧-阻尼的函数(它从不超过目标)进行平滑。

Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961