示例#1
0
        public void Run(bool runEngineFramesInArkitCallbacks = true)
        {
            if (Camera == null)
            {
                throw new InvalidOperationException("Camera was not set.");
            }

            if (runEngineFramesInArkitCallbacks && !Application.Options.DelayedStart)
            {
                throw new InvalidOperationException("ApplicationOptions.DelayedStart should be true if runEngineFramesInArkitCallbacks flag is set");
            }

            arSessionDelegate = new UrhoARSessionDelegate(this, runEngineFramesInArkitCallbacks);
            ARSession         = new ARSession {
                Delegate = arSessionDelegate
            };
            ARConfiguration = ARConfiguration ?? new ARWorldTrackingConfiguration();
            ARConfiguration.LightEstimationEnabled = true;
            ARSession.Run(ARConfiguration, ARSessionRunOptions.RemoveExistingAnchors);

            if ((Orientation == UIInterfaceOrientation.LandscapeRight ||
                 Orientation == UIInterfaceOrientation.LandscapeLeft) && ARConfiguration is ARFaceTrackingConfiguration)
            {
                throw new Exception("ARFaceTrackingConfiguration in landscape is not supported");
            }
        }
示例#2
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);
        }
示例#3
0
        public void Run(Camera camera = null)
        {
            if (Camera == null)
            {
                Camera = base.Scene.GetComponent <Camera>(true);
            }
            if (Camera == null)
            {
                throw new InvalidOperationException("Camera was not set.");
            }

            if (RunEngineFramesInARKitCallbakcs && !Application.Options.DelayedStart)
            {
                throw new InvalidOperationException("ApplicationOptions.DelayedStart should be true if runEngineFramesInArkitCallbacks flag is set");
            }

            if (Orientation == null)
            {
                Orientation = base.Application.Options.Orientation == ApplicationOptions.OrientationType.Landscape ?
                              UIInterfaceOrientation.LandscapeRight :
                              UIInterfaceOrientation.Portrait;
            }

            arSessionDelegate = new UrhoARSessionDelegate(this, RunEngineFramesInARKitCallbakcs);
            ARSession         = new ARSession {
                Delegate = arSessionDelegate
            };
            ARConfiguration = ARConfiguration ?? new ARWorldTrackingConfiguration();
            ARSession.Run(ARConfiguration, ARSessionRunOptions.RemoveExistingAnchors);

            if (base.Application is SimpleApplication simpleApp)
            {
                simpleApp.MoveCamera = false;
            }

            if ((Orientation == UIInterfaceOrientation.LandscapeRight ||
                 Orientation == UIInterfaceOrientation.LandscapeLeft) && ARConfiguration is ARFaceTrackingConfiguration)
            {
                throw new Exception("ARFaceTrackingConfiguration in landscape is not supported");
            }
        }
示例#4
0
        public void Run()
        {
            if (Camera == null)
            {
                throw new InvalidOperationException("Camera was not set.");
            }

            arSessionDelegate = new UrhoARSessionDelegate(this);
            ARSession         = new ARSession {
                Delegate = arSessionDelegate
            };
            ARConfiguration = ARConfiguration ?? new ARWorldTrackingConfiguration();
            ARConfiguration.LightEstimationEnabled = true;
            ARSession.Run(ARConfiguration, ARSessionRunOptions.RemoveExistingAnchors);

            if ((Orientation == UIInterfaceOrientation.LandscapeRight ||
                 Orientation == UIInterfaceOrientation.LandscapeLeft) && ARConfiguration is ARFaceTrackingConfiguration)
            {
                throw new Exception("ARFaceTrackingConfiguration in landscape is not supported");
            }
        }