|
|
|
@ -432,13 +432,13 @@ export class Item { |
|
|
|
boundingBox.getBoundingSphere(boundingSphere); |
|
|
|
|
|
|
|
// Set the desired world scale for the indicator based on the object's size
|
|
|
|
const desiredScale = boundingSphere.radius * 0.2; |
|
|
|
const desiredScale = boundingSphere.radius * 2.5; |
|
|
|
this.hoverIndicator.scale.set(desiredScale, desiredScale, desiredScale); |
|
|
|
|
|
|
|
// Counteract the parent's scale by dividing the indicator's scale by the parent's scale.
|
|
|
|
// if (this.object.scale.x !== 0 && this.object.scale.y !== 0 && this.object.scale.z !== 0) {
|
|
|
|
// this.hoverIndicator.scale.divide(this.object.scale);
|
|
|
|
// }
|
|
|
|
if (this.object.scale.x !== 0 && this.object.scale.y !== 0 && this.object.scale.z !== 0) { |
|
|
|
this.hoverIndicator.scale.divide(this.object.scale); |
|
|
|
} |
|
|
|
|
|
|
|
// Position the sprite at the center of the object, in local space.
|
|
|
|
this.hoverIndicator.position.copy(boundingSphere.center).sub(this.object.position); |
|
|
|
@ -459,15 +459,15 @@ export class Item { |
|
|
|
|
|
|
|
if (this.loadState !== 'loaded') return; |
|
|
|
|
|
|
|
// if (this.hoverIndicator) {
|
|
|
|
// this.pulseTime += delta * 5; // Adjust the multiplier to change pulse speed
|
|
|
|
// const minOpacity = 0.1;
|
|
|
|
// const maxOpacity = 0.8;
|
|
|
|
// // Create a sine wave that oscillates between 0 and 1
|
|
|
|
// const oscillation = (Math.sin(this.pulseTime) + 1) / 4;
|
|
|
|
// // Apply the oscillation to the desired opacity range
|
|
|
|
// this.hoverIndicator.material.opacity = minOpacity + oscillation * (maxOpacity - minOpacity);
|
|
|
|
// }
|
|
|
|
if (this.hoverIndicator) { |
|
|
|
this.pulseTime += delta * 5; // Adjust the multiplier to change pulse speed
|
|
|
|
const minOpacity = 0.1; |
|
|
|
const maxOpacity = 0.8; |
|
|
|
// Create a sine wave that oscillates between 0 and 1
|
|
|
|
const oscillation = (Math.sin(this.pulseTime) + 1) / 4; |
|
|
|
// Apply the oscillation to the desired opacity range
|
|
|
|
this.hoverIndicator.material.opacity = minOpacity + oscillation * (maxOpacity - minOpacity); |
|
|
|
} |
|
|
|
|
|
|
|
this.lastPosition = this.object.position.clone(); |
|
|
|
|
|
|
|
|