Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
ARKit issue.cs
using System;
using System.Diagnostics;
using System.Linq;
using ARKit;
using UIKit;
namespace ArPlaneAnchorIssue
{
public partial class ViewController : UIViewController
{
protected ViewController(IntPtr handle) : base(handle)
{
// Note: this .ctor should not contain any initialization logic.
}
public override void ViewDidLoad()
{
base.ViewDidLoad();
ARSession session = new ARSession();
session.Delegate = new MyArDelegate();
session.Run(new ARWorldTrackingConfiguration() { PlaneDetection = ARPlaneDetection.Horizontal },
ARSessionRunOptions.RemoveExistingAnchors);
}
public override void DidReceiveMemoryWarning()
{
base.DidReceiveMemoryWarning();
// Release any cached data, images, etc that aren't in use.
}
}
public class MyArDelegate : ARSessionDelegate
{
public override void DidAddAnchors(ARSession session, ARAnchor[] anchors)
{
foreach (var anchor in anchors.OfType<ARPlaneAnchor>())
{
var center = anchor.Center;
var extent = anchor.Extent;
Debug.WriteLine($"Center: {center}; Extent: {extent}");
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.