ベクトルの長さの取得方法を自分用にメモ。
[ 取得方法 ]
「Vector3.magnitude」で取得できます。
[ 使用例 ]
下記はVector3Test1の長さをコンソールに出力します。
using System.Collections; using System.Collections.Generic; using UnityEngine; public class ScriptTest : MonoBehaviour { void Start() { Vector3 Vector3Test1 = new Vector3(30, 10, -40); Debug.Log(Vector3Test1.magnitude); } }