diff --git a/libs/vslam_web/www/app3d.js b/libs/vslam_web/www/app3d.js index 99ee744..1c9b1f7 100644 --- a/libs/vslam_web/www/app3d.js +++ b/libs/vslam_web/www/app3d.js @@ -810,6 +810,33 @@ function v3dSetBodyVisible(on) { function v3dSetFramesVisible(on) { if (V3D.framesMesh) V3D.framesMesh.visible = !!on; + + // Khi hien TF thi lam THAN robot trong suot. + // + // Than la khoi hop 0.85 m; LiDAR o 0.13 m va camera o 0.31 m deu NAM TRONG + // no, nen o che do dac thi khong thay bo truc nao ca. Bat/tat han thi lai + // mat ngu canh -- khong biet cam bien nam dau so voi than. + // + // depthWrite = false la phan bat buoc: thieu no thi mat trong suot van ghi + // vao depth buffer va van che nhung gi ve SAU no, tuc bo truc bien mat du + // da nhin xuyen duoc qua than. + if (!V3D.bodyMesh) return; + V3D.bodyMesh.traverse((o) => { + if (!o.material) return; + if (!o.userData.matSolid) o.userData.matSolid = o.material; + if (on) { + if (!o.userData.matGhost) { + const m = o.material.clone(); + m.transparent = true; + m.opacity = 0.18; + m.depthWrite = false; + o.userData.matGhost = m; + } + o.material = o.userData.matGhost; + } else { + o.material = o.userData.matSolid; + } + }); } function v3dSetOverlays(on) {