Esempio n. 1
0
        public override void ViewWillAppear(bool animated)
        {
            base.ViewWillAppear(animated);

            var imageFromDevice              = UIImage.FromBundle("IMG_8230.JPG");
            var imageFromDeviceCG            = imageFromDevice.CGImage;
            var orientation                  = CGImagePropertyOrientation.Up;
            var imageFromDevicePhysicalWidth = new nfloat(0.085);
            var arDeviceImage                = new ARReferenceImage(imageFromDeviceCG, orientation, imageFromDevicePhysicalWidth);

            var imageFromURL   = FromUrl("https://d2gg9evh47fn9z.cloudfront.net/800px_COLOURBOX21927671.jpg");
            var imageFromURLCG = imageFromURL.CGImage;
            //var orientation = CGImagePropertyOrientation.Up;
            var imageFromURLPhysicalWidth = new nfloat(0.145);
            var arURLImage = new ARReferenceImage(imageFromURLCG, orientation, imageFromURLPhysicalWidth);

            var arImageSet = new NSSet <ARReferenceImage>(arURLImage, arDeviceImage);

            var configuration = new ARWorldTrackingConfiguration();

            configuration.DetectionImages = arImageSet;

            //// Run the view's session
            //var options = new ARSessionRunOptions();
            //options = ARSessionRunOptions.RemoveExistingAnchors;
            //SceneView.Session.Run(configuration, options);

            //// Configure ARKit
            //var config = new ARWorldTrackingConfiguration();
            //config.PlaneDetection = ARPlaneDetection.Horizontal;

            // This method is called subsequent to `ViewDidLoad` so we know `scnView` is instantiated
            scnView.Session.Run(configuration, ARSessionRunOptions.RemoveExistingAnchors);
        }
Esempio n. 2
0
        public override void ViewWillAppear(bool animated)
        {
            base.ViewWillAppear(animated);
            //ARWorldTrackingSessionConfiguration config;// = new A
            //ARWorldTrackingSessionConfiguration
            ARWorldTrackingConfiguration config = new ARWorldTrackingConfiguration();

            //ARWorldTrackingSessionConfiguration config = new ARWorldTrackingSessionConfiguration{


            //};
            config.PlaneDetection = ARPlaneDetection.Horizontal;
            arSessionConfig       = config;
            arSessionConfig.LightEstimationEnabled = true;

            arSession = new ARSession();

            arSCNView         = new ARSCNView();
            arSCNView.Frame   = View.Bounds;
            arSCNView.Session = arSession;
            arSCNView.AutomaticallyUpdatesLighting = true;
            View.AddSubview(this.arSCNView);
            arSession.Run(this.arSessionConfig, ARSessionRunOptions.RemoveExistingAnchors);



            var scene = SCNScene.FromFile("Models.scnassets/chair/chair.scn");

            SCNNode node = scene.RootNode.ChildNodes[0];


            node.Position = new SCNVector3(0, -1, -1);

            arSCNView.Scene.RootNode.AddNodes(node);
        }
Esempio n. 3
0
        public override void ViewDidAppear(bool animated)
        {
            base.ViewDidAppear(animated);

            if (!ARConfiguration.IsSupported)
            {
                throw new Exception("ARKit is not available on this device. For apps that require ARKit" +
                                    "for core functionality, use the `arkit` key in the key in the" +
                                    "`UIRequiredDeviceCapabilities` section of the Info.plist to prevent" +
                                    "the app from installing. (If the app can't be installed, this error" +
                                    "can't be triggered in a production scenario.)" +
                                    "In apps where AR is an additive feature, use `isSupported` to" +
                                    "determine whether to show UI for launching AR experiences.");
                // For details, see https://developer.apple.com/documentation/arkit
            }

            // Start the view's AR session.
            var configuration = new ARWorldTrackingConfiguration {
                PlaneDetection = ARPlaneDetection.Horizontal
            };

            this.sceneView.Session.Run(configuration);

            // Set a delegate to track the number of plane anchors for providing UI feedback.
            this.sceneView.Session.Delegate = this;
            this.sceneView.DebugOptions     = ARSCNDebugOptions.ShowFeaturePoints;

            // Prevent the screen from being dimmed after a while as users will likely
            // have long periods of interaction without touching the screen or buttons.
            UIApplication.SharedApplication.IdleTimerDisabled = true;
        }
