using Newtonsoft.Json.Linq;
using UnityEngine;
namespace MCPForUnity.Editor.Helpers
{
///
/// Helper class for Vector3 operations
///
public static class Vector3Helper
{
///
/// Parses a JArray into a Vector3
///
/// The array containing x, y, z coordinates
/// A Vector3 with the parsed coordinates
/// Thrown when array is invalid
public static Vector3 ParseVector3(JArray array)
{
if (array == null || array.Count != 3)
throw new System.Exception("Vector3 must be an array of 3 floats [x, y, z].");
return new Vector3((float)array[0], (float)array[1], (float)array[2]);
}
}
}