-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
2 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
|
@@ -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); | ||
|