从 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;
最佳答案
如果更换 Material ,必须确保设置MeshBasicMaterial.skinning和/或 MeshBasicMaterial.morphTargets至 true
.否则 Material 将不支持骨骼和/或变形目标动画。three.js R113
关于animation - 更新的纹理在three.js 中停止动画,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60323149/