Esempio n. 4
0
        public void DidAddNode(ISCNSceneRenderer renderer, SCNNode node, ARAnchor anchor)
        {
            // Place content only for anchors found by plane detection.
            if (anchor is ARPlaneAnchor && this.previewNode != null)
            {
                // Stop showing a preview version of the object to be placed.
                this.cupNode.RemoveFromParentNode();

                this.previewNode?.RemoveFromParentNode();
                this.previewNode?.Dispose();
                this.previewNode = null;

                // Add the cupNode to the scene's root node using the anchor's position.
                var cameraTransform = this.sceneView.Session.CurrentFrame?.Camera?.Transform;
                if (cameraTransform.HasValue)
                {
                    this.SetNewVirtualObjectToAnchor(this.cupNode, anchor, cameraTransform.Value);
                    this.sceneView.Scene.RootNode.AddChildNode(this.cupNode);

                    // Disable plane detection after the model has been added.
                    var configuration = new ARWorldTrackingConfiguration {
                        PlaneDetection = ARPlaneDetection.Horizontal
                    };
                    this.sceneView.Session.Run(configuration, default(ARSessionRunOptions));

                    // Set up positional audio to play in case the object moves offscreen.
                    this.PlaySound();
                }
            }
        }
        // Once we create scene we need to position our AR model in it:
        public void PositionSceneObject(ARSCNView sceneView)
        {
            // Each session has to be configured.
            //  We will use ARWorldTrackingConfiguration to have full access to device orientation,
            // rear camera, device position and to detect real-world flat surfaces:
            var configuration = new ARWorldTrackingConfiguration
            {
                PlaneDetection         = ARPlaneDetection.Horizontal,
                LightEstimationEnabled = true
            };

            // Once we have our configuration we need to run session with it.
            // ResetTracking will just reset tracking by session to start it again from scratch:
            sceneView.Session.Run(configuration, ARSessionRunOptions.ResetTracking);

            // Next we need to find main "node" in the .dae file. In this case it is called "ship":
            var shipNode = sceneView.Scene.RootNode.FindChildNode("ship", true);

            // Then we have to set position of AR object - below I would like to display it in front of camera:
            shipNode.Position = new SCNVector3(0.0f, 0.0f, -20f);

            // Next we need to add ship object to scene:
            sceneView.Scene.RootNode.AddChildNode(shipNode);

            // At the end I configured simple rotating animation to rotate ship object in front of camera:
            shipNode.RunAction(SCNAction.RepeatActionForever(SCNAction.RotateBy(0f, 4f, 0, 5)));
        }
        public override void ViewWillAppear(bool animated)
        {
            base.ViewWillAppear(animated);

            // Create a session configuration
            var configuration = new ARWorldTrackingConfiguration {
                PlaneDetection         = ARPlaneDetection.Horizontal,
                LightEstimationEnabled = true
            };

            // Run the view's session
            SceneView.Session.Run(configuration, ARSessionRunOptions.ResetTracking);


            // Find the ship and position it just in front of the camera
            var ship = SceneView.Scene.RootNode.FindChildNode("ship", true);


            ship.Position = new SCNVector3(2f, -2f, -9f);
            //HACK: to see the jet move (circle around the viewer in a roll), comment out the ship.Position line above
            // and uncomment the code below (courtesy @lobrien)

            //var animation = SCNAction.RepeatActionForever(SCNAction.RotateBy(0, (float)Math.PI, (float)Math.PI, (float)1));
            //var pivotNode = new SCNNode { Position = new SCNVector3(0.0f, 2.0f, 0.0f) };
            //pivotNode.RunAction(SCNAction.RepeatActionForever(SCNAction.RotateBy(0, -2, 0, 10)));
            //ship.RemoveFromParentNode();
            //pivotNode.AddChildNode(ship);
            //SceneView.Scene.RootNode.AddChildNode(pivotNode);
            //ship.Scale = new SCNVector3(0.1f, 0.1f, 0.1f);
            //ship.Position = new SCNVector3(2f, -2f, -3f);
            //ship.RunAction(SCNAction.RepeatActionForever(SCNAction.RotateBy(0, 0, 2, 1)));

            //ENDHACK
        }
Esempio n. 7
0
 public void GetSupportedVideoFormats_9_3()
 {
     TestRuntime.AssertXcodeVersion(9, 3);
     Assert.NotNull(ARWorldTrackingConfiguration.GetSupportedVideoFormats(), "ARWorldTrackingConfiguration");
     Assert.NotNull(AROrientationTrackingConfiguration.GetSupportedVideoFormats(), "AROrientationTrackingConfiguration");
     Assert.NotNull(ARFaceTrackingConfiguration.GetSupportedVideoFormats(), "ARFaceTrackingConfiguration");
 }
