Buenos días
he realizado un pequeño script para convertir obj a fbx. paso el documento y no se me descarga el archivo convertido. no se que hago mal.
---HTML---
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Conversor OBJ a FBX</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r128/three.min.js"></script>
<script src="https://cdn.rawgit.com/mrdoob/three.js/r128/examples/js/loaders/OBJLoader.js"></script>
<script src="https://cdn.rawgit.com/mrdoob/three.js/r128/examples/js/loaders/FBXLoader.js"></script>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<h1>Conversor OBJ a FBX</h1>
<input type="file" id="objFile" accept=".obj">
<button id="convertBtn" disabled>Convertir a FBX</button>
<div id="canvas"></div>
<script src="script.js"></script>
</body>
</html>
---SCRIPT---
var objFile = document.getElementById("objFile");
var convertBtn = document.getElementById("convertBtn");
var canvas = document.getElementById("canvas");
var scene = new THREE.Scene();
var camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000);
var renderer = new THREE.WebGLRenderer();
renderer.setSize(window.innerWidth, 600);
canvas.appendChild(renderer.domElement);
var objLoader = new THREE.OBJLoader();
var fbxLoader = new THREE.FBXLoader();
objFile.addEventListener("change", function() {
var file = this.files[0];
var reader = new FileReader();
reader.onload = function() {
var result = reader.result;
var object = objLoader.parse(result);
scene.add(object);
convertBtn.disabled = false;
};
reader.readAsText(file);
});
convertBtn.addEventListener("click", function() {
var output = fbxLoader.parse(scene);
var blob = new Blob([output], {type: "application/octet-stream"});
var url = URL.createObjectURL(blob);
var link = document.createElement("a");
link.href = url;
link.download = "output.fbx";
link.click();
});
camera.position.z = 5;
function animate() {
requestAnimationFrame(animate);
renderer.render(scene, camera);
}
animate();
(No se puede continuar esta discusión porque tiene más de dos meses de antigüedad. Si tienes dudas parecidas, abre un nuevo hilo.)