コード例 #1
0
        public CaraBuilder CaraY()
        {
            var centroCaraY      = HallarCentroDeCara("y");
            var centroCaraMenosZ = HallarCentroDeCara("-z");
            var centroCaraZ      = HallarCentroDeCara("z");
            var centroCaraX      = HallarCentroDeCara("x");
            var centroCaraMenosX = HallarCentroDeCara("-x");

            // RAYOS MAS ALEJADOS, MENOS Z
            var rayoCaraY    = new RayoY(new TGCVector3(centroCaraY.X, centroCaraY.Y, centroCaraMenosZ.Z), new TGCVector3(0, 1, 0));
            var rayoIzqCaraY = new RayoY(new TGCVector3(mesh.BoundingBox().PMax.X, centroCaraY.Y, centroCaraMenosZ.Z), new TGCVector3(0, 1, 0));
            var rayoDerCaraY = new RayoY(new TGCVector3(mesh.BoundingBox().PMin.X, centroCaraY.Y, centroCaraMenosZ.Z), new TGCVector3(0, 1, 0));

            rayos.Add(rayoCaraY);
            rayos.Add(rayoIzqCaraY);
            rayos.Add(rayoDerCaraY);

            // RAYOS MAS CERCANOS, Z
            var rayoCaraYMasAdelante    = new RayoY(new TGCVector3(centroCaraY.X, centroCaraY.Y, centroCaraZ.Z), new TGCVector3(0, 1, 0));
            var rayoIzqCaraYMasAdelante = new RayoY(new TGCVector3(mesh.BoundingBox().PMax.X, centroCaraY.Y, centroCaraZ.Z), new TGCVector3(0, 1, 0));
            var rayoDerCaraYMasAdelante = new RayoY(new TGCVector3(mesh.BoundingBox().PMin.X, centroCaraY.Y, centroCaraZ.Z), new TGCVector3(0, 1, 0));

            rayos.Add(rayoCaraYMasAdelante);
            rayos.Add(rayoIzqCaraYMasAdelante);
            rayos.Add(rayoDerCaraYMasAdelante);

            // RAYOS DEL MEDIO
            var rayoCaraYMasAtras    = new RayoY(new TGCVector3(centroCaraY.X, centroCaraY.Y, centroCaraX.Z), new TGCVector3(0, 1, 0));
            var rayoIzqCaraYMasAtras = new RayoY(new TGCVector3(mesh.BoundingBox().PMax.X, centroCaraY.Y, centroCaraX.Z), new TGCVector3(0, 1, 0));
            var rayoDerCaraYMasAtras = new RayoY(new TGCVector3(mesh.BoundingBox().PMin.X, centroCaraY.Y, centroCaraX.Z), new TGCVector3(0, 1, 0));

            rayos.Add(rayoCaraYMasAtras);
            rayos.Add(rayoIzqCaraYMasAtras);
            rayos.Add(rayoDerCaraYMasAtras);

            // RAYOS DIAGONALES:
            var rayoCaraYAbajoIzq     = new RayoY(new TGCVector3((centroCaraX.X + centroCaraY.X) / 2, centroCaraY.Y, (centroCaraZ.Z + centroCaraY.Z) / 2), new TGCVector3(0, 1, 0));
            var rayoIzqCaraYAbajoDer  = new RayoY(new TGCVector3((centroCaraY.X + centroCaraMenosX.X) / 2, centroCaraY.Y, (centroCaraZ.Z + centroCaraY.Z) / 2), new TGCVector3(0, 1, 0));
            var rayoDerCaraYArribaIzq = new RayoY(new TGCVector3((centroCaraX.X + centroCaraY.X) / 2, centroCaraY.Y, (centroCaraY.Z + centroCaraMenosZ.Z) / 2), new TGCVector3(0, 1, 0));
            var rayoDerCaraYArribaDer = new RayoY(new TGCVector3((centroCaraY.X + centroCaraMenosX.X) / 2, centroCaraY.Y, (centroCaraY.Z + centroCaraMenosZ.Z) / 2), new TGCVector3(0, 1, 0));

            rayos.Add(rayoCaraYAbajoIzq);
            rayos.Add(rayoIzqCaraYAbajoDer);
            rayos.Add(rayoDerCaraYArribaIzq);
            rayos.Add(rayoDerCaraYArribaDer);

            caraConstructor = (mesh, accionesAnteColision, rayos) => new CaraY(mesh, accionesAnteColision, rayos);

            return(this);
        }
コード例 #2
0
        public CaraBuilder CaraMenosY()
        {
            var centroCaraMenosY = HallarCentroDeCara("-y");

            var rayoCaraMenosY    = new RayoY(centroCaraMenosY, new TGCVector3(0, -1, 0));
            var rayoIzqCaraMenosY = new RayoY(new TGCVector3(mesh.BoundingBox().PMax.X, centroCaraMenosY.Y, centroCaraMenosY.Z), new TGCVector3(0, -1, 0));
            var rayoDerCaraMenosY = new RayoY(new TGCVector3(mesh.BoundingBox().PMin.X, centroCaraMenosY.Y, centroCaraMenosY.Z), new TGCVector3(0, -1, 0));

            rayos.Add(rayoCaraMenosY);
            rayos.Add(rayoIzqCaraMenosY);
            rayos.Add(rayoDerCaraMenosY);

            caraConstructor = (mesh, accionesAnteColision, rayos) => new CaraY(mesh, accionesAnteColision, rayos);

            return(this);
        }