Esempio n. 8
0
        /// <summary>
        /// Runs the session with a new AR configuration to change modes or reset the experience.
        /// </summary>
        private void ResetTracking(bool changeTextureMode = false)
        {
            var configuration = new ARWorldTrackingConfiguration();

            configuration.PlaneDetection       = ARPlaneDetection.Horizontal;
            configuration.EnvironmentTexturing = this.currentTexturingMode;

            var session = this.sceneView.Session;

            if (changeTextureMode)
            {
                // Remove existing environment probe anchors.
                if (session.CurrentFrame?.Anchors != null)
                {
                    foreach (var anchor in session.CurrentFrame.Anchors)
                    {
                        session.RemoveAnchor(anchor);
                    }
                }

                // Don't reset tracking when changing modes in the same session.
                session.Run(configuration);
            }
            else
            {
                session.Run(configuration, ARSessionRunOptions.ResetTracking | ARSessionRunOptions.RemoveExistingAnchors);
            }

            this.isEnvironmentTextureAvailable = false;
            this.sceneEnvironmentProbeAnchor?.Dispose();
            this.sceneEnvironmentProbeAnchor = null;
            configuration.Dispose();
            session.Dispose();
        }
Esempio n. 9
0
        public override void ViewDidAppear(bool animated)
        {
            base.ViewDidAppear(animated);

            // Preload the audio file.
            this.source       = SCNAudioSource.FromFile("art.scnassets/ping.aif");
            this.source.Loops = true;
            this.source.Load();

            if (ARConfiguration.IsSupported)
            {
                // Start the ARSession.
                var configuration = new ARWorldTrackingConfiguration {
                    PlaneDetection = ARPlaneDetection.Horizontal
                };
                this.sceneView.Session.Run(configuration, default(ARSessionRunOptions));

                this.screenCenter = new CGPoint(this.sceneView.Bounds.GetMidX(), this.sceneView.Bounds.GetMidY());

                // Prevent the screen from being dimmed after a while as users will likely have
                // long periods of interaction without touching the screen or buttons.
                UIApplication.SharedApplication.IdleTimerDisabled = true;
            }
            else
            {
                this.ShowUnsupportedDeviceError();
            }
        }
Esempio n. 10
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ARSceneView"/> class.
        /// </summary>
        public ARSceneView() : base()
        {
            InitializeCommon();

            _delegate = new ARDelegate(this);

            // Each session has to be configured.
            //  We will use ARWorldTrackingConfiguration to have full access to device orientation,
            // rear camera, device position and to detect real-world flat surfaces:
            _arConfiguration = new ARWorldTrackingConfiguration
            {
                PlaneDetection         = ARPlaneDetection.Horizontal,
                WorldAlignment         = ARWorldAlignment.GravityAndHeading,
                LightEstimationEnabled = false
            };

            if (DeviceSupportsARKit)
            {
                ARSCNView = new ARSCNView2(_delegate)
                {
                    TranslatesAutoresizingMaskIntoConstraints = false
                };
            }

            IsUsingARKit = DeviceSupportsARKit;
            // Tell the SceneView we will be calling `RenderFrame()` manually if we're using ARKit.
            IsManualRendering = IsUsingARKit;
        }
        public void PositionScene(ARSCNView sceneView, string arLaunchType)
        {
            var arConfiguration = new ARWorldTrackingConfiguration
            {
                PlaneDetection         = ARPlaneDetection.Horizontal,
                LightEstimationEnabled = true
            };

            sceneView.Session.Run(arConfiguration, ARSessionRunOptions.ResetTracking);

            var sceneShipNode = sceneView.Scene.RootNode.FindChildNode("ship", true);

            sceneShipNode.Position = new SCNVector3(2f, -2f, -9f);

            var animationCycle  = SCNAction.RepeatActionForever(SCNAction.RotateBy(0f, 6f, 0, 5));
            var animationCrash  = SCNAction.RepeatActionForever(SCNAction.RotateBy(0, (float)Math.PI, (float)Math.PI, (float)1));
            var animationNormal = SCNAction.RepeatActionForever(SCNAction.RotateBy(0, 0, 0, 1));
            var animationRotate = SCNAction.RepeatActionForever(SCNAction.RotateBy(0, 0, 2, 1));


            var scenePivotNode = new SCNNode {
                Position = new SCNVector3(0.0f, 2.0f, 0.0f)
            };

            scenePivotNode.RunAction(SCNAction.RepeatActionForever(SCNAction.RotateBy(0, -2, 0, 10)));

            sceneShipNode.RemoveFromParentNode();
            scenePivotNode.AddChildNode(sceneShipNode);

            sceneView.Scene.RootNode.AddChildNode(scenePivotNode);

            sceneShipNode.Scale    = new SCNVector3(0.1f, 0.1f, 0.1f);
            sceneShipNode.Position = new SCNVector3(2f, -2f, -3f);


            switch (arLaunchType)
            {
            case "Rotate Fly":
                sceneShipNode.RunAction(animationRotate);
                break;

            case "Crash Fly":
                sceneShipNode.RunAction(animationCrash);
                break;

            case "Cycle Fly":
                sceneShipNode.RunAction(animationCycle);
                break;

            case "Normal Fly":
                sceneShipNode.RunAction(animationNormal);
                break;

            default:
                scenePivotNode.RemoveAllActions();
                scenePivotNode.RunAction(SCNAction.Unhide());
                break;
            }
        }
