// Create two Vector3 instances Vector3 vec1 = new Vector3(2, 4, 6); Vector3 vec2 = new Vector3(3, 6, 9); // Add the two vectors and store the result in a new Vector3 variable Vector3 result = Vector3.Add(vec1, vec2); // Displaying the result Console.WriteLine("Resultant Vector: ({0}, {1}, {2})", result.X, result.Y, result.Z);
Resultant Vector: (5, 10, 15)
// Create a Vector3 instance Vector3 vec = new Vector3(1, 2, 3); // Add the same vector to itself and store the result in the original vector vec = Vector3.Add(vec, vec); // Display the updated vector Console.WriteLine("Updated Vector: ({0}, {1}, {2})", vec.X, vec.Y, vec.Z);
Updated Vector: (2, 4, 6)