跳出昨天的话题。我正在对页面刷新时的.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;
my_material.skinning = true;
和/或my_material.morphTargets = true;
。 - Mugen87ShaderMaterial
不会自动支持动画。你需要先添加相应的着色器代码。 - Mugen87