Esempio n. 12
0
        partial void resetTracking(UIButton sender)
        {
            var configuration = new ARWorldTrackingConfiguration {
                PlaneDetection = ARPlaneDetection.Horizontal
            };

            this.sceneView.Session.Run(configuration, ARSessionRunOptions.ResetTracking | ARSessionRunOptions.RemoveExistingAnchors);
        }
 public void GetSupportedVideoFormats()
 {
     Assert.NotNull(ARWorldTrackingConfiguration.GetSupportedVideoFormats(), "ARWorldTrackingConfiguration");
     Assert.NotNull(AROrientationTrackingConfiguration.GetSupportedVideoFormats(), "AROrientationTrackingConfiguration");
     Assert.NotNull(ARFaceTrackingConfiguration.GetSupportedVideoFormats(), "ARFaceTrackingConfiguration");
     Assert.NotNull(ARImageTrackingConfiguration.GetSupportedVideoFormats(), "ARImageTrackingConfiguration");
     Assert.NotNull(ARObjectScanningConfiguration.GetSupportedVideoFormats(), "ARObjectScanningConfiguration");
 }
Esempio n. 14
0
        partial void LoadExperience()
        {
            if (DataFromFile == null)
            {
                Debug.WriteLine("Map data should already be verified to exist before Load button is enabled.");
                return;
            }

            try
            {
                var data = DataFromFile;

                ARWorldMap worldMap = (ARWorldMap)NSKeyedUnarchiver.GetUnarchivedObject(typeof(ARWorldMap), data, out var err);

                if (err != null)
                {
                    Debug.WriteLine("No ARWorldMap in archive.");
                    return;
                }

                // Display the snapshot image stored in the world map to aid user in relocalizing.
                var snapshotData = worldMap.GetSnapshotAnchor()?.ImageData;

                using (var snapshot = UIImage.LoadFromData(snapshotData))
                {
                    if (snapshot != null)
                    {
                        _snapShotThumbnail.Image = snapshot;
                    }
                    else
                    {
                        Debug.WriteLine("No snapshot image in world map");
                    }
                }

                // Remove the snapshot anchor from the world map since we do not need it in the scene.
                worldMap.Anchors = worldMap.Anchors.Where(anchor => anchor.GetType() != typeof(SnapshotAnchor)).ToArray();

                var configuration = new ARWorldTrackingConfiguration
                {
                    PlaneDetection       = ARPlaneDetection.Horizontal,
                    EnvironmentTexturing = AREnvironmentTexturing.Automatic,
                    InitialWorldMap      = worldMap,
                };

                _sceneView.Session.Run(configuration, ARSessionRunOptions.ResetTracking | ARSessionRunOptions.RemoveExistingAnchors);    // Run the view's session
                isRelocalizingMap = true;
                objAnchor         = null;
            }
            catch (Exception ex)
            {
                Debug.WriteLine($"Can't unarchive ARWorldMap from file data: {ex.Message}");
                return;
            }

            Debug.WriteLine($"Success: Loaded world scene from {MapSaveURL}");
        }
Esempio n. 15
0
        public override void ViewWillAppear(bool animated)
        {
            base.ViewWillAppear(animated);

            // Create a session configuration
            var configuration = new ARWorldTrackingConfiguration();

            // Run the view's session
            this.sceneView.Session.Run(configuration);
        }
