面向组件编程之Unity 5.normalized不改变原向量,Normalize改变原向量

时间:2021-11-29 04:17:19
using System.Collections; using System.Collections.Generic; using UnityEngine; public class TransformFeng2 : MonoBehaviour { // Use this for initialization void Start() { #region Vector3 v3 = new Vector3(3, 1, 0); //normalized没有改变原来向量的值 Vector3 res = v3.normalized; Debug.Log("res = " + res); Debug.Log("v3 = " + v3); //normalize把v3原来的向量直接改变成标准化向量 v3.Normalize(); Debug.Log("v3 = " + v3); #endregion } }