小编Mik*_*ike的帖子

Three.js 使用 GLTF Loader 加载对象后访问该对象

在带有 GLTF 加载器的 Three.js 中,有没有一种方法可以访问对象以在加载后执行转换

这样做似乎不起作用

gltf.scene.position.set(10,10,10)
Run Code Online (Sandbox Code Playgroud)

代码:

function loadObject(){
    var loader = new THREE.GLTFLoader();

    loader.load('test.gltf',
        function ( gltf ) {
            scene.add( gltf.scene );

        },
        function ( xhr ) {
            //console.log( ( xhr.loaded / xhr.total * 100 ) + '% loaded' );
        },
        function ( error ) {
            //console.log( 'An error happened' );
        }
    );
}

loadObject()

// Translate
gltf.scene.position.set(10,10,10)
Run Code Online (Sandbox Code Playgroud)

javascript three.js

1
推荐指数
1
解决办法
3729
查看次数

标签 统计

javascript ×1

three.js ×1