@d5techs/3dgs-lib 1.4.1 → 1.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/3dgs-lib.cjs CHANGED
@@ -14266,6 +14266,7 @@ class HotspotManager {
14266
14266
  if (info.billboard === enabled) return true;
14267
14267
  info.billboard = enabled;
14268
14268
  if (!enabled) {
14269
+ info._lastBillboardMeshPos = void 0;
14269
14270
  this.restoreHotspotOrientation(info);
14270
14271
  }
14271
14272
  return true;
@@ -14403,6 +14404,19 @@ class HotspotManager {
14403
14404
  const camPos = this.camera.position;
14404
14405
  for (const info of this.hotspots) {
14405
14406
  if (!info.billboard) continue;
14407
+ if (info._lastBillboardMeshPos) {
14408
+ const firstMesh = this.meshRenderer.getOverlayMeshByIndex(info.meshStartIndex);
14409
+ if (firstMesh) {
14410
+ const dx = firstMesh.position[0] - info._lastBillboardMeshPos[0];
14411
+ const dy = firstMesh.position[1] - info._lastBillboardMeshPos[1];
14412
+ const dz = firstMesh.position[2] - info._lastBillboardMeshPos[2];
14413
+ if (Math.abs(dx) > 1e-6 || Math.abs(dy) > 1e-6 || Math.abs(dz) > 1e-6) {
14414
+ info.position[0] += dx;
14415
+ info.position[1] += dy;
14416
+ info.position[2] += dz;
14417
+ }
14418
+ }
14419
+ }
14406
14420
  const {
14407
14421
  position,
14408
14422
  normal,
@@ -14454,6 +14468,10 @@ class HotspotManager {
14454
14468
  const owx = (rx * lcx + fx * lcy + zx * lcz) * s;
14455
14469
  const owy = (ry * lcx + fy * lcy + zy * lcz) * s;
14456
14470
  const owz = (rz * lcx + fz * lcy + zz * lcz) * s;
14471
+ const finalMeshX = wx - owx;
14472
+ const finalMeshY = wy - owy;
14473
+ const finalMeshZ = wz - owz;
14474
+ info._lastBillboardMeshPos = [finalMeshX, finalMeshY, finalMeshZ];
14457
14475
  for (let i = 0; i < info.meshCount; i++) {
14458
14476
  const mesh = this.meshRenderer.getOverlayMeshByIndex(
14459
14477
  info.meshStartIndex + i