public override void ViewWillAppear(bool animated)
        {
            base.ViewWillAppear(animated);

            // Create a session configuration
            var configuration = new ARWorldTrackingSessionConfiguration()
            {
                PlaneDetection         = ARPlaneDetection.Horizontal,
                LightEstimationEnabled = true
            };

            // Run the view's session
            SceneView.Session.Run(configuration);


            // Find the ship and position it just in front of the camera
            var ship = SceneView.Scene.RootNode.FindChildNode("ship", true);


            ship.Position = new SCNVector3(2f, -2f, -9f);
            //HACK: to see the jet move (circle around the viewer in a roll), comment out the ship.Position line above
            // and uncomment the code below (courtesy @lobrien)

            //var animation = SCNAction.RepeatActionForever(SCNAction.RotateBy(0, (float)Math.PI, (float)Math.PI, (float)1));
            //var pivotNode = new SCNNode { Position = new SCNVector3(0.0f, 2.0f, 0.0f) };
            //pivotNode.RunAction(SCNAction.RepeatActionForever(SCNAction.RotateBy(0, -2, 0, 10)));
            //ship.RemoveFromParentNode();
            //pivotNode.AddChildNode(ship);
            //SceneView.Scene.RootNode.AddChildNode(pivotNode);
            //ship.Scale = new SCNVector3(0.1f, 0.1f, 0.1f);
            //ship.Position = new SCNVector3(2f, -2f, -3f);
            //ship.RunAction(SCNAction.RepeatActionForever(SCNAction.RotateBy(0, 0, 2, 1)));

            //ENDHACK
        }
Example #2
0
        public override void ViewWillAppear(bool animated)
        {
            base.ViewWillAppear(animated);

            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);



            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);
        }
Example #3
0
        public override void ViewWillAppear(bool animated)
        {
            base.ViewWillAppear(animated);

            var config = new ARWorldTrackingSessionConfiguration {
                PlaneDetection         = ARPlaneDetection.Horizontal,
                WorldAlignment         = ARWorldAlignment.Gravity,
                LightEstimationEnabled = true,
            };

            sceneView.Session.Run(config);
        }