【发布时间】:2020-06-04 23:14:28
【问题描述】:
从yesterday 继续。我在页面刷新时换出 .GLTF 上的纹理。纹理现在可以正常工作了......
但仅限于没有动画的文件。然而,纹理更新似乎阻止了它们的字面意思。我不确定是什么原因造成的,也不知道如何重新加载动画。
代码如下:
var creaturePath = "models/gltf/creature/";
var creatureFile = "creature_roar.gltf";
// load the model
var loader = new GLTFLoader().setPath( creaturePath ); // creature
loader.load( creatureFile, function ( gltf )
{
gltf.scene.traverse( function ( child )
{
if ( child.isMesh )
{
// override textures
texture.flipX = false;
texture.flipY = false;
my_material = new THREE.MeshBasicMaterial({map: texture});
// child.material = my_material; // this is the problem line
texture.needsUpdate = true;
}
} );
var model = gltf.scene;
【问题讨论】:
标签: animation three.js textures