@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.js CHANGED
@@ -14264,6 +14264,7 @@ class HotspotManager {
14264
14264
  if (info.billboard === enabled) return true;
14265
14265
  info.billboard = enabled;
14266
14266
  if (!enabled) {
14267
+ info._lastBillboardMeshPos = void 0;
14267
14268
  this.restoreHotspotOrientation(info);
14268
14269
  }
14269
14270
  return true;
@@ -14401,6 +14402,19 @@ class HotspotManager {
14401
14402
  const camPos = this.camera.position;
14402
14403
  for (const info of this.hotspots) {
14403
14404
  if (!info.billboard) continue;
14405
+ if (info._lastBillboardMeshPos) {
14406
+ const firstMesh = this.meshRenderer.getOverlayMeshByIndex(info.meshStartIndex);
14407
+ if (firstMesh) {
14408
+ const dx = firstMesh.position[0] - info._lastBillboardMeshPos[0];
14409
+ const dy = firstMesh.position[1] - info._lastBillboardMeshPos[1];
14410
+ const dz = firstMesh.position[2] - info._lastBillboardMeshPos[2];
14411
+ if (Math.abs(dx) > 1e-6 || Math.abs(dy) > 1e-6 || Math.abs(dz) > 1e-6) {
14412
+ info.position[0] += dx;
14413
+ info.position[1] += dy;
14414
+ info.position[2] += dz;
14415
+ }
14416
+ }
14417
+ }
14404
14418
  const {
14405
14419
  position,
14406
14420
  normal,
@@ -14452,6 +14466,10 @@ class HotspotManager {
14452
14466
  const owx = (rx * lcx + fx * lcy + zx * lcz) * s;
14453
14467
  const owy = (ry * lcx + fy * lcy + zy * lcz) * s;
14454
14468
  const owz = (rz * lcx + fz * lcy + zz * lcz) * s;
14469
+ const finalMeshX = wx - owx;
14470
+ const finalMeshY = wy - owy;
14471
+ const finalMeshZ = wz - owz;
14472
+ info._lastBillboardMeshPos = [finalMeshX, finalMeshY, finalMeshZ];
14455
14473
  for (let i = 0; i < info.meshCount; i++) {
14456
14474
  const mesh = this.meshRenderer.getOverlayMeshByIndex(
14457
14475
  info.meshStartIndex + i