using UnityEngine;

public static class MathExtensions{
    public static Vector3 Flatten(this Vector3 origin, float? x = null, float? y = null, float? z = null){
        return new Vector3(x ?? origin.x, y ?? origin.y, z ?? origin.z);
    }

    public static Quaternion Flatten(this Quaternion input, float? x = null, float? y = null, float? z = null){
        return Quaternion.Euler(input.eulerAngles.Flatten(x, y, z));
    }

    public static Vector3 DirectionTo(this Vector3 origin, Vector3 to){
        return (to - origin).normalized;
    }

    public static Color Alpha(this Color input, float newAlpha){
        return new Color(input.r, input.g, input.b, newAlpha);
    }
}
