Incorrect bone positions in Object3D after conversion to json

65 Views Asked by At

I want to export my scene (there is only one 3D humanoid object in the scene) and convert it to .json format. After that, I import that .json into threejs-editor. The result is that my model doesn't look right. As I understand it - all the bones are positioned at the zero point. What am I doing wrong and how can I fix it?

Below is the code to load the model in .json format.

Thank you in advance.

function saveString( text, filename ) {
    
    save(new Blob([text], {type: "text/plain",}), "scene.json");

}

function createJSONFunction() {
  let output = scene.toJSON();
  output = JSON.stringify( output );
  metadata = `"metadata":{"type":"App"},"project":{"shadows":true,"shadowType":1,"vr":false,"physicallyCorrectLights":false,"toneMapping":0,"toneMappingExposure":1},"camera":{"metadata":{"version":4.5,"type":"Object","generator":"Object3D.toJSON"},"object":{"uuid":"${camera.uuid}","type":"PerspectiveCamera","name":"Camera","layers":1,"matrix":[0.8551272907805305,1.3877787807814457e-17,0.5184180905045175,0,0.13009003113625428,0.9680035450955323,-0.2145826658457063,0,-0.5018305494500295,0.25093651922843285,0.8277662489834916,0,-5.6106361087816765,2.805555575159794,9.254708011035515,1],"fov":50,"zoom":1,"near":0.01,"far":1000,"focus":10,"aspect":1.9214145383104126,"filmGauge":35,"filmOffset":0}}`;     
  result = `{${metadata},"scene":${output}`;
  saveString(result);

}

threejs/editor view

0

There are 0 best solutions below