public override void ViewDidAppear(bool animated) { base.ViewDidAppear(animated); sceneView.Session.Run(new ARWorldTrackingConfiguration { AutoFocusEnabled = true, LightEstimationEnabled = true, PlaneDetection = ARPlaneDetection.Horizontal, WorldAlignment = ARWorldAlignment.Gravity }, ARSessionRunOptions.ResetTracking | ARSessionRunOptions.RemoveExistingAnchors); ImageNode imageNode = new ImageNode("Xamagon.png", size, size); imageNode.Position = new SCNVector3(0, 0, zPosition / 2); sceneView.Scene.RootNode.AddChildNode(imageNode); UITapGestureRecognizer tapGestureRecognizer = new UITapGestureRecognizer(HandleTapGesture); sceneView.AddGestureRecognizer(tapGestureRecognizer); UIPinchGestureRecognizer pinchGestureRecognizer = new UIPinchGestureRecognizer(HandlePinchGesture); sceneView.AddGestureRecognizer(pinchGestureRecognizer); }
public override void ViewDidAppear(bool animated) { base.ViewDidAppear(animated); sceneView.Session.Run(new ARWorldTrackingConfiguration { AutoFocusEnabled = true, LightEstimationEnabled = true, WorldAlignment = ARWorldAlignment.Gravity }, ARSessionRunOptions.ResetTracking | ARSessionRunOptions.RemoveExistingAnchors); SCNScene scene = SCNScene.FromFile("moon.dae"); SCNNode node = scene.RootNode; node.Position = new SCNVector3(0, 0, -25f); sceneView.Scene.RootNode.AddChildNode(node); UITapGestureRecognizer tapGestureRecognizer = new UITapGestureRecognizer(HandleTapGesture); sceneView.AddGestureRecognizer(tapGestureRecognizer); UIPinchGestureRecognizer pinchGestureRecognizer = new UIPinchGestureRecognizer(HandlePinchGesture); sceneView.AddGestureRecognizer(pinchGestureRecognizer); UIRotationGestureRecognizer rotationGestureRecognizer = new UIRotationGestureRecognizer(HandleRotateGesture); sceneView.AddGestureRecognizer(rotationGestureRecognizer); }
public override void ViewDidLoad() { base.ViewDidLoad(); var modelUrl = NSBundle.MainBundle.GetUrlForResource("HotDogOrNot", "mlmodel"); var compiledModelUrl = MLModel.CompileModel(modelUrl, out var error); if (error == null) { model = MLModel.Create(compiledModelUrl, out error); Console.WriteLine($"MODEL LOADED: {model}"); if (error == null) { var nvModel = VNCoreMLModel.FromMLModel(model, out error); if (error == null) { classificationRequest = new VNCoreMLRequest(nvModel, HandleVNRequest); } } } if (error != null) { Console.WriteLine($"ERROR LOADING MODEL: {error}"); } arkitSupported = ARConfiguration.IsSupported; if (arkitSupported) { arView = new ARSCNView() { Frame = View.Bounds, AutoresizingMask = UIViewAutoresizing.FlexibleDimensions, }; arView.AddGestureRecognizer(new UITapGestureRecognizer(HandleARTapped)); View.AddSubview(arView); } else { imgView = new UIImageView(View.Bounds) { BackgroundColor = UIColor.Black, ContentMode = UIViewContentMode.ScaleAspectFill, UserInteractionEnabled = true, Frame = View.Bounds, AutoresizingMask = UIViewAutoresizing.FlexibleDimensions, }; imgView.AddGestureRecognizer(new UITapGestureRecognizer(HandleImageTapped)); View.AddSubview(imgView); } }
public override void ViewDidLoad() { base.ViewDidLoad(); sceneView = new ARSCNView { Delegate = this }; this.View = sceneView; sceneView.ShowsStatistics = true; var tapGestureRecognizer = new UITapGestureRecognizer(HandleTap); sceneView.AddGestureRecognizer(tapGestureRecognizer); }
public override void ViewDidLoad() { base.ViewDidLoad(); scnView = new ARSCNView() { Frame = this.View.Frame, Delegate = new ARDelegate(), //DebugOptions = ARSCNDebugOptions.ShowFeaturePoints | ARSCNDebugOptions.ShowWorldOrigin, UserInteractionEnabled = true }; this.View.AddSubview(scnView); var tapGesture = new UITapGestureRecognizer(TapAction); // UITapGestureRecognizer(target: self, action: #selector(showVirtualObjectSelectionViewController)) // tapGesture. //tapGesture.delegate = self scnView.AddGestureRecognizer(tapGesture); }