Esempio n. 16
0
        private void RestartSession()
        {
            this.statusViewController.CancelAllScheduledMessages();
            this.statusViewController.ShowMessage("RESTARTING SESSION");

            this.anchorLabels = new Dictionary <NSUuid, string>();

            var configuration = new ARWorldTrackingConfiguration();

            this.sceneView.Session.Run(configuration, ARSessionRunOptions.ResetTracking | ARSessionRunOptions.RemoveExistingAnchors);
        }
Esempio n. 17
0
        private void RunSession()
        {
            config?.Dispose();
            sceneView?.Delegate?.Dispose();

            config = new ARWorldTrackingConfiguration();
            sceneView.Session.Run(config, ARSessionRunOptions.ResetTracking | ARSessionRunOptions.RemoveExistingAnchors);

            //Permite añadir reflejos a los objetos de la escena
            sceneView.AutoenablesDefaultLighting = true;
        }
Esempio n. 18
0
        //Before showing AR Screen View to user
        public override void ViewWillAppear(bool animated)
        {
            base.ViewWillAppear(animated);

            // Configure ARKit
            var config = new ARWorldTrackingConfiguration();

            config.PlaneDetection = ARPlaneDetection.Horizontal;

            // This method is called subsequent to `ViewDidLoad` so we know `scnView` is instantiated
            scnView.Session.Run(config, ARSessionRunOptions.RemoveExistingAnchors);
        }
Esempio n. 19
0
        public override void ViewWillAppear(bool animated)
        {
            base.ViewWillAppear(animated);

            // Configure ARKit
            ARWorldTrackingConfiguration config = new ARWorldTrackingConfiguration
            {
                PlaneDetection = ARPlaneDetection.Horizontal
            };

            this.sceneView.Session.Run(config, ARSessionRunOptions.RemoveExistingAnchors);
        }
Esempio n. 20
0
        public override void ViewWillAppear(bool animated)
        {
            base.ViewWillAppear(animated);

            var configuration = new ARWorldTrackingConfiguration
            {
                PlaneDetection         = ARPlaneDetection.Horizontal,
                LightEstimationEnabled = true
            };

            SceneView.Session.Run(configuration, ARSessionRunOptions.ResetTracking);
        }
Esempio n. 21
0
        public override void ViewWillAppear(bool animated)
        {
            base.ViewWillAppear(animated);

            if (arkitSupported)
            {
                var config = new ARWorldTrackingConfiguration {
                    WorldAlignment = ARWorldAlignment.Gravity,
                };
                arView.Session.Run(config, (ARSessionRunOptions)0);
            }
        }
Esempio n. 22
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            var configuration = new ARWorldTrackingConfiguration
            {
                PlaneDetection         = ARPlaneDetection.Horizontal,
                LightEstimationEnabled = true
            };

            // Run the view's session
            sceneView.Session.Run(configuration, ARSessionRunOptions.ResetTracking);
            sceneView.AutoenablesDefaultLighting = true;
        }
        public override void ViewWillAppear(bool animated)
        {
            base.ViewWillAppear(animated);

            var configuration = new ARWorldTrackingConfiguration
            {
                PlaneDetection   = (ARPlaneDetection.Horizontal | ARPlaneDetection.Vertical),
                AutoFocusEnabled = true
            };

            // Run the view's session
            sceneView.Session.Run(configuration);
        }
Esempio n. 24
0
        private void RunSession()
        {
            config?.Dispose();
            sceneView?.Delegate?.Dispose();

            config = new ARWorldTrackingConfiguration();
            sceneView.DebugOptions = ARSCNDebugOptions.ShowFeaturePoints | ARSCNDebugOptions.ShowWorldOrigin;
            config.PlaneDetection  = ARPlaneDetection.Horizontal;
            sceneView.Session.Run(config, ARSessionRunOptions.ResetTracking | ARSessionRunOptions.RemoveExistingAnchors);

            //Permite añadir reflejos a los objetos de la escena
            sceneView.AutoenablesDefaultLighting = true;
        }
Esempio n. 25
0
 // Position AR scene
 public void PositionScene(ARSCNView sceneView)
 {
     // ARWorldTrackingConfiguration uses the back-facing camera,
     // tracks a device's orientation and position, and detects
     // real-world surfaces, and known images or objects
     using (var arConfiguration = new ARWorldTrackingConfiguration
     {
         PlaneDetection = ARPlaneDetection.Horizontal,
         LightEstimationEnabled = true
     })
         // Run the AR session
         sceneView.Session.Run(arConfiguration, ARSessionRunOptions.ResetTracking);
 }
