Three.js glTF模型居中但在圆曲线而非中心点上旋转

时间:2019-05-26 17:14:14

标签: three.js rotation gltf

我已经使用three.js glTF Loader加载了glTF模型。尽管对象位于原点(0,0,0)的中心,但它似乎沿 x 平面上的圆曲线旋转。

这是模型在开始旋转之前的图像。注意,它在原点上。将DT[,Credits := max(Credits),by=Student_ID] Result <- DT[Appraisal.Type == "Grade supervisor"] 添加到代码后,Here is a GIF on how it rotates

enter image description here

我所得到和所寻找的东西的视觉表示:

enter image description here

我设法使用this solution来使对象居中,但似乎无法解决旋转问题。边界框:

mesh.rotation.y += 0.01;

旋转:

    var loader = new THREE.GLTFLoader();
    loader.load( 'model/empire_vase/scene.gltf', function ( gltf ) {

        mesh = gltf.scene;
        gltf.scene.traverse( function ( child ) {

        } );

        var box = new THREE.Box3().setFromObject( mesh );
        box.center( mesh.position ); 
        mesh.position.multiplyScalar( - 1 );

        var pivot = new THREE.Group();
        scene.add( pivot );
        pivot.add( mesh );

        var axesHelper = new THREE.AxesHelper( 100 );
        scene.add( axesHelper );

    } );

该模型是从Sketchfab/Geoffrey Marchal提取的,但是我注意到其他Sketchfab模型存在此问题。预先感谢!

0 个答案:

没有答案
相关问题