public override void Init()
        {
            //Objetos en movimiento.
            colliderCylinder = new TgcBoundingCylinder(new Vector3(0, 0, 0), 2, 4);
            colliderCylinder.setRenderColor(Color.LimeGreen);
            colliderCylinderFixedY = new TgcBoundingCylinderFixedY(new Vector3(0, 0, 0), 2, 4);
            colliderCylinderFixedY.setRenderColor(Color.LimeGreen);
            //Cargar personaje con animaciones
            var skeletalLoader = new TgcSkeletalLoader();

            personaje =
                skeletalLoader.loadMeshAndAnimationsFromFile(
                    MediaDir + "SkeletalAnimations\\Robot\\Robot-TgcSkeletalMesh.xml",
                    MediaDir + "SkeletalAnimations\\Robot\\",
                    new[]
            {
                MediaDir + "SkeletalAnimations\\Robot\\Caminando-TgcSkeletalAnim.xml",
                MediaDir + "SkeletalAnimations\\Robot\\Parado-TgcSkeletalAnim.xml"
            });
            //Configurar animacion inicial
            personaje.playAnimation("Parado", true);
            //Escalarlo porque es muy grande
            personaje.Scale = new Vector3(0.04f, 0.04f, 0.04f);

            //El personaje esta en el 0,0,0 hay que bajarlo
            var size = personaje.BoundingBox.PMax.Y - personaje.BoundingBox.PMin.Y;

            personaje.Position = new Vector3(0, -3f, 0);
            //Rotarlo 180° porque esta mirando para el otro lado
            personaje.rotateY(FastMath.PI);

            //Objetos estaticos, pueden ser mesh o objetos simplificados.
            var loader = new TgcSceneLoader();
            var scene  = loader.loadSceneFromFile(MediaDir + "MeshCreator\\Meshes\\Vehiculos\\Patrullero\\Patrullero-TgcScene.xml");

            collisionableMeshAABB          = scene.Meshes[0];
            collisionableMeshAABB.Scale    = new Vector3(0.1f, 0.1f, 0.1f);
            collisionableMeshAABB.Position = new Vector3(6, 0, -2);
            collisionableCylinder          = new TgcBoundingCylinderFixedY(new Vector3(-6, 0, 0), 2, 2);
            collisionableSphere            = new TgcBoundingSphere(new Vector3(-3, 0, 10), 3);

            Modifiers.addBoolean("fixedY", "use fixed Y", true);
            //Modifier para ver BoundingBox del personaje
            Modifiers.addBoolean("showBoundingBox", "Personaje Bouding Box", false);
            Modifiers.addVertex2f("size", new Vector2(1, 1), new Vector2(5, 10), new Vector2(2, 5));
            var angle = FastMath.TWO_PI;

            Modifiers.addVertex3f("rotation", new Vector3(-angle, -angle, -angle), new Vector3(angle, angle, angle),
                                  new Vector3(FastMath.TWO_PI / 8, 0, FastMath.TWO_PI / 8));


            //Configurar camara en Tercer Persona
            camaraInterna = new TgcThirdPersonCamera(personaje.Position, 25, -45);
            Camara        = camaraInterna;
        }
示例#2
0
        public override void init()
        {
            collider            = new TgcBoundingCylinder(new Vector3(0, 0, 0), 2, 4);
            collisionableSphere = new TgcBoundingSphere(new Vector3(0, 0, -6), 3);

            GuiController.Instance.Modifiers.addVertex2f("size", new Vector2(1, 1), new Vector2(5, 10), new Vector2(2, 5));
            GuiController.Instance.Modifiers.addVertex3f("position", new Vector3(-20, -20, -20), new Vector3(20, 20, 20), new Vector3(0, 0, 0));
            float angle = FastMath.TWO_PI;

            GuiController.Instance.Modifiers.addVertex3f("rotation", new Vector3(-angle, -angle, -angle), new Vector3(angle, angle, angle), new Vector3(0, 0, 0));

            collider.setRenderColor(Color.LimeGreen);
        }
示例#3
0
        /// <summary>
        /// Cargar scenes, se llama en init.
        /// </summary>
        private void CargarScenes()
        {
            TgcSceneLoader loader = new TgcSceneLoader();

            this.MapScene = loader.loadSceneFromFile(MediaDir + "Bosque\\ciudad-mod7-TgcScene.xml");
            cargarSkyBox();
            var centroCilindro = new Vector3(0f, 250f, 626f);

            cilindroBB = new TgcBoundingCylinder(centroCilindro, 190f, 250f);
            Niebla     = new Niebla(this);

            AsignarPlayersConMeshes(loader);
        }
        public override void Init()
        {
            internalCamera = Camera as FpsCamera;

            CollisionMeshes = new List <ItemModel>();

            collisionCylinder = new TgcBoundingCylinder(Camera.LookAt, 50f, 200f);
            updownRot         = Geometry.DegreeToRadian(90f) + (FastMath.PI / 10.0f);
            collisionCylinder.rotateZ(updownRot);
            collisionCylinder.setRenderColor(Color.LimeGreen);
            collisionCylinder.updateValues();

            pickUpSound.loadSound(MediaDir + "\\Sounds\\pickUpItem.wav", DirectSound.DsDevice);
        }