public List <ARReferenceObject> LoadReferenceObjectsInSet() { List <ARReferenceObject> listRefObjects = new List <ARReferenceObject> (); if (UnityARSessionNativeInterface.IsARKit_2_0_Supported() == false) { return(listRefObjects); } string folderPath = Application.streamingAssetsPath + "/ARReferenceObjects/" + resourceGroupName + ".arresourcegroup"; string contentsJsonPath = Path.Combine(folderPath, "Contents.json"); ARResourceGroupContents resGroupContents = JsonUtility.FromJson <ARResourceGroupContents>(File.ReadAllText(contentsJsonPath)); foreach (ARResourceGroupResource arrgr in resGroupContents.resources) { string objectFolderPath = Path.Combine(folderPath, arrgr.filename); string objJsonPath = Path.Combine(objectFolderPath, "Contents.json"); ARReferenceObjectResourceContents resourceContents = JsonUtility.FromJson <ARReferenceObjectResourceContents> (File.ReadAllText(objJsonPath)); string fileToLoad = Path.Combine(objectFolderPath, resourceContents.objects [0].filename); ARReferenceObject arro = ARReferenceObject.Load(fileToLoad); arro.name = resourceContents.referenceObjectName; listRefObjects.Add(arro); } return(listRefObjects); }
public override ARConfiguration GetARConfiguration() { return(new ARWorldTrackingConfiguration { DetectionObjects = ARReferenceObject.GetReferenceObjects("objects", null), }); }
internal DetectedObject(ARReferenceObject referenceObject) : base() { this.referenceObject = referenceObject; pointCloudVisualization = new DetectedPointCloud(referenceObject.RawFeaturePoints, referenceObject.Center, referenceObject.Extent); var scene = SCNScene.FromFile("axes.scn", "art.scnassets", new NSDictionary()); if (scene != null) { originVis = new SCNNode(); foreach (var child in scene.RootNode.ChildNodes) { originVis.AddChildNode(child); } } else { originVis = new SCNNode(); Console.WriteLine("Error: Coordinate system visualization missing."); } AddChildNode(pointCloudVisualization); Hidden = true; Set3DModel(ViewController.Instance?.ModelUrl); }
internal void SetReferenceObject(ARReferenceObject obj, UIImage screenshot) { ReferenceObject = obj; PreviewImage = screenshot; detections = 0; lastDetectionDelayInSeconds = 0; averageDetectionDelayInSeconds = 0; DetectedObject = new DetectedObject(ReferenceObject); sceneView.Scene.RootNode.AddChildNode(DetectedObject); lastDetectionStartTime = DateTime.Now; var config = new ARWorldTrackingConfiguration(); config.DetectionObjects = new NSSet <ARReferenceObject>(new[] { ReferenceObject }); // ARSessionRunOptions.None should be coming in a future binding. In the meantime, the following cast sceneView.Session.Run(config, (ARSessionRunOptions)0); }