Gho*_*ool 4 animation textures three.js
从昨天开始。我在页面刷新时交换 .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;
Run Code Online (Sandbox Code Playgroud)
如果替换材质,则必须确保将MeshBasicMaterial.skinning和/或MeshBasicMaterial.morphTargets设置为true。否则,材质将不支持骨骼和/或变形目标动画。
three.js R113