mkkellogg / GaussianSplats3D

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

rotating the scene while it's already loaded #327

Closed LearnedVector closed 2 months ago

LearnedVector commented 2 months ago

Hi, if a scene is already loaded, and i want to create controls to enable users to rotate the scene, what is the best method for this?

I tried this

const sceneIndex = 0; // Assuming the first scene added
const scene = viewer.getSplatScene(sceneIndex);

// Rotate the scene by 45 degrees on the Y-axis
const axis = new THREE.Vector3(0, 1, 0);
const angle = Math.PI / 4;
scene.rotateOnAxis(axis, angle);

// Update and re-render
viewer.splatMesh.updateTransforms();
viewer.forceRenderNextFrame();

but doesn't seem to work

mkkellogg commented 2 months ago

Are you making sure to enable dynamic mode? It is disabled by default but it needs to be enabled if you want to update scene transforms at runtime. You can enable with the Viewer parameter 'dynamicScene': true.

LearnedVector commented 2 months ago

ahh that was it. thanks!