Пример #1
0
        public override void OnNodeAddedForAnchor(ISCNSceneRenderer renderer, SCNNode node, ARAnchor anchor)
        {
            base.OnNodeAddedForAnchor(renderer, node, anchor);

            SoundManager.PlaySound("miss");

            var imageAnchor = anchor as ARImageAnchor;
            var refSize     = imageAnchor.ReferenceImage.PhysicalSize;
            var box         = new SCNBox
            {
                Width         = refSize.Width * 1.75f,
                Length        = refSize.Height * 1.75f,
                Height        = 0.0001f,
                ChamferRadius = 0
            };

            box.FirstMaterial.Diffuse.Contents = ShaderScene.Random();
            box.TileTexture(3);

            var pf = Prefabs[i++];

            node.AddChildNode(new SCNNode {
                Geometry = box
            });
            node.AddChildNode(pf);

            pf.Position = SCNVector3.Zero;
            pf.RunAction(SCNAction.RotateBy(0, 1.5f, 0, 0.01));
        }
        public override void OnNodeAddedForAnchor(ISCNSceneRenderer renderer, SCNNode node, ARAnchor anchor)
        {
            base.OnNodeAddedForAnchor(renderer, node, anchor);

            var plane = node.ChildNodes.First();

            plane.Geometry.FirstMaterial.Diffuse.Contents = ShaderScene.Random();
            plane.Geometry.TileTexture(2);
        }
        public override void OnNodeAddedForAnchor(
            ISCNSceneRenderer renderer, SCNNode node, ARAnchor anchor)
        {
            base.OnNodeAddedForAnchor(renderer, node, anchor);

            if (anchor is ARPlaneAnchor planeAnchor)
            {
                var plane = node.ChildNodes.First();
                plane.Geometry.FirstMaterial.Diffuse.Contents = ShaderScene.Random();
                plane.Geometry.TileTexture(2);
            }

            if (anchor is ARFaceAnchor faceAnchor)
            {
                foreach (var child in node.ChildNodes)
                {
                    child.RemoveFromParentNode();
                }

                AddFaceToNode(node);
            }
        }