Skip to content

Commit

Permalink
Update three-scene.js
Browse files Browse the repository at this point in the history
  • Loading branch information
davespser authored Dec 8, 2024
1 parent a0a0f18 commit 9e5f736
Showing 1 changed file with 2 additions and 28 deletions.
30 changes: 2 additions & 28 deletions js/three-scene.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as THREE from "https://cdn.jsdelivr.net/npm/[email protected]/build/three.module.js";
import { GLTFLoader } from "https://cdn.jsdelivr.net/npm/[email protected]/examples/jsm/loaders/GLTFLoader.js";

// Variables globales
let scene, camera, renderer;
let cube, floor;
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 9e5f736

Please sign in to comment.