public InputGrabManager( GameObject gameObject, XRGrabInteractable grabInteractable, Core.Data.GemPy.DataPoint modelInputDataPoint) { GameObject = gameObject; Interactable = grabInteractable; InputDataPoint = modelInputDataPoint; Actions = new Dictionary <string, UnityAction <XRBaseInteractor> >(); Actions.Add(key: "Grab", Grab); Actions.Add(key: "Release", Release); }
public static Core.Data.GemPy.Input GetModelInput(Proyecto26.ResponseHelper response) { var modelInput = new Core.Data.GemPy.Input { Surfaces = new Dictionary <string, Core.Data.GemPy.Surface>(), DataPoints = new List <Core.Data.GemPy.DataPoint>(), }; foreach (var items in JObject.Parse(response.Text)) { if (items.Key == "surfaces") { foreach (var data in items.Value) { var jObject = data.First.ToObject <SurfaceJObject>(); ColorUtility.TryParseHtmlString(jObject.color, out Color color); var surface = new Core.Data.GemPy.Surface { surface = jObject.surface, series = jObject.series, id = int.Parse(data.Path.Split('.')[1]), color = color }; modelInput.Surfaces.Add( key: jObject.surface, value: surface); } } else if (items.Key == "orientations") { foreach (var data in items.Value) { var jObject = data.First.ToObject <OrientationJObject>(); var orientation = new Core.Data.GemPy.DataPoint { type = Core.Data.GemPy.InputType.Orientation, position = new Vector3(jObject.X, jObject.Y, jObject.Z), gradient = new Vector3(jObject.G_x, jObject.G_y, jObject.G_z), surface = jObject.surface, id = int.Parse(data.Path.Split('.')[1]) }; modelInput.DataPoints.Add(orientation); } } else if (items.Key == "sp") { foreach (var data in items.Value) { var jObject = data.First.ToObject <SurfacePointJObject>(); var point = new Core.Data.GemPy.DataPoint { type = Core.Data.GemPy.InputType.SurfacePoint, position = new Vector3(jObject.X, jObject.Y, jObject.Z), surface = jObject.surface, id = int.Parse(data.Path.Split('.')[1]) }; modelInput.DataPoints.Add(point); } } } return(modelInput); }