Three.js - 问题加载 Blender 模型
Three.js - Issue loading Blender model
我想导入一个搅拌机模型到three.js,但是我还没有成功。
这是我的:
<script src="GLTFLoader.js"></script>
// CHILDREN
children = new THREE.Object3D();
// Blender Model
var bld = (blend[4]).toString();
var loader = new THREE.GLTFLoader();
loader.load(bld,handle_load);
var mesh;
console.log(bld); // "/media/accounts/2878836292/2878836292.glb"
function handle_load(gltf) {
mesh = gltf.scene.children[0];
mesh.position.set(-50, 15, -50);
children.add(mesh);
// mesh.position.z = -10;
}
//cylinder
image = (images[0]).toString();
const texture1 = new THREE.TextureLoader().load(image);
const material1 = new THREE.MeshBasicMaterial({ map: texture1 });
geometry = new THREE.CylinderGeometry(0, 20, 40, 20);
var cylinder = new THREE.Mesh(geometry, material1);
cylinder.position.set(-90, 20, 30);
children.add(cylinder);
搅拌机型号:https://workupload.com/file/AEm5FgER
我在 Web 控制台中没有收到任何错误。
解决了。我不得不将模型缩放到 15 毫米以使其可见
我想导入一个搅拌机模型到three.js,但是我还没有成功。
这是我的:
<script src="GLTFLoader.js"></script>
// CHILDREN
children = new THREE.Object3D();
// Blender Model
var bld = (blend[4]).toString();
var loader = new THREE.GLTFLoader();
loader.load(bld,handle_load);
var mesh;
console.log(bld); // "/media/accounts/2878836292/2878836292.glb"
function handle_load(gltf) {
mesh = gltf.scene.children[0];
mesh.position.set(-50, 15, -50);
children.add(mesh);
// mesh.position.z = -10;
}
//cylinder
image = (images[0]).toString();
const texture1 = new THREE.TextureLoader().load(image);
const material1 = new THREE.MeshBasicMaterial({ map: texture1 });
geometry = new THREE.CylinderGeometry(0, 20, 40, 20);
var cylinder = new THREE.Mesh(geometry, material1);
cylinder.position.set(-90, 20, 30);
children.add(cylinder);
搅拌机型号:https://workupload.com/file/AEm5FgER
我在 Web 控制台中没有收到任何错误。
解决了。我不得不将模型缩放到 15 毫米以使其可见