[Vuejs]-How to Loop GlftModel with troisjs in Vue

0👍

You could use .traverse or .traverseVisible making sure that the object is a Mesh.

renderer.onBeforeRender(() => {
  box.traverse((obj3D) => {
      if (obj3D instanceof Mesh) {
        // Make sure this object is a mesh.
        obj3D.rotation.x += 0.01;
      }
    })
});

Callback would be invoked in the current object (box in this case) and all its descendants.

https://threejs.org/docs/index.html?q=object#api/en/core/Object3D.traverse

Leave a comment