Browse Source

rotation fix

master
cailean 2 hours ago
parent
commit
6f2a01a3f0
  1. 32
      js/Player.js

32
js/Player.js

@ -1021,22 +1021,22 @@ export class Player {
this.lastPromptItem = null;
}
if (this.interactPrompt && this.interactPrompt.userData.charMeshes) {
const now = performance.now();
this.interactPrompt.userData.charMeshes.forEach((mesh, i) => {
// Don't animate spaces
if (mesh.material.map.image) {
const ctx = mesh.material.map.image.getContext && mesh.material.map.image.getContext('2d');
if (ctx && ctx.measureText && ctx.measureText(' ').width === 0) return;
}
// Snap rotation at random intervals
if (now > mesh.userData.nextSnap) {
mesh.userData.snapRotation = (Math.random() * 40 - 20) * Math.PI / 180; // -20 to +20 deg in radians
mesh.userData.nextSnap = now + Math.random() * 600 + 300; // 100-700ms
}
mesh.rotation.z = mesh.userData.snapRotation;
});
}
// if (this.interactPrompt && this.interactPrompt.userData.charMeshes) {
// const now = performance.now();
// this.interactPrompt.userData.charMeshes.forEach((mesh, i) => {
// // Don't animate spaces
// if (mesh.material.map.image) {
// const ctx = mesh.material.map.image.getContext && mesh.material.map.image.getContext('2d');
// if (ctx && ctx.measureText && ctx.measureText(' ').width === 0) return;
// }
// // Snap rotation at random intervals
// if (now > mesh.userData.nextSnap) {
// mesh.userData.snapRotation = (Math.random() * 40 - 20) * Math.PI / 180; // -20 to +20 deg in radians
// mesh.userData.nextSnap = now + Math.random() * 600 + 300; // 100-700ms
// }
// mesh.rotation.z = mesh.userData.snapRotation;
// });
// }
// --- Item Counter Animation ---
if (this.itemCountDisplay && this.itemCountAnim.active) {

Loading…
Cancel
Save