mkkellogg / GaussianSplats3D

Three.js-based implementation of 3D Gaussian splatting
MIT License
1.09k stars 134 forks source link

select and move splat scene #260

Open TianyuHuang-000 opened 1 week ago

TianyuHuang-000 commented 1 week ago

Thank you for your great work.

I'm trying to use the viewer to load multiple splat scenes and move them like normal three objects. It seems like we can't determine the scene index with your raycaster, and using normal threejs raycaster can only select a invisible mesh at very center of the splat scene and control whole viewer. Any hint on how can i achive use raycast select individual splat scenes? And after selection I think I will be able to attach the splat to Transform control and move it.

mkkellogg commented 1 week ago

You should be able to to use the splat index to determine the scene index with something like:

  viewer.raycaster.intersectSplatMesh(viewer.splatMesh, hits);
  if (hits.length > 0) {
      const closestHit = hit[0];
      const sceneIndex = viewer.splatMesh.getSceneIndexForSplat(closestHit.splatIndex);
 }