From 9e5f73682bfc6d59276835c33ad052d57ed8d7c5 Mon Sep 17 00:00:00 2001 From: David espinosa <104380606+davespser@users.noreply.github.com> Date: Sun, 8 Dec 2024 11:21:21 +0100 Subject: [PATCH] Update three-scene.js --- js/three-scene.js | 30 ++---------------------------- 1 file changed, 2 insertions(+), 28 deletions(-) diff --git a/js/three-scene.js b/js/three-scene.js index a86f04b1..ec903e3b 100644 --- a/js/three-scene.js +++ b/js/three-scene.js @@ -1,5 +1,5 @@ import * as THREE from "https://cdn.jsdelivr.net/npm/three@0.152.2/build/three.module.js"; -import { GLTFLoader } from "https://cdn.jsdelivr.net/npm/three@0.152.2/examples/jsm/loaders/GLTFLoader.js"; + // Variables globales let scene, camera, renderer; let cube, floor; @@ -225,33 +225,7 @@ function handleKeyDown(event) { break; } } -const loader = new GLTFLoader(); -const npcModels = [ - "./models/npc/robotauro_walk.glb", // Ruta del primer modelo - // Ruta del segundo modelo -]; - -npcModels.forEach((modelPath, index) => { - loader.load( - modelPath, - (gltf) => { - const npc = gltf.scene; - npc.position.set(index * 2, 0, 0); // Posicionar los NPCs en la escena - npc.scale.set(1, 1, 1); // Escalar el modelo si es necesario - - // Animar los NPCs (opcional) - npc.userData.update = () => { - npc.rotation.y += 0.01; // Ejemplo de animaciĆ³n simple - }; - - scene.add(npc); - }, - undefined, - (error) => { - console.error('Error cargando el modelo:', error); - } - ); -}); + // FunciĆ³n para animar la escena function animate() { requestAnimationFrame(animate);