From ff9a86adf64ef3626b5d3542ef2145b3fd8eda32 Mon Sep 17 00:00:00 2001 From: Alexis DELFORGES Date: Thu, 22 Aug 2024 15:05:13 +0200 Subject: [PATCH] fix(pointcloud): Fix point cloud distance to camera whatever point cloud initial placement is --- src/Layer/PointCloudLayer.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Layer/PointCloudLayer.js b/src/Layer/PointCloudLayer.js index c84304afcf..71c7adc296 100644 --- a/src/Layer/PointCloudLayer.js +++ b/src/Layer/PointCloudLayer.js @@ -253,7 +253,8 @@ class PointCloudLayer extends GeometryLayer { } elt.notVisibleSince = undefined; - point.copy(context.camera.camera3D.position).sub(this.object3d.position); + point.copy(context.camera.camera3D.position).sub(this.object3d.getWorldPosition(new THREE.Vector3())); + point.applyQuaternion(this.object3d.getWorldQuaternion(new THREE.Quaternion()).invert()); // only load geometry if this elements has points if (elt.numPoints !== 0) {