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

Loading…
Cancel
Save