public void OnAnchorFound(ARAnchor arAnchor, ARNode arNode) { // Spawn a visual plane if a PlaneAnchor was found if (arAnchor.GetType() == ARAnchor.Type.Plane) { var planeAnchor = (ARPlaneAnchor)arAnchor; // Create the visual geometry representing this plane var dimensions = planeAnchor.Extent; var plane = new ViroCore.Surface(1, 1) { Width = dimensions.X, Height = dimensions.Z }; // Set a default material for this plane. var material = new Material { DiffuseColor = Color.ParseColor("#BF000000") }; plane.Materials = new List <Material>() { material }; // Attach it to the node var planeNode = new Node { Geometry = plane }; planeNode.SetRotation(new Vector(-Math.ToRadians(90.0), 0, 0)); planeNode.SetPosition(planeAnchor.Center); // Attach this planeNode to the anchor's arNode arNode.AddChildNode(planeNode); surfaces.Add(arAnchor.AnchorId, planeNode); // Attach click listeners to be notified upon a plane onClick. planeNode.Click += (s, e) => { foreach (var listener in mPlaneClickListeners) { listener.OnClick(e.P0, e.P1, e.P2); } }; HideIsTrackingLayoutUi(); } }
private void Update3DModelProduct() { // Hide the product if the user has not placed it yet. if (mStatus != TrackStatus.SelectedSurface) { mProductModelGroup.Opacity = 0; return; } if (mHitArNode != null) { return; } mHitArNode = mScene.CreateAnchoredNode(mCrosshairModel.PositionRealtime); mHitArNode.AddChildNode(mProductModelGroup); mProductModelGroup.Opacity = 1; }