Update index.html
Browse files- index.html +9 -4
index.html
CHANGED
|
@@ -375,12 +375,13 @@
|
|
| 375 |
document.getElementById('loading').textContent = 'Loading character...';
|
| 376 |
|
| 377 |
fbxLoader.load('./character.fbx', (fbx) => {
|
| 378 |
-
playerModel =
|
| 379 |
-
|
| 380 |
-
|
|
|
|
| 381 |
|
| 382 |
// Make character visible with proper materials
|
| 383 |
-
|
| 384 |
if (child.isMesh) {
|
| 385 |
child.castShadow = true;
|
| 386 |
child.receiveShadow = true;
|
|
@@ -393,10 +394,14 @@
|
|
| 393 |
}
|
| 394 |
});
|
| 395 |
|
|
|
|
|
|
|
|
|
|
| 396 |
scene.add(playerModel);
|
| 397 |
loadingSteps.character = true;
|
| 398 |
updateLoadingStatus();
|
| 399 |
console.log('✅ Character loaded!');
|
|
|
|
| 400 |
}, (xhr) => {
|
| 401 |
const percent = (xhr.loaded / xhr.total * 100).toFixed(1);
|
| 402 |
document.getElementById('loading').textContent = `Loading character ${percent}%`;
|
|
|
|
| 375 |
document.getElementById('loading').textContent = 'Loading character...';
|
| 376 |
|
| 377 |
fbxLoader.load('./character.fbx', (fbx) => {
|
| 378 |
+
playerModel = new THREE.Group();
|
| 379 |
+
|
| 380 |
+
// Add the FBX model to a group for easier manipulation
|
| 381 |
+
fbx.scale.set(0.01, 0.01, 0.01);
|
| 382 |
|
| 383 |
// Make character visible with proper materials
|
| 384 |
+
fbx.traverse((child) => {
|
| 385 |
if (child.isMesh) {
|
| 386 |
child.castShadow = true;
|
| 387 |
child.receiveShadow = true;
|
|
|
|
| 394 |
}
|
| 395 |
});
|
| 396 |
|
| 397 |
+
playerModel.add(fbx);
|
| 398 |
+
playerModel.position.set(playerPos.x, playerPos.y, playerPos.z);
|
| 399 |
+
|
| 400 |
scene.add(playerModel);
|
| 401 |
loadingSteps.character = true;
|
| 402 |
updateLoadingStatus();
|
| 403 |
console.log('✅ Character loaded!');
|
| 404 |
+
console.log('Character position:', playerModel.position);
|
| 405 |
}, (xhr) => {
|
| 406 |
const percent = (xhr.loaded / xhr.total * 100).toFixed(1);
|
| 407 |
document.getElementById('loading').textContent = `Loading character ${percent}%`;
|