我正在从threejs中导出孩子的位置和轮换,并注意到他们似乎都错了。这是一个三元组外观的示例
这是在给定位置和旋转下将相同对象导入Blender中时的外观
由于许多原因,我不是导出完整的.gltf或.obj文件,而只是导出转换数据。这是函数:
scene.traverse(function(child){
if (child instanceof THREE.Mesh){
child.updateMatrixWorld();
const rotMat = new THREE.Matrix4();
child.matrixWorld.extractRotation(rotMat);
var the_world_pos = new THREE.Vector3();
var the_world_rot = new THREE.Euler();
child.getWorldPosition(the_world_pos);
the_world_rot.setFromRotationMatrix(rotMat);
exportTokenToTxt(// another function to export to a txt file
child.name,
child.material.name,
[the_world_pos.x,the_world_pos.y,the_world_pos.z],
[the_world_rot.x,the_world_rot.y,the_world_rot.z]
);
}
});