# UNITY 5.2 Vector3 結構

## Static變數：特殊向量的縮寫，只讀

public static Vector3 back { get; }

public static Vector3 down { get; }

public static Vector3 forward { get; }

public static Vector3 left { get; }

public static Vector3 one { get; }

public static Vector3 right { get; }

public static Vector3 up { get; }

public static Vector3 zero { get; }

public Vector3(float x, float y);
public Vector3(float x, float y, float z);

## Public變數：

public float magnitude { get; }

public Vector3 normalized { get; }

public float sqrMagnitude { get; }

public float this[int index] { get; set; }

public float x;
public float y;
public float z;

## Public函式：

public void Normalize();

public void Set(float new_x, float new_y, float new_z);

public void Scale(Vector3 scale);

public override string ToString();
public string ToString(string format);

## Static函式：

public static float Angle(Vector3 from, Vector3 to);

public static Vector3 ClampMagnitude(Vector3 vector, float maxLength);

public static Vector3 Cross(Vector3 lhs, Vector3 rhs);

public static float Distance(Vector3 a, Vector3 b);

public static float Dot(Vector3 lhs, Vector3 rhs);

public static Vector3 Lerp(Vector3 a, Vector3 b, float t);
public static Vector3 LerpUnclamped(Vector3 a, Vector3 b, float t);

ublic static Vector3 Max(Vector3 lhs, Vector3 rhs);
public static Vector3 Min(Vector3 lhs, Vector3 rhs);

public static Vector3 MoveTowards(Vector3 current, Vector3 target, float maxDistanceDelta);

public static Vector3 Normalize(Vector3 value);

public static void OrthoNormalize(ref Vector3 normal, ref Vector3 tangent);
public static void OrthoNormalize(ref Vector3 normal, ref Vector3 tangent, ref Vector3 binormal);

public static Vector3 Project(Vector3 vector, Vector3 onNormal);

public static Vector3 ProjectOnPlane(Vector3 vector, Vector3 planeNormal);

public static Vector3 Reflect(Vector3 inDirection, Vector3 inNormal);

public static Vector3 RotateTowards(Vector3 current, Vector3 target, float maxRadiansDelta, float maxMagnitudeDelta);

public static Vector3 Scale(Vector3 a, Vector3 b);

public static Vector3 Slerp(Vector3 a, Vector3 b, float t);
public static Vector3 SlerpUnclamped(Vector3 a, Vector3 b, float t);

public static Vector3 SmoothDamp(Vector3 current, Vector3 target, ref Vector3 currentVelocity, float smoothTime);
public static Vector3 SmoothDamp(Vector3 current, Vector3 target, ref Vector3 currentVelocity, float smoothTime, float maxSpeed);
public static Vector3 SmoothDamp(Vector3 current, Vector3 target, ref Vector3 currentVelocity, float smoothTime, float maxSpeed, float deltaTime);

current ：當前座標
target ：目標座標
currentVelocity ：每次呼叫該函式獲取的速度
smoothTime ：大約花費的時間，值越小，速度越大
maxSpeed ：限制最大的速度
deltaTime　：呼叫事件間隔，預設為　Time.deltaTime.