Browse Source

sprite

master
cailean 60 minutes ago
parent
commit
fc56f27079
  1. 4
      js/Content.js
  2. 11
      js/Item.js

4
js/Content.js

@ -175,8 +175,8 @@ export class ImageContent extends Content {
(texture) => {
this.texture = texture;
const aspect = texture.image.width / texture.image.height;
const maxWidth = 4.5;
const height = 4;
const maxWidth = 4;
const height = 3;
let width = height * aspect;
if (width > maxWidth) {
width = maxWidth;

11
js/Item.js

@ -432,16 +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 * 2.5;
const desiredScale = boundingSphere.radius * 0.2;
this.hoverIndicator.scale.set(desiredScale, desiredScale, desiredScale);
// Counteract the parent's scale by dividing the indicator's scale by the parent's scale.
if (scale.x !== 0 && scale.y !== 0 && scale.z !== 0) {
this.hoverIndicator.scale.divide(scale);
} else {
// Avoid division by zero
this.hoverIndicator.scale.set(1, 1, 1);
}
// 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);

Loading…
Cancel
Save