Vector3 vector = new Vector3(2, 3, 4); Vector3 normalized = Vector3.Normalize(vector); // normalized = (0.37139, 0.55708, 0.74278)
Vector3[] vectors = new Vector3[] { new Vector3(1, 0, 0), new Vector3(0, 1, 0), new Vector3(0, 0, 1) }; foreach (Vector3 v in vectors) { Vector3 normalized = Vector3.Normalize(v); // normalized = (1, 0, 0), (0, 1, 0), (0, 0, 1) }In this example, we create an array of three Vector3 objects representing the x, y, and z axes. We iterate over each of them and apply the Normalize method, which returns the same vector since they already have a length of 1. The System Vector3 Normalize method belongs to the C# Math library and is part of the System.Numerics namespace.