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); }
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"); } }
public override void WasInterrupted(ARSession session) { // pause session session.Pause(); // specify that existing tracking should be discarded var opts = ARSessionRunOptions.RemoveExistingAnchors | ARSessionRunOptions.ResetTracking; // restart session session.Run(session.Configuration, opts); }
private void StartTrackingFace() { var session = new ARSession(); session.Delegate = this; var faceTrackingConfig = new ARFaceTrackingConfiguration(); faceTrackingConfig.LightEstimationEnabled = true; currentSession = session; session.Run(faceTrackingConfig, ARSessionRunOptions.ResetTracking); }
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); }
public override void DidFail(ARSession session, NSError error) { if (error.Code == 102) { session.Pause(); session.Run(new ARWorldTrackingConfiguration { AutoFocusEnabled = true, PlaneDetection = ARPlaneDetection.Horizontal, LightEstimationEnabled = true, WorldAlignment = ARWorldAlignment.Gravity }, ARSessionRunOptions.ResetTracking | ARSessionRunOptions.RemoveExistingAnchors); } }
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"); } }
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"); } }
private void RunSession() { var faceTrackingConfig = new ARFaceTrackingConfiguration(); currentSession.Run(faceTrackingConfig, ARSessionRunOptions.RemoveExistingAnchors); }