.obj および .mtl ファイルを aframe にロードできますが、.mtl ファイルからマテリアル名を取り出してオブジェクト onclick のこれらのマテリアルを変更したかったのですが、aframe でどのように行うのですか?
<a-entity id="model" position="0 0 -2">
<a-entity obj-model = "obj: #tree-obj; mtl: #tree-mtl" position="0 0 0" rotation="0 0 0" scale="0.8 0.8 0.8"></a-entity>
</a-entity>
次のようにthreejsで同じことを複製できます
object.traverse( function( child ) { if ( child instanceof THREE.Mesh ) {
if (child.material.name == "xyz") { //xyz from .mtl file
child.material = Black;// black is a meshphong material
child.castShadow = true;
child.receiveShadow = true;
}
}