Vector3
- Angle
- ClampMagnitude
- Cross
- Distance
- Dot
- forward
- Lerp
- magnitude
- Max
- Min
- MoveTowards
- normalized
- Normalize
- one
- operator !=
- operator *
- operator +
- operator -
- operator /
- operator ==
- OrthoNormalize
- Project
- Reflect
- right
- RotateTowards
- Scale
- Slerp
- SmoothDamp
- sqrMagnitude
- this [int index]
- ToString
- up
- Vector3
- x
- y
- zero
- z
Vector3.SmoothDamp 平滑阻尼
static function SmoothDamp (current : Vector3, target : Vector3, ref currentVelocity : Vector3, smoothTime : float, maxSpeed : float = Mathf.Infinity, deltaTime : float = Time.deltaTime) : Vector3
Parameters参数
-
currentThe current position.
当前的位置 -
targetThe position we are trying to reach.
我们试图接近的位置
-
currentVelocityThe current velocity, this value is modified by the function every time you call it.
当前速度,这个值由你每次调用这个函数时被修改 -
smoothTimeApproximately the time it will take to reach the target. A smaller value will reach the target faster.
到达目标的大约时间,较小的值将快速到达目标 -
maxSpeedOptionally allows you to clamp the maximum speed.
选择允许你限制的最大速度
-
deltaTimeThe time since the last call to this function. By default Time.deltaTime.
自上次调用这个函数的时间。默认为 Time.deltaTime
Description描述
Gradually changes a vector towards a desired goal over time.
随着时间的推移,逐渐改变一个向量朝向预期的目标。
The vector is smoothed by some spring-damper like function, which will never overshoot. The most common use is for smoothing a follow camera.
向量由一些像弹簧阻尼器函数平滑,这将永远不会超过。最常见的用途是平滑跟随相机。
using UnityEngine;
using System.Collections;
public class example : MonoBehaviour {
public Transform target;
public float smoothTime = 0.3F;
private Vector3 velocity = Vector3.zero;
void Update() {
Vector3 targetPosition = target.TransformPoint(new Vector3(0, 5, -10));
transform.position = Vector3.SmoothDamp(transform.position, targetPosition, ref velocity, smoothTime);
}
}
// Smooth towards the target
//平滑朝向目标
var target : Transform;
var smoothTime = 0.3;
private var velocity = Vector3.zero;
function Update () {
// Define a target position above and behind the target transform
//定义一个目标位置在目标变换的上方并且在后面
var targetPosition : Vector3 = target.TransformPoint(Vector3(0, 5, -10));
// Smoothly move the camera towards that target position
//平滑地移动摄像机朝向目标位置
transform.position = Vector3.SmoothDamp(transform.position, targetPosition,
velocity, smoothTime);
}
最后修改:2011年1月16日 Sunday 17:51