threejs how to rotate around object’s own center,instead of world center

The solution for “threejs how to rotate around object’s own center,instead of world center” can be found here. The following code will assist you in solving the problem.

this.loaderGLTF.load(‘assets/epson.glb’, (gltf: GLTF) => {
this.model = gltf.scene;
var box = new THREE.Box3().setFromObject(this.model);
box.getCenter(this.model.position); // this re-sets the mesh position
this.model.position.multiplyScalar(- 1);
this.scene.add(this.model);
});

Thank you for using DeclareCode; We hope you were able to resolve the issue.

More questions on [categories-list]

0
inline scripts encapsulated in