Esempio n. 26
0
        protected override void Start()
        {
            CreateArScene();

            arSessionDelegate = new UrhoARSessionDelegate(this);
            ARSession         = new ARSession()
            {
                Delegate = arSessionDelegate
            };
            var config = new ARWorldTrackingConfiguration();

            config.PlaneDetection = ARPlaneDetection.Horizontal;
            ARSession.Run(config, ARSessionRunOptions.RemoveExistingAnchors);
        }
Esempio n. 27
0
        public void StartNavigating()
        {
            // Create a session configuration
            var configuration = new ARWorldTrackingConfiguration
            {
                PlaneDetection         = ARPlaneDetection.Horizontal,
                LightEstimationEnabled = true
            };

            // Run the view's session
            SceneView.Session.Run(configuration, ARSessionRunOptions.ResetTracking);

            StartOrResetTimer();
        }
        public override void ViewWillAppear(bool animated)
        {
            base.ViewWillAppear(animated);

            // Create a session configuration
            var configuration = new ARWorldTrackingConfiguration {
                PlaneDetection         = ARPlaneDetection.Horizontal,
                LightEstimationEnabled = true
            };

            // Run the view's session
            SceneView.Session.Run(configuration, ARSessionRunOptions.ResetTracking);

            // randomly choose a point to place the Earth
            var pos = new SCNVector3(-2f, 0f, -2f);


            // earth r=0.2
            var globe     = SCNSphere.Create(0.2f);
            var globeNode = new SCNNode {
                Position = pos, Geometry = globe
            };

            globeNode.Geometry.Materials = LoadMaterials();
            //globeNode.Transform = SCNMatrix4.CreateRotationX(0.4101524f); // 23.5 degrees
            SceneView.Scene.RootNode.AddChildNode(globeNode);

            globeNode.RunAction(SCNAction.RepeatActionForever(SCNAction.RotateBy(0, 1, 0, 3)));


            //moon r=0.08, orbit=0.6
            var pivotNode = new SCNNode {
                Position = new SCNVector3(0, 0, 0)
            };

            pivotNode.RunAction(SCNAction.RepeatActionForever(SCNAction.RotateBy(0, 1, 0, 5)));

            var moon     = SCNSphere.Create(0.08f);
            var moonNode = new SCNNode {
                Geometry = moon
            };

            //moonNode.Position = new SCNVector3(pos.X - 0.6f, pos.Y + 0.1f, pos.Z);
            moonNode.Position           = new SCNVector3(0.6f, 0.1f, pos.Z);
            moonNode.Geometry.Materials = LoadMoonMaterials();
            pivotNode.AddChildNode(moonNode);

            globeNode.AddChildNode(pivotNode);
        }
Esempio n. 29
0
        public override void ViewWillAppear(bool animated)
        {
            base.ViewWillAppear(animated);

            //ADD BACK BUTTON THEN UNCOMMENT THIS
            this.NavigationController.SetNavigationBarHidden(true, true);

            // Configure ARKit
            ARWorldTrackingConfiguration config = new ARWorldTrackingConfiguration
            {
                PlaneDetection = ARPlaneDetection.Horizontal
            };

            // This method is called subsequent to `ViewDidLoad` so we know `scnView` is instantiated
            this.scnView.Session.Run(config, ARSessionRunOptions.RemoveExistingAnchors);
        }
Esempio n. 30
0
        private void RunSession()
        {
            config?.Dispose();
            sceneView?.Delegate?.Dispose();

            config = new ARWorldTrackingConfiguration();
            config.AutoFocusEnabled             = true;
            config.PlaneDetection               = ARPlaneDetection.Horizontal | ARPlaneDetection.Vertical;
            config.LightEstimationEnabled       = true;
            config.WorldAlignment               = ARWorldAlignment.GravityAndHeading;
            config.DetectionImages              = ARReferenceImage.GetReferenceImagesInGroup("AR Resources", null);
            config.MaximumNumberOfTrackedImages = 1;

            sceneView.Session.Run(config, ARSessionRunOptions.ResetTracking | ARSessionRunOptions.RemoveExistingAnchors);
            sceneView.Delegate = new IrScnDelegate();
        }