feat: Remove unused GLB models and enhance asset reset functionality

This commit is contained in:
2025-07-07 16:21:21 +05:30
parent 5070ff4060
commit 82ba6d24bc
9 changed files with 105 additions and 87 deletions

View File

@@ -80,7 +80,7 @@ function HumanAnimator({ path, handleCallBack, currentPhase, human, reset, start
const distances = [];
let accumulatedDistance = 0;
let index = 0;
const rotationSpeed = 1;
const rotationSpeed = 1.5;
for (let i = 0; i < currentPath.length - 1; i++) {
const start = new THREE.Vector3(...currentPath[i]);
@@ -108,7 +108,14 @@ function HumanAnimator({ path, handleCallBack, currentPhase, human, reset, start
if (angle < 0.01) {
object.quaternion.copy(targetQuaternion);
} else {
object.quaternion.slerp(targetQuaternion, delta * rotationSpeed * speed * human.speed * 5);
const step = rotationSpeed * delta * speed * human.speed;
const angle = object.quaternion.angleTo(targetQuaternion);
if (angle < step) {
object.quaternion.copy(targetQuaternion);
} else {
object.quaternion.rotateTowards(targetQuaternion, step);
}
}
const isAligned = angle < 0.01;
@@ -145,7 +152,14 @@ function HumanAnimator({ path, handleCallBack, currentPhase, human, reset, start
object.quaternion.copy(targetQuaternion);
setRestingRotation(false);
} else {
object.quaternion.slerp(targetQuaternion, delta * rotationSpeed * speed * human.speed * 4);
const step = rotationSpeed * delta * speed * human.speed;
const angle = object.quaternion.angleTo(targetQuaternion);
if (angle < step) {
object.quaternion.copy(targetQuaternion);
} else {
object.quaternion.rotateTowards(targetQuaternion, step);
}
}
if (human.currentMaterials.length > 0) {