public override void OnGestureTapped()
        {
            if (positionIsSelected)
            {
                ThrowBall();
            }

            if (!playStarted)
            {
                Ray cameraRay = LeftCamera.GetScreenRay(0.5f, 0.5f);
                var result    = Scene.GetComponent <Octree>().RaycastSingle(cameraRay, RayQueryLevel.Triangle, 100, DrawableFlags.Geometry, 0x70000000);
                if (result != null)
                {
                    if (result.Value.Node.Name.StartsWith("playNode"))
                    {
                        startNode.Remove();
                        startNode = null;
                        MakeHoop(result.Value.Position);
                        playStarted = true;
                    }
                }
            }
            else
            {
                if (surfaceIsValid && !positionIsSelected)
                {
                    positionIsSelected = true;
                    textNode.Remove();
                    textNode = null;
                    bucketNode.GetComponent <StaticModel>().ApplyMaterialList("Models/baskethoop.txt");
                    MakeCollissionHoop();
                    MakeGameDetailScreen();
                }
                else
                {
                    Ray cameraRay = LeftCamera.GetScreenRay(0.5f, 0.5f);
                    var result    = Scene.GetComponent <Octree>().RaycastSingle(cameraRay, RayQueryLevel.Triangle, 100, DrawableFlags.Geometry, 0x70000000);
                    if (result != null)
                    {
                        if (restartNode != null)
                        {
                            System.Diagnostics.Debug.WriteLine("result.Value.Node.Name " + result.Value.Node.Name);
                            System.Diagnostics.Debug.WriteLine("result.Value.Position " + result.Value.Position);
                            //System.Diagnostics.Debug.WriteLine("restartNode.WorldPosition " + LeftCamera.WorldToScreenPoint(restartNode.WorldPosition));
                        }

                        if (result.Value.Node.Name.StartsWith("restartNode"))
                        {
                            System.Diagnostics.Debug.WriteLine("restartNode");
                        }
                    }
                }
            }

            base.OnGestureTapped();
        }
Beispiel #2
0
        Vector3?Raycast()
        {
            Ray cameraRay = LeftCamera.GetScreenRay(0.5f, 0.5f);
            var result    = Scene.GetComponent <Octree>().RaycastSingle(cameraRay, RayQueryLevel.Triangle, 100, DrawableFlags.Geometry, 0x70000000);

            if (result != null)
            {
                return(result.Value.Position);
            }
            return(null);
        }
        public Mat ReadDepth( )
        {
            Mat leftFrame  = LeftCamera.ReadOriginal().Remap(LeftMapX, LeftMapY);
            Mat rightFrame = RightCamera.ReadOriginal().Remap(RightMapX, RightMapY);

            Mat disparity = new Mat();

            Stereo.Compute(leftFrame, rightFrame, disparity);

            Mat depth = new Mat();

            Cv2.ReprojectImageTo3D(disparity, depth, DisparityToDepthMappingMatrix);

            return(depth);
        }
Beispiel #4
0
        private RayQueryResult?Raycast()
        {
            Ray cameraRay = LeftCamera.GetScreenRay(0.5f, 0.5f);

            return(Scene.GetComponent <Octree>().RaycastSingle(cameraRay, RayQueryLevel.Triangle, 100, DrawableFlags.Geometry, 0x70000000));
        }