Exemplo n.º 1
0
        public override void init()
        {
            Device d3dDevice = GuiController.Instance.D3dDevice;

            //Cargar modelo
            TgcSceneLoader loader = new TgcSceneLoader();
            TgcScene       scene  = loader.loadSceneFromFile(
                GuiController.Instance.ExamplesMediaDir + "MeshCreator\\Meshes\\Vehiculos\\StarWars-ATST\\StarWars-ATST-TgcScene.xml");

            mesh = scene.Meshes[0];

            //Computar OBB a partir del AABB del mesh. Inicialmente genera el mismo volumen que el AABB, pero luego te permite rotarlo (cosa que el AABB no puede)
            obb = TgcObb.computeFromAABB(mesh.BoundingBox);

            //Otra alternativa es computar OBB a partir de sus vertices. Esto genera un OBB lo mas apretado posible pero es una operacion costosa
            //obb = TgcObb.computeFromPoints(mesh.getVertexPositions());



            //Alejar camara rotacional segun tamaño del BoundingBox del objeto
            GuiController.Instance.RotCamera.targetObject(mesh.BoundingBox);


            //Modifier para poder rotar y mover el mesh
            GuiController.Instance.Modifiers.addFloat("rotation", 0, 360, 0);
            GuiController.Instance.Modifiers.addVertex3f("position", new Vector3(0, 0, 0), new Vector3(50, 50, 50), new Vector3(0, 0, 0));
        }
        public HollowObbCollider(TgcBoundingBox bb, Vector3 translation, Vector3 minCornerScale, Vector3 maxCornerScale)
        {
            var obb = TgcObb.computeFromAABB(bb);

            _HollowObbCollider(obb, translation, minCornerScale, maxCornerScale);
            obb.dispose();
        }
        public HollowObbCollider(TgcMesh mesh, Vector3 minCornerScale, Vector3 maxCornerScale)
        {
            var obb = TgcObb.computeFromAABB(mesh.BoundingBox);

            _HollowObbCollider(obb, obb.Center - mesh.Position, minCornerScale, maxCornerScale);
            obb.dispose();
        }
Exemplo n.º 4
0
 public Checkpoint(float x, float z, float y, TgcMesh _modelo)
 {
     _modelo.Position  = new Vector3(x, y, z);
     this.modelo       = _modelo;
     this.modelo.Scale = new Vector3(5, 5, 5);
     this.obb          = TgcObb.computeFromAABB(this.modelo.BoundingBox);
 }
Exemplo n.º 5
0
 public ObstaculoRigido(string _pathMesh, Vector3 _posicion, Vector3 _escala)
 {
     this.mesh          = MeshUtils.loadMesh(_pathMesh);
     this.mesh.Position = _posicion;
     this.mesh.Scale    = _escala;
     this.obb           = TgcObb.computeFromAABB(this.mesh.BoundingBox);
 }
Exemplo n.º 6
0
        public override void init()
        {
            Microsoft.DirectX.Direct3D.Device d3dDevice = GuiController.Instance.D3dDevice;

            //Cuerpo principal que se controla con el teclado
            box = TgcBox.fromSize(new Vector3(0, 10, 0), new Vector3(10, 10, 10), Color.Blue);

            //triangulo
            triangle    = new CustomVertex.PositionColored[3];
            triangle[0] = new CustomVertex.PositionColored(-100, 0, 0, Color.Red.ToArgb());
            triangle[1] = new CustomVertex.PositionColored(0, 0, 50, Color.Green.ToArgb());
            triangle[2] = new CustomVertex.PositionColored(0, 100, 0, Color.Blue.ToArgb());
            triagleAABB = TgcBoundingBox.computeFromPoints(new Vector3[] { triangle[0].Position, triangle[1].Position, triangle[2].Position });

            //box2
            box2 = TgcBox.fromSize(new Vector3(-50, 10, -20), new Vector3(15, 15, 15), Color.Violet);

            //sphere
            sphere = new TgcBoundingSphere(new Vector3(30, 20, -20), 15);

            //OBB: computar OBB a partir del AABB del mesh.
            TgcSceneLoader loader  = new TgcSceneLoader();
            TgcMesh        meshObb = loader.loadSceneFromFile(GuiController.Instance.ExamplesMediaDir + "MeshCreator\\Meshes\\Vehiculos\\StarWars-ATST\\StarWars-ATST-TgcScene.xml").Meshes[0];

            obb = TgcObb.computeFromAABB(meshObb.BoundingBox);
            meshObb.dispose();
            obb.move(new Vector3(100, 0, 30));
            obb.setRotation(new Vector3(0, FastMath.PI / 4, 0));


            //Configurar camara en Tercer Persona
            GuiController.Instance.ThirdPersonCamera.Enable = true;
            GuiController.Instance.ThirdPersonCamera.setCamera(box.Position, 30, -75);
        }
Exemplo n.º 7
0
        // Constructor
        public ObstaculoRigido(float _x, float _z, float _y, float ancho, float alto, float largo, string textura)
        {
            TgcBox box = TgcBox.fromSize(
                new Vector3(_x, _z, _y),           //posicion
                new Vector3(ancho, alto, largo),   //tamaño
                TgcTexture.createTexture(textura));

            //Computar OBB a partir del AABB del mesh. Inicialmente genera el mismo volumen que el AABB, pero luego te permite rotarlo (cosa que el AABB no puede)
            this.obb  = TgcObb.computeFromAABB(box.BoundingBox);
            this.mesh = box.toMesh("caja");
        }
Exemplo n.º 8
0
        public void reiniciar()
        {
            Vector3 posicionInicio = posicionInicial;

            this.velocidadActual   = 0;
            this.velocidadRotacion = velocidadRotacionOriginal;
            restaurarVertices();
            this.velocidadMaxima = this.velocidadMaximaInicial;
            this.mesh.Rotation   = rotacionInicial;
            this.mesh.Position   = posicionInicio;
            this.obb             = TgcObb.computeFromAABB(this.mesh.BoundingBox);
        }
Exemplo n.º 9
0
        public Cannon()
        {
            var bodyMesh = Game.Current.GetMesh("Cannon");

            _LoadColider = new ObbCollider()
            {
                Extents = _LoadColiderExtents,
                Color   = ItemPart.DefaultPartColor,
            };
            Add(_LoadColider as ItemPart);
            Add(new MeshStaticPart(bodyMesh));
            var bodyObb = TgcObb.computeFromAABB(bodyMesh.BoundingBox);
            var bodyE   = bodyObb.Extents;

            bodyObb.Extents = new Vector3(bodyE.X * _BodyObbScaleY, bodyE.Y, bodyE.Z * _BodyObbScaleY);
            Add(new HollowObbCollider(bodyObb, bodyObb.Position - bodyMesh.Position, _MinBorderScale, _MaxBorderScale));
            bodyObb.dispose();

            var baseMesh = Game.Current.GetMesh("CannonBase");
            var baseObb  = TgcObb.computeFromAABB(baseMesh.BoundingBox);
            var baseE    = baseObb.Extents;

            baseObb.Extents   = new Vector3(baseE.X, baseE.Y * _BaseObbScaleY, baseE.Z);
            Add(_Base         = new MeshUnRotatedPart(baseMesh));
            Add(_BaseCollider = new ObbTranslatedUnRotatedCollider(baseObb, _BaseObbTranslation));

            Add(_Smoke = new TranslatedParticlePart()
            {
                Translation = new Vector3(0, 33, -4),
                Sound       = Game.Current.GetSound("Cannon.wav", EffectVolume),
                Animation   = new AnimatedQuad()
                {
                    Texture      = Game.Current.GetParticle("ExplosionGrey.png"),
                    FrameSize    = new Size(146, 146),
                    Size         = new Vector2(25, 25),
                    FirstFrame   = 2,
                    CurrentFrame = 2,
                    FrameRate    = 15,
                    TotalFrames  = 47,
                }
            });
            RotationChanged += Cannon_RotationChanged;
            _ChargeSound     = Game.Current.GetSound("CannonCharge.wav", 0);
        }
Exemplo n.º 10
0
        public Auto(string pathMeshAuto, string _nombre, Vector3 _posicionInicial, float _velocidadMaxima, float _velocidadRotacion, float _aceleracion, float _masa, Vector3 _escala, Vector3 _rotacionInicial)
        {
            this.nombre          = _nombre;
            this.posicionInicial = _posicionInicial;
            this.mesh            = MeshUtils.loadMesh(pathMeshAuto);
            // sceneAuto = loadMesh(pathMeshAuto);
            //this.mesh = sceneAuto.Meshes[0];
            this.mesh.Scale      = _escala;
            this.rotacionInicial = _rotacionInicial;
            this.backupVertices();
            this.velocidadActual           = 0;
            this.velocidadMaxima           = _velocidadMaxima;
            this.velocidadMaximaInicial    = _velocidadMaxima;
            this.velocidadRotacion         = _velocidadRotacion;
            this.velocidadRotacionOriginal = _velocidadRotacion;
            this.masa        = _masa;
            this.aceleracion = _aceleracion;
            //Computar OBB a partir del AABB del mesh. Inicialmente genera el mismo volumen que el AABB, pero luego te permite rotarlo (cosa que el AABB no puede)
            this.obb = TgcObb.computeFromAABB(this.mesh.BoundingBox);

            this.puntoChoque = this.obb.Center;
            this.direccion   = new TgcArrow();
            direccion.PStart = this.obb.Center;
            Vector3 rotacion = this.mesh.Rotation;

            direccion.PEnd = this.obb.Center + Vector3.Multiply(new Vector3(rotacion.X, rotacion.Y, rotacion.Z), 500f);

            //// acá defino un mesh auxiliar para probar con el Debug mode
            string         sphere = GuiController.Instance.ExamplesMediaDir + "ModelosTgc\\Sphere\\Sphere-TgcScene.xml";
            TgcSceneLoader loader = new TgcSceneLoader();

            moon       = loader.loadSceneFromFile(sphere).Meshes[0];
            moon.Scale = new Vector3(0.6f, 0.6f, 0.6f);

            //le asignamos una cantidad de chispas cada vez que choca
            for (int i = 0; i < cantidadDeChispas; i++)
            {
                chispas.Add(new Chispa());
            }

            //... y un poco de sonido a los choques
            this.sonidoChoque = new Sonido(Shared.mediaPath + "\\sonidos\\choque.wav");
        }
Exemplo n.º 11
0
        public override void Init()
        {
            //Cargar modelo
            var loader = new TgcSceneLoader();
            var scene  =
                loader.loadSceneFromFile(MediaDir +
                                         "MeshCreator\\Meshes\\Vehiculos\\StarWars-ATST\\StarWars-ATST-TgcScene.xml");

            mesh = scene.Meshes[0];

            //Computar OBB a partir del AABB del mesh. Inicialmente genera el mismo volumen que el AABB, pero luego te permite rotarlo (cosa que el AABB no puede)
            obb = TgcObb.computeFromAABB(mesh.BoundingBox);

            //Otra alternativa es computar OBB a partir de sus vertices. Esto genera un OBB lo mas apretado posible pero es una operacion costosa
            //obb = TgcObb.computeFromPoints(mesh.getVertexPositions());

            //Alejar camara rotacional segun tamaño del BoundingBox del objeto
            Camara = new TgcRotationalCamera(mesh.BoundingBox.calculateBoxCenter(),
                                             mesh.BoundingBox.calculateBoxRadius() * 2);

            //Modifier para poder rotar y mover el mesh
            Modifiers.addFloat("rotation", 0, 360, 0);
            Modifiers.addVertex3f("position", new Vector3(0, 0, 0), new Vector3(50, 50, 50), new Vector3(0, 0, 0));
        }
        public override void Init()
        {
            //Cuerpo principal que se controla con el teclado
            box = TgcBox.fromSize(new Vector3(0, 10, 0), new Vector3(10, 10, 10), Color.Blue);

            //triangulo
            triangle    = new CustomVertex.PositionColored[3];
            triangle[0] = new CustomVertex.PositionColored(-100, 0, 0, Color.Red.ToArgb());
            triangle[1] = new CustomVertex.PositionColored(0, 0, 50, Color.Green.ToArgb());
            triangle[2] = new CustomVertex.PositionColored(0, 100, 0, Color.Blue.ToArgb());
            triagleAABB =
                TgcBoundingBox.computeFromPoints(new[]
                                                 { triangle[0].Position, triangle[1].Position, triangle[2].Position });

            //box2
            box2 = TgcBox.fromSize(new Vector3(-50, 10, -20), new Vector3(15, 15, 15), Color.Violet);

            //sphere
            sphere = new TgcBoundingSphere(new Vector3(30, 20, -20), 15);

            //OBB: computar OBB a partir del AABB del mesh.
            var loader  = new TgcSceneLoader();
            var meshObb =
                loader.loadSceneFromFile(MediaDir +
                                         "MeshCreator\\Meshes\\Vehiculos\\StarWars-ATST\\StarWars-ATST-TgcScene.xml")
                .Meshes[0];

            obb = TgcObb.computeFromAABB(meshObb.BoundingBox);
            meshObb.dispose();
            obb.move(new Vector3(100, 0, 30));
            obb.setRotation(new Vector3(0, FastMath.PI / 4, 0));

            //Configurar camara en Tercer Persona
            camaraInterna = new TgcThirdPersonCamera(box.Position, 30, -75);
            Camara        = camaraInterna;
        }
Exemplo n.º 13
0
 private void init()
 {
     foreach (TgcMesh mesh in escena)
     {
         obb = TgcObb.computeFromAABB(mesh.BoundingBox);
         if (TgcCollisionUtils.testObbAABB(obb, caja1.BoundingBox))
         {
             listaCaja1.Add(mesh);
         }
         if (TgcCollisionUtils.testObbAABB(obb, caja2.BoundingBox))
         {
             listaCaja2.Add(mesh);
         }
         if (TgcCollisionUtils.testObbAABB(obb, caja2.BoundingBox))
         {
             listaCaja2.Add(mesh);
         }
         if (TgcCollisionUtils.testObbAABB(obb, caja3.BoundingBox))
         {
             listaCaja3.Add(mesh);
         }
         if (TgcCollisionUtils.testObbAABB(obb, caja4.BoundingBox))
         {
             listaCaja4.Add(mesh);
         }
         if (TgcCollisionUtils.testObbAABB(obb, caja5.BoundingBox))
         {
             listaCaja5.Add(mesh);
         }
         if (TgcCollisionUtils.testObbAABB(obb, caja6.BoundingBox))
         {
             listaCaja6.Add(mesh);
         }
         if (TgcCollisionUtils.testObbAABB(obb, caja7.BoundingBox))
         {
             listaCaja7.Add(mesh);
         }
         if (TgcCollisionUtils.testObbAABB(obb, caja8.BoundingBox))
         {
             listaCaja8.Add(mesh);
         }
         if (TgcCollisionUtils.testObbAABB(obb, caja9.BoundingBox))
         {
             listaCaja9.Add(mesh);
         }
         if (TgcCollisionUtils.testObbAABB(obb, caja10.BoundingBox))
         {
             listaCaja10.Add(mesh);
         }
         if (TgcCollisionUtils.testObbAABB(obb, caja11.BoundingBox))
         {
             listaCaja11.Add(mesh);
         }
         if (TgcCollisionUtils.testObbAABB(obb, caja12.BoundingBox))
         {
             listaCaja12.Add(mesh);
         }
         if (TgcCollisionUtils.testObbAABB(obb, caja13.BoundingBox))
         {
             listaCaja13.Add(mesh);
         }
         if (TgcCollisionUtils.testObbAABB(obb, caja14.BoundingBox))
         {
             listaCaja14.Add(mesh);
         }
     }
 }
Exemplo n.º 14
0
        public void render(float elapsedTime)
        {
            //moverse y rotar son variables que me indican a qué velocidad se moverá o rotará el mesh respectivamente.
            //Se inicializan en 0, porque por defecto está quieto.

            float moverse = 0f;
            float rotar   = 0f;

            habilitarDecremento = true;

            GuiController.Instance.UserVars.setValue("Velocidad", Math.Abs(auto.velocidadActual));
            GuiController.Instance.UserVars.setValue("Vida", escalaVida.X);
            GuiController.Instance.UserVars.setValue("AngCol", Geometry.RadianToDegree(anguloColision));
            GuiController.Instance.UserVars.setValue("AngRot", Geometry.RadianToDegree(anguloARotar));

            //aumento de la velocidad de rotacion al derrapar
            modificarVelocidadRotacion(auto);

            //Procesa las entradas del teclado.
            if (entrada.keyDown(Key.Q))
            {
                finDeJuego = true;
                salirConQ  = true;
            }

            if (entrada.keyDown(Key.S))
            {
                moverse = auto.irParaAtras(elapsedTime);
            }
            if (entrada.keyDown(Key.W))
            {
                moverse = auto.irParaAdelante(elapsedTime);
            }
            if (entrada.keyDown(Key.A) && (auto.velocidadActual > 0.5f || auto.velocidadActual < -0.5f)) //izquierda
            {
                rotar = -auto.velocidadRotacion;
            }
            if (entrada.keyDown(Key.D) && (auto.velocidadActual > 0.5f || auto.velocidadActual < -0.5f)) //derecha
            {
                rotar = auto.velocidadRotacion;
            }
            if (entrada.keyPressed(Key.M))
            {
                musica.muteUnmute();
                auto.mutearSonido();
            }
            if (entrada.keyPressed(Key.R)) //boton de reset, el mesh vuelve a la posicion de inicio y restaura todos sus parametros
            {
                auto.reiniciar();
                auto.mesh.move(new Vector3(0, 0, -3100));
                auto.mesh.rotateY(-1.57f);
                EjemploAlumno.instance.activar_efecto = false;
                nivel.reiniciar();
                this.reiniciar();
                GuiController.Instance.ThirdPersonCamera.resetValues();
                GuiController.Instance.ThirdPersonCamera.rotateY(-1.57f);
            }
            if (entrada.keyPressed(Key.B)) //Modo debug para visualizar BoundingBoxes entre otras cosas que nos sirvan a nosotros
            {
                Shared.debugMode = !Shared.debugMode;
            }
            if (entrada.keyPressed(Key.I))
            {
                modoDios = !modoDios;
            }

            //Frenado por inercia
            if (!entrada.keyDown(Key.W) && !entrada.keyDown(Key.S) && auto.velocidadActual != 0)
            {
                moverse = auto.frenarPorInercia(elapsedTime);
            }
            if (moverse > auto.velocidadMaxima)
            {
                auto.velocidadActual = auto.velocidadMaxima;
            }
            if (moverse < (-auto.velocidadMaxima))
            {
                auto.velocidadActual = -auto.velocidadMaxima;
            }

            int   sentidoRotacion = 0; //sentido de rotacion del reajuste de camara
            float rotCamara       = GuiController.Instance.ThirdPersonCamera.RotationY;
            float rotAuto         = auto.mesh.Rotation.Y;
            float deltaRotacion   = rotAuto - rotCamara;
            float dif             = FastMath.Abs(Geometry.RadianToDegree(deltaRotacion));
            float rapidez         = 5f; //aceleracion de reajuste de camara

            if (rotar != 0)
            {
                habilitarDecremento = false;
                habilitarContador   = true;
            }
            if (dif < 40)
            {
                if (dif < 30)
                {
                    if (dif < 20)
                    {
                        rapidez = 0.8f;
                    }
                    else
                    {
                        rapidez = 2f;
                    }
                }
                else
                {
                    rapidez = 3f;
                }
            }

            if (habilitarContador)
            {
                pasaronSegundos += elapsedTime;
            }

            if (deltaRotacion < 0)
            {
                sentidoRotacion = -1;
            }
            else
            {
                sentidoRotacion = 1;
            }

            if (deltaRotacion != 0 && pasaronSegundos > 0.5f)
            {
                ajustar           = true;
                pasaronSegundos   = 0f;
                habilitarContador = false;
            }


            float rotAngle = Geometry.DegreeToRadian(rotar * elapsedTime);

            if (ajustar)
            {
                GuiController.Instance.ThirdPersonCamera.rotateY(sentidoRotacion * rapidez * elapsedTime);
            }

            if (deltaRotacion < 0)
            {
                sentidoRotacion = -1;
            }
            else
            {
                sentidoRotacion = 1;
            }
            incrementarTiempo(this, elapsedTime, habilitarDecremento);
            auto.mesh.rotateY(rotAngle);
            auto.obb.rotate(new Vector3(0, rotAngle, 0));
            if (FastMath.Abs(Geometry.RadianToDegree(deltaRotacion)) % 360 < 3)
            {
                GuiController.Instance.ThirdPersonCamera.RotationY = rotAuto;
                ajustar = false;
            }


            if (habilitarDecremento)
            {
                incrementarTiempo(this, elapsedTime, habilitarDecremento);
            }

            if (moverse != 0 || auto.velocidadActual != 0) //Si hubo movimiento
            {
                Vector3 lastPos = auto.mesh.Position;
                auto.mesh.moveOrientedY(moverse * elapsedTime);
                Vector3 position = auto.mesh.Position;
                Vector3 posDiff  = position - lastPos;
                auto.obb.move(posDiff);
                Vector3 direccion = new Vector3(FastMath.Sin(auto.mesh.Rotation.Y) * moverse, 0, FastMath.Cos(auto.mesh.Rotation.Y) * moverse);
                auto.direccion.PEnd = auto.obb.Center + Vector3.Multiply(direccion, 50f);

                //Detectar colisiones de BoundingBox utilizando herramienta TgcCollisionUtils
                bool      collide = false;
                Vector3[] cornersAuto;
                Vector3[] cornersObstaculo;
                foreach (ObstaculoRigido obstaculo in nivel.obstaculos)
                {
                    if (Colisiones.testObbObb2(auto.obb, obstaculo.obb)) //chequeo obstáculo por obstáculo si está chocando con auto
                    {
                        collide              = true;
                        obstaculoChocado     = obstaculo;
                        Shared.mostrarChispa = true;
                        if (FastMath.Abs(auto.velocidadActual) > 800)
                        {
                            auto.reproducirSonidoChoque(FastMath.Abs(auto.velocidadActual));
                            auto.deformarMesh(obstaculo.obb, FastMath.Abs(auto.velocidadActual));
                        }
                        if (FastMath.Abs(auto.velocidadActual) > 800 && !modoDios)
                        {
                            escalaVida.X -= 0.00003f * Math.Abs(auto.velocidadActual) * escalaInicial.X;
                            if (escalaVida.X > 0.03f)
                            {
                                vida.setEscala(new Vector2(escalaVida.X, escalaVida.Y));
                            }
                            else
                            {
                                finDeJuego = true;
                                muerte     = true;
                            }
                        }
                        break;
                    }
                }
                //Si hubo colision, restaurar la posicion anterior (sino sigo de largo)
                if (collide)
                {
                    auto.mesh.Position = lastPos;
                    auto.obb.updateValues();
                    moverse = auto.chocar(elapsedTime);

                    if (FastMath.Abs(auto.velocidadActual) > 0)
                    {
                        cornersAuto      = CalculosVectores.computeCorners(auto);
                        cornersObstaculo = CalculosVectores.computeCorners(obstaculoChocado);
                        List <Plane> carasDelObstaculo = CalculosVectores.generarCaras(cornersObstaculo);
                        Vector3      NormalAuto        = direccion;
                        caraChocada = CalculosVectores.detectarCaraChocada(carasDelObstaculo, auto.puntoChoque);
                        Vector3 NormalObstaculo = new Vector3(caraChocada.A, caraChocada.B, caraChocada.C);
                        GuiController.Instance.UserVars.setValue("NormalObstaculoX", NormalObstaculo.X);
                        GuiController.Instance.UserVars.setValue("NormalObstaculoZ", NormalObstaculo.Z);

                        float desplazamientoInfinitesimal = 5f;
                        float constanteDesvio             = 1.3f;
                        //Calculo el angulo entre ambos vectores
                        anguloColision = CalculosVectores.calcularAnguloEntreVectoresNormalizados(NormalAuto, NormalObstaculo);//Angulo entre ambos vectores
                        //rota mesh
                        if (FastMath.Abs(auto.velocidadActual) > 800)
                        {
                            if (Geometry.RadianToDegree(anguloColision) < 25) //dado un cierto umbral, el coche rebota sin cambiar su direccion
                            {
                                auto.velocidadActual = -auto.velocidadActual;
                            }
                            else //el coche choca y cambia su direccion
                            {
                                if (NormalObstaculo.Z > 0 && direccion.X > 0 && direccion.Z > 0)
                                {
                                    anguloARotar = constanteDesvio * (Geometry.DegreeToRadian(90) - anguloColision);
                                    auto.mesh.move(new Vector3(0, 0, -10));
                                    colorDeColision = Color.Red;
                                }

                                if (NormalObstaculo.X > 0 && direccion.X > 0 && direccion.Z > 0)
                                {
                                    anguloARotar = -constanteDesvio * (Geometry.DegreeToRadian(90) - anguloColision);
                                    auto.mesh.move(new Vector3(-5, 0, 0));
                                    colorDeColision = Color.Salmon;
                                }

                                if (NormalObstaculo.X > 0 && direccion.X > 0 && direccion.Z < 0)
                                {
                                    anguloARotar    = constanteDesvio * (Geometry.DegreeToRadian(90) - anguloColision);
                                    colorDeColision = Color.Blue;
                                    auto.mesh.move(new Vector3(-desplazamientoInfinitesimal, 0, 0));
                                }

                                if (NormalObstaculo.Z < 0 && direccion.X > 0 && direccion.Z < 0)
                                {
                                    anguloARotar = -constanteDesvio * (Geometry.DegreeToRadian(90) - anguloColision);
                                    auto.mesh.move(new Vector3(0, 0, desplazamientoInfinitesimal));
                                    colorDeColision = Color.Green;
                                }

                                if (NormalObstaculo.Z < 0 && direccion.X < 0 && direccion.Z < 0)
                                {
                                    anguloARotar = constanteDesvio * (Geometry.DegreeToRadian(90) - anguloColision);
                                    auto.mesh.move(new Vector3(0, 0, desplazamientoInfinitesimal));
                                    colorDeColision = Color.Pink;
                                }


                                if (NormalObstaculo.X < 0 && direccion.X < 0 && direccion.Z < 0)
                                {
                                    anguloARotar = -constanteDesvio * (Geometry.DegreeToRadian(90) - anguloColision);
                                    auto.mesh.move(new Vector3(desplazamientoInfinitesimal, 0, 0));
                                    colorDeColision = Color.Silver;
                                }

                                if (NormalObstaculo.X < 0 && direccion.X < 0 && direccion.Z > 0)
                                {
                                    anguloARotar = constanteDesvio * (Geometry.DegreeToRadian(90) - anguloColision);
                                    auto.mesh.move(new Vector3(desplazamientoInfinitesimal, 0, 0));
                                    colorDeColision = Color.Aquamarine;
                                }

                                if (NormalObstaculo.Z > 0 && direccion.X < 0 && direccion.Z > 0)
                                {
                                    anguloARotar = -constanteDesvio * (Geometry.DegreeToRadian(90) - anguloColision);
                                    auto.mesh.move(new Vector3(0, 0, -desplazamientoInfinitesimal));
                                    colorDeColision = Color.Yellow;
                                }

                                auto.mesh.rotateY(anguloARotar);
                            }
                        }
                    }
                }

                foreach (Recursos recurso in nivel.recursos)
                {
                    TgcCollisionUtils.BoxBoxResult result = TgcCollisionUtils.classifyBoxBox(auto.mesh.BoundingBox, recurso.modelo.BoundingBox);
                    if (result == TgcCollisionUtils.BoxBoxResult.Adentro || result == TgcCollisionUtils.BoxBoxResult.Atravesando)
                    {
                        nivel.recursos.Remove(recurso); //Saca el recurso de la lista para que no se renderice más
                        float puntos = Convert.ToSingle(this.puntos.Text) + 100f;
                        this.puntos.Text = Convert.ToString(puntos);
                        break;
                    }
                }
                //Chequeo si el auto agarro el checkpoint actual
                if (Colisiones.testObbObb2(auto.obb, nivel.checkpointActual.obb))
                {
                    if (nivel.checkpointsRestantes.Text != "1")
                    {
                        nivel.checkpoints.Remove(nivel.checkpointActual);       //Saca el checkpoint de la lista para que no se renderice más
                        int restantes = (Convert.ToInt16(nivel.checkpointsRestantes.Text) - 1);
                        nivel.checkpointsRestantes.Text = restantes.ToString(); //Le resto uno a los restantes
                        this.tiempoRestante.Text        = (Convert.ToSingle(this.tiempoRestante.Text) + 10f).ToString();
                        nivel.checkpointActual          = nivel.checkpoints.ElementAt(0);
                    }
                    else
                    {
                        finDeJuego = true;
                    }
                }

                //Efecto blur
                if (FastMath.Abs(auto.velocidadActual) > (auto.velocidadMaxima * 0.5555))
                {
                    EjemploAlumno.instance.activar_efecto = true;
                    EjemploAlumno.instance.blur_intensity = 0.003f * (float)Math.Round(FastMath.Abs(auto.velocidadActual) / (auto.velocidadMaxima), 5);
                }
                else
                {
                    EjemploAlumno.instance.activar_efecto = false;
                }
            }
            GuiController.Instance.ThirdPersonCamera.Target = auto.mesh.Position;

            //actualizo cam
            Vector2 vectorCam = (Vector2)GuiController.Instance.Modifiers["AlturaCamara"];

            GuiController.Instance.ThirdPersonCamera.setCamera(auto.mesh.Position, vectorCam.X, vectorCam.Y);

            float tope             = 1f;
            float constanteDerrape = ((tiempoTrans / 2) < tope) ? (tiempoTrans / 2) : tope;
            float proporcion       = FastMath.Abs(auto.velocidadActual / auto.velocidadMaxima);

            if (sentidoAnterior != sentidoRotacion && tiempoTrans != 0)
            {
                incrementarTiempo(this, elapsedTime * 5, true);
            }
            if (tiempoTrans == 0)
            {
                sentidoAnterior = sentidoRotacion;
            }

            auto.mesh.rotateY(constanteDerrape * sentidoAnterior * proporcion);

            auto.render();

            auto.obb = TgcObb.computeFromAABB(auto.mesh.BoundingBox);
            auto.obb.setRotation(auto.mesh.Rotation);
            auto.obb.setRenderColor(colorDeColision);

            auto.mesh.rotateY(-constanteDerrape * sentidoAnterior * proporcion);

            //dibuja el nivel
            nivel.render(elapsedTime);

            //AJUSTE DE CAMARA SEGUN COLISION
            ajustarCamaraSegunColision(auto, nivel.obstaculos);

            //Dibujo checkpoints restantes
            nivel.checkpointsRestantes.render();

            //Dibujo el puntaje del juego
            this.puntos.render();

            //CUENTA REGRESIVA
            if (this.tiempoRestante.Text == "1")
            {
                uno.render();
            }
            if (this.tiempoRestante.Text == "2")
            {
                dos.render();
            }

            if (this.tiempoRestante.Text == "3")
            {
                tres.render();
            }

            //Actualizo y dibujo el relops
            if ((DateTime.Now.Subtract(this.horaInicio).TotalSeconds) > segundosAuxiliares && !modoDios)
            {
                this.tiempoRestante.Text = (Convert.ToDouble(tiempoRestante.Text) - 1).ToString();
                if (this.tiempoRestante.Text == "0") //Si se acaba el tiempo, me muestra el game over y reseetea todo
                {
                    finDeJuego = true;
                    muerte     = true;
                }
                segundosAuxiliares++;
            }
            this.tiempoRestante.render();

            //Si se le acabo el tiempo o la vida, o apretó "Q"
            if (finDeJuego)
            {
                //corta la música al salir
                TgcMp3Player player = GuiController.Instance.Mp3Player;
                player.closeFile();
                GuiController.Instance.UserVars.clearVars();
                //saca el blur
                EjemploAlumno.instance.activar_efecto = false;
                //reinicia los valores de las cosas del juego
                auto.reiniciar();
                nivel.reiniciar();
                this.reiniciar();
                //reinicia la camara
                GuiController.Instance.ThirdPersonCamera.resetValues();
                if (muerte)
                {
                    EjemploAlu.setPantalla(EjemploAlu.getPantalla(1));
                }
                else if (salirConQ)
                {
                    EjemploAlumno.getInstance().setPantalla(new PantallaInicio());
                }
                else
                {
                    EjemploAlu.setPantalla(EjemploAlu.getPantalla(2));
                }
            }

            if (comienzoNivel)
            {
                if (DateTime.Now.Subtract(this.horaInicio).TotalSeconds < 3)
                {
                    if (auto.nombre == "Luigi")
                    {
                        misionLuigi.render();
                    }
                    else
                    {
                        misionMario.render();
                    }
                }
                else
                {
                    comienzoNivel = false;
                }
            }
            else
            {
                //Dibujo barrita
                if (auto.nombre == "Luigi")
                {
                    barra2.render();
                }
                else
                {
                    barra.render();
                }
                vida.render();
            }
            //renderizo utilidades del debugMode
            if (Shared.debugMode)
            {
                Vector2 vectorModifier = (Vector2)GuiController.Instance.Modifiers["PosicionFlechaDebug"];
                Vector3 vectorPosicion = new Vector3(vectorModifier.X, 10, vectorModifier.Y);
                debugArrow.PStart = vectorPosicion + new Vector3(0, 400f, 0);
                debugArrow.PEnd   = vectorPosicion;
                debugArrow.updateValues();
                debugArrow.render();

                //renderizo normal al plano chocado
                if (obstaculoChocado != null)
                {
                    collisionNormalArrow.PStart = obstaculoChocado.obb.Center;
                    collisionNormalArrow.PEnd   = obstaculoChocado.obb.Center + Vector3.Multiply(new Vector3(caraChocada.A, caraChocada.B, caraChocada.C), 500f);
                    collisionNormalArrow.updateValues();
                    collisionNormalArrow.render();
                }
            }
        }
Exemplo n.º 15
0
 public ObstaculoRigido(TgcMesh _mesh)
 {
     this.obb  = TgcObb.computeFromAABB(_mesh.BoundingBox);
     this.mesh = _mesh;
 }
Exemplo n.º 16
0
        public override void init()
        {
            hud = new HUD();
            hud.init();
            Microsoft.DirectX.Direct3D.Device d3dDevice = GuiController.Instance.D3dDevice;
            //Crear Sprite
            sprite         = new TgcSprite();
            sprite.Texture = TgcTexture.createTexture(GuiController.Instance.AlumnoEjemplosMediaDir + "TheC#\\Inicio\\imagenInicio.jpg");

            //Ubicarlo centrado en la pantalla
            Size screenSize  = GuiController.Instance.Panel3d.Size;
            Size textureSize = sprite.Texture.Size;

            sprite.Position = new Vector2(0, 0);
            sprite.Scaling  = new Vector2((float)screenSize.Width / textureSize.Width, (float)screenSize.Height / textureSize.Height + 0.01f);

            //Texturas para particulas
            texturaHumo  = TgcTexture.createTexture(GuiController.Instance.AlumnoEjemplosMediaDir + "TheC#\\Particulas\\Textures\\humo.png");
            texturaFuego = TgcTexture.createTexture(GuiController.Instance.AlumnoEjemplosMediaDir + "TheC#\\Particulas\\Textures\\fuego.png");

            Vector3 centerHumo = new Vector3(0, 0, 0);
            Vector3 sizeHumo   = new Vector3(7, 3, 10);

            humo = TgcBox.fromSize(centerHumo, sizeHumo, texturaHumo);
            humo.AlphaBlendEnable = true;
            fuego = TgcBox.fromSize(centerHumo, sizeHumo, texturaFuego);
            fuego.AlphaBlendEnable = true;
            cantidadDeNitro        = 100f;

            // cosas del tiempo
            tiempoTrans        = 100f; //tiempo transcurrido desde el defasaje de rotacion de camara y rotacion del mesh
            segundosAuxiliares = 1;
            //En este ejemplo primero cargamos una escena 3D entera.
            TgcSceneLoader loader = new TgcSceneLoader();

            //Luego cargamos otro modelo aparte que va a hacer el objeto que controlamos con el teclado
            TgcScene scene1 = loader.loadSceneFromFile(GuiController.Instance.AlumnoEjemplosMediaDir + "TheC#\\Auto\\\\autoRojo-TgcScene.xml");
            TgcScene scene2 = loader.loadSceneFromFile(GuiController.Instance.AlumnoEjemplosMediaDir + "TheC#\\Auto\\\\Auto_Rueda_Derecha-TgcScene.xml");
            TgcScene scene3 = loader.loadSceneFromFile(GuiController.Instance.AlumnoEjemplosMediaDir + "TheC#\\Auto\\\\Auto_Rueda_Derecha-TgcScene.xml");
            TgcScene scene4 = loader.loadSceneFromFile(GuiController.Instance.AlumnoEjemplosMediaDir + "TheC#\\Auto\\\\Auto_Rueda_Izquierda-TgcScene.xml");
            TgcScene scene5 = loader.loadSceneFromFile(GuiController.Instance.AlumnoEjemplosMediaDir + "TheC#\\Auto\\\\Auto_Rueda_Izquierda-TgcScene.xml");

            scenePista = loader.loadSceneFromFile(GuiController.Instance.AlumnoEjemplosMediaDir + "TheC#\\Auto\\\\pistaentera-TgcScene.xml");
            TgcScene sceneAutoIA = loader.loadSceneFromFile(GuiController.Instance.AlumnoEjemplosMediaDir + "TheC#\\Auto\\\\autoVerde-TgcScene.xml");

            //cargo obbs
            objetosColisionables = new List <TgcObb>();

            /*  Esto de aca comentado sirve para cuando se agregan nuevos meshes a pistaentera-TgcScene.xml entonces
             * obtiene su OBB de los AABB de los meshes, esta comentado porque el archivo .xml esta actualizado
             * y aparte detiene mucho su inicio
             * foreach (TgcMesh mesh in scenePista.Meshes)
             * {
             *    if (mesh.Name.Contains("borde") || mesh.Name.Contains("col") || mesh.Name.Contains("Patrullero"))
             *    {
             *        Vector3[] vertices = mesh.getVertexPositions();
             *        objetosColisionables.Add(TgcObb.computeFromPoints(vertices));
             *    }
             * }
             * guardarObbs(objetosColisionables);*/
            objetosColisionables = cargarObbObjetos();
            posteDeSemaforoOBB   = cargarobbParticular(new Vector3(-1193.647f, -649.2448f, 948.8185f), new Vector3(-1147f, 596.6053f, 1051.182f));
            objetosColisionables.Add(posteDeSemaforoOBB);

            //Solo nos interesa el primer modelo de estas escenas
            autoMesh = scene1.Meshes[0];
            ruedaDerechaDelanteraMesh   = scene2.Meshes[0];
            ruedaDerechaTraseraMesh     = scene3.Meshes[0];
            ruedaIzquierdaDelanteraMesh = scene4.Meshes[0];
            ruedaIzquierdaTraseraMesh   = scene5.Meshes[0];

            //creo el mesh del auto de IA
            meshAutoIA = sceneAutoIA.Meshes[0];
            //creo la lista de ruedas
            ruedas = new List <TgcViewer.Utils.TgcSceneLoader.TgcMesh> {
                ruedaDerechaDelanteraMesh, ruedaDerechaTraseraMesh, ruedaIzquierdaDelanteraMesh, ruedaIzquierdaTraseraMesh
            };

            //creo la lineas de frenado
            for (int i = 0; i < 4; i++)
            {
                lineaDeFrenado[i] = new LineaDeFrenado(12, 25, 3, 250, Color.Black);
            }


            //posicion del auto
            autoMesh.Position = new Vector3(-278f, 0f, 281f);

            //posiciones relativas al auto
            dx = new List <float> {
                45, -45, -45, 45
            };
            dy = new List <float> {
                -61, 71, -61, 71
            };

            //posiciones relativas al auto para los box de colision entre autos
            dxAColision = new List <float> {
                20, -20, -20, 20
            };
            dyAColision = new List <float> {
                -35, 45, -35, 45
            };

            //posiciono al autoIA
            meshAutoIA.Position = new Vector3(211f, 0f, 216f);

            //Vamos a utilizar la cámara en 3ra persona para que siga al objeto principal a medida que se mueve
            GuiController.Instance.ThirdPersonCamera.Enable = true;

            GuiController.Instance.ThirdPersonCamera.RotationY = 300;
            GuiController.Instance.ThirdPersonCamera.setCamera(autoMesh.Position, 200, 500);
            GuiController.Instance.BackgroundColor = Color.Black;// Black;


            //Le asigno su oriented bounding box que me permite rotar la caja de colisiones (no así bounding box)
            oBBAuto   = TgcObb.computeFromAABB(autoMesh.BoundingBox);
            oBBAutoIa = TgcObb.computeFromAABB(meshAutoIA.BoundingBox);

            //creo al auto y al jugador
            auto    = new Auto(110, ruedas);
            jugador = new Jugador(auto);

            //creo al auto del IA y al IA
            autoIA    = new Auto(110, ruedas);
            jugadorIA = new IA(autoIA, new Vector3(0, 0, 0));

            //Inicializo el circuito, tanto para la persona como para la IA
            posicionesPuntosDeControl = new List <Vector3> {
                new Vector3(360, 20, 2634),
                new Vector3(-1040, 20, 5524), new Vector3(-1749, 20, 11113),
                new Vector3(-4484, 20, 14460), new Vector3(-7377, 20, 16890), new Vector3(-12790, 20, 17407),
                new Vector3(-15308, 20, 12649), new Vector3(-15153, 20, 8531), new Vector3(-16068, 20, 7030),
                new Vector3(-16342, 20, 4149), new Vector3(-16222, 20, -1083), new Vector3(-14986, 20, -3020),
                new Vector3(-15734, 20, -8568), new Vector3(-15281, 20, -12097), new Vector3(-12022, 20, -15335),
                new Vector3(-6142, 20, -14446), new Vector3(-4411, 20, -11766), new Vector3(-2016, 20, -8940),
                new Vector3(-1287, 20, -4142), new Vector3(20, 20, -2566)
            };


            posicionesPuntosDeControlDeIA = new List <Vector3> {
                new Vector3(360, 20, 2634),
                new Vector3(-1040, 20, 5524), new Vector3(-1749, 20, 11113),
                new Vector3(-4484, 20, 14460), new Vector3(-7377, 20, 16890), new Vector3(-12790, 20, 17407),
                new Vector3(-15308, 20, 12649), new Vector3(-15153, 20, 8531), new Vector3(-16068, 20, 7030),
                new Vector3(-16342, 20, 4149), new Vector3(-16222, 20, -1083), new Vector3(-14986, 20, -3020),
                new Vector3(-15734, 20, -8568), new Vector3(-15281, 20, -12097), new Vector3(-12022, 20, -15335),
                new Vector3(-6142, 20, -14446), new Vector3(-4411, 20, -11766), new Vector3(-2016, 20, -8940),
                new Vector3(-1287, 20, -4142), new Vector3(20, 20, -2566)
            };

            for (int i = 0; i < posicionesPuntosDeControl.Count; i++)
            {
                TgcCylinder unCilindro = new TgcCylinder(posicionesPuntosDeControl[i], 130, 30);
                trayecto.Add(unCilindro);
                unCilindro = new TgcCylinder(posicionesPuntosDeControlDeIA[i], 130, 30);
                trayectoDeIA.Add(unCilindro);
            }


            //Asigno los obb que me permiten detectar las colisiones entre los autos
            obbsAuto.Add(TgcBox.fromSize(new Vector3(autoMesh.Position.X - 100, 15, autoMesh.Position.Z + 100), new Vector3(65, 65, 65), texturaFuego));
            obbsAuto.Add(TgcBox.fromSize(new Vector3(autoMesh.Position.X - 100, 15, autoMesh.Position.Z - 100), new Vector3(65, 65, 65), texturaHumo));
            obbsAuto.Add(TgcBox.fromSize(new Vector3(autoMesh.Position.X + 100, 15, autoMesh.Position.Z + 100), new Vector3(65, 65, 65), texturaFuego));
            obbsAuto.Add(TgcBox.fromSize(new Vector3(autoMesh.Position.X + 100, 15, autoMesh.Position.Z - 100), new Vector3(65, 65, 65), texturaFuego));

            obbsOtroAuto.Add(TgcBox.fromSize(new Vector3(meshAutoIA.Position.X - 100, 15, meshAutoIA.Position.Z + 100), new Vector3(65, 65, 65), texturaFuego));
            obbsOtroAuto.Add(TgcBox.fromSize(new Vector3(meshAutoIA.Position.X - 100, 15, meshAutoIA.Position.Z - 100), new Vector3(65, 65, 65), texturaHumo));
            obbsOtroAuto.Add(TgcBox.fromSize(new Vector3(meshAutoIA.Position.X + 100, 15, meshAutoIA.Position.Z + 100), new Vector3(65, 65, 65), texturaFuego));
            obbsOtroAuto.Add(TgcBox.fromSize(new Vector3(meshAutoIA.Position.X + 100, 15, meshAutoIA.Position.Z - 100), new Vector3(65, 65, 65), texturaFuego));

            /////////////TEXTOS///////////////////////

            textPuntosDeControlAlcanzados          = new TgcText2d();
            textPuntosDeControlAlcanzados.Position = new Point(0, 50);
            textPuntosDeControlAlcanzados.Text     = "Puntos De Control Alcanzados = ";
            textPuntosDeControlAlcanzados.Color    = Color.White;

            textFPS          = new TgcText2d();
            textFPS.Position = new Point((screenSize.Width / (-2)), 0);
            textFPS.Text     = "FPS: ";
            textFPS.Color    = Color.Yellow;

            textGanaste          = new TgcText2d();
            textGanaste.Position = new Point(0, 200);
            textGanaste.Color    = Color.LightGreen;

            textPerdiste          = new TgcText2d();
            textPerdiste.Position = new Point(0, 200);
            textPerdiste.Text     = "Perdiste y lograste ";
            textPerdiste.Color    = Color.Red;
            textPerdiste.Size     = new Size(900, 700);

            textPosicionDelAutoActual          = new TgcText2d();
            textPosicionDelAutoActual.Text     = "Posicion del auto actual = ";
            textPosicionDelAutoActual.Color    = Color.White;
            textPosicionDelAutoActual.Position = new Point(100, 450);

            this.horaInicio     = DateTime.Now;
            textTiempo          = new TgcText2d();
            textTiempo.Position = new Point(screenSize.Width / 2 - 50, 20);
            textTiempo.Text     = "10";
            textTiempo.changeFont(new System.Drawing.Font("TimesNewRoman", 23, FontStyle.Bold | FontStyle.Bold));
            textTiempo.Color = Color.Red;

            stringTiempo          = new TgcText2d();
            stringTiempo.Position = new Point(screenSize.Width / 2 - 130, 20);
            stringTiempo.Text     = "Tiempo: ";
            stringTiempo.changeFont(new System.Drawing.Font("TimesNewRoman", 23, FontStyle.Bold | FontStyle.Bold));
            stringTiempo.Color = Color.Red;

            textIngreseTecla          = new TgcText2d();
            textIngreseTecla.Text     = " Utilize las flechas o W,A,S,D para moverse. \n Shift o control izquierdo para activar el nitro \n M para cambiar la camara \n TAB mirar para atrás \n Ingrese barra espaciadora para comenzar ";
            textIngreseTecla.Position = new Point(150, 290);
            textIngreseTecla.Align    = TgcText2d.TextAlign.LEFT;
            textIngreseTecla.changeFont(new System.Drawing.Font("TimesNewRoman", 23, FontStyle.Bold | FontStyle.Bold));
            textIngreseTecla.Color = Color.White;

            textIngreseTeclaSombra          = new TgcText2d();
            textIngreseTeclaSombra.Text     = " Utilize las flechas o W,A,S,D para moverse. \n Shift o control izquierdo para activar el nitro \n M para cambiar la camara \n TAB mirar para atrás \n Ingrese barra espaciadora para comenzar ";
            textIngreseTeclaSombra.Position = new Point(149, 288);
            textIngreseTeclaSombra.Align    = TgcText2d.TextAlign.LEFT;
            textIngreseTeclaSombra.changeFont(new System.Drawing.Font("TimesNewRoman", 23, FontStyle.Bold | FontStyle.Bold));
            textIngreseTeclaSombra.Color = Color.Black;

            textoVelocidad.inicializarTextoVelocidad(auto.velocidad);
            ///////////////MODIFIERS//////////////////
            GuiController.Instance.Modifiers.addFloat("velocidadMaxima", 1000, 7000, 1800f);
            GuiController.Instance.Modifiers.addBoolean("jugarConTiempo", "jugar con tiempo:", true);
            GuiController.Instance.Modifiers.addBoolean("motionBlurFlag", "Motion Blur", false);
            //////////////Reflejo de luz en auto////////////////
            reflejo = new ReflejoLuzEnAuto(autoMesh);


            //contador de puntos de control
            contadorDeActivacionesDePuntosDeControl     = 0;
            contadorDeActivacionesDePuntosDeControlDeIA = 0;
            //flag de victoria
            gano = false;

            List <TgcMesh> autoIAList = new List <TgcMesh>();

            autoIAList.Add(meshAutoIA);

            //motionBlur = new MotionBlur(scenePista.Meshes);
            //motionBlur.motionBlurInit(0);
            musica.inicializar();

            motionBlur = new MotionBlur(scenePista.Meshes);
            motionBlur.motionBlurInit(0);

            emisorHumo = new EmisorHumo();
            emisorHumo.crearQuads(20);
        }
Exemplo n.º 17
0
        //fin guardar
        //carga alguno especial porque su AABB esta mal
        public TgcObb cargarobbParticular(Vector3 min, Vector3 max)
        {
            TgcBoundingBox objetoABB = new TgcBoundingBox(min, max);

            return(TgcObb.computeFromAABB(objetoABB));
        }
Exemplo n.º 18
0
 public ObbTranslatedCollider(TgcMesh mesh, Vector3 translation)
     : this(TgcObb.computeFromAABB(mesh.BoundingBox), translation)
 {
 }
Exemplo n.º 19
0
 public ObbCollider(TgcMesh mesh)
     : this(TgcObb.computeFromAABB(mesh.BoundingBox))
 {
 }
Exemplo n.º 20
0
 public ObbCollider(TgcBoundingBox aabb)
     : this(TgcObb.computeFromAABB(aabb))
 {
 }