Having trouble loading a model converted from FBX to JSON using THREE.JSONLoader

I recently converted an FBX model to JSON using a Python script called convert-to-threejs.py. However, I am encountering issues trying to load it into three.js (r58). An error message stating "Uncaught TypeError: Cannot read property 'length' of undefined" keeps popping up at line 9930 in three.js, specifically within the code block

for ( i = 0; i < json.uvs.length; i++ ) ...

If you take a look at the converted JSON file here: http://pastebin.com/86ZGvKnW, you'll notice that it does not contain a uvs property.

Could it be that convert-to-threejs.py is outdated? If so, what other tools can I use instead? If not, how should I proceed to successfully load this model?

Below is the snippet of code I have been using:

window.loader = new THREE.JSONLoader();
loader.load('jet.json', function(geometry) {
    // Unfortunately, this part never executes due to the error occurring beforehand
    console.log(geometry);
});

Answer №1

Ah, I understand now. The specific model can be found within the JSON file. My desired choice is embeds["Embed_31_jet 3"].

Answer №2

When FBX files are converted to JSON, they provide a detailed description of entire scenes. Instead of using THREE.JSONLoader, it is recommended to utilize THREE.SceneLoader.

For instance

  var scene = new THREE.Scene();
  var camera = new THREE.PerspectiveCamera(...);

  var loader = new THREE.SceneLoader();
  loader.load('jet.json', function(res) {
      scene.add(res.scene);
      renderer.render(res.scene, camera);
  });

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Retrieving properties from a URL pathname using React.js

Struggling to retrieve the uid and token from the URL pathname in my React application using the match method. However, encountered an error: Uncaught TypeError: n is undefined Here's the snippet of the code: const ResetPasswordConfirm = ( {match, ...

PHP Dropdown List - Default option should be set to "all" (or "Alle")

My website displays data to users based on the State they reside in, with a filter provided through a drop-down list allowing them to select any specific State or view data from all States. Currently, the default selection shows the user data from their ow ...

The asynchronous ajax request is leading to a browser freeze

In the HTML page, I have two sets of a and p elements that are initially set to display:none. At the bottom of the page, there is a function being called with their respective ID's and values, which will enable one of them based on certain conditions ...

Using JavaScript to pass a variable into a Promise

I am currently working on a project in EmberJS that involves making an Ajax request to fetch information and then resolving based on a specific part of the response that may vary. return new Promise((resolve, reject) => { const { resourceName, i ...

Error 56 EROFS encountered when trying to save a file in Node.js filesystem every 2 seconds

I've set up a node.js environment on my raspbian system and I'm attempting to save/update a file every 2/3 seconds using the code below: var saveFileSaving = false; function loop() { mainLoop = setTimeout(function() { // update data ...

Button placed within a jade table cell

I'm struggling to make a button appear in each row of the table. I am new to working with Jade and Node.js, so I can't seem to figure out why it's not showing up. Here is my Jade file: html head body table.table.table(border='1 ...

React App with Material UI V1-beta Integration

I just installed the Create React App example from Material-UI.com. curl https://codeload.github.com/callemall/material-ui/tar.gz/v1-beta | tar -xz --strip=2 material-ui-1-beta/examples/create-react-app Upon installation, I encountered the following erro ...

Loading times for the Polymer Project are sluggish

The website design is very appealing. However, it seems to be loading quite slowly even on Google's servers. Is there a way to speed up the initial load time of the Polymer site? Additionally, there are numerous HTTP requests being made; is there a wa ...

What is the best approach to comply with the EsLint rule "react-hooks/exhaustive-deps" and properly implement componentDidMount using hooks in React with a warning level?

After reviewing the React documentation, it appears that componentDidMount is now implemented using hooks as shown below: useEffect(() => { // your code here }, []) For example, if you wish to make an API call within this hook: useEffect(() => { ...

Changes on services do not affect the Angular component

Currently facing an issue with my Angular assignment where changing an element's value doesn't reflect in the browser, even though the change is logged in the console. The task involves toggling the status of a member from active to inactive and ...

Having difficulty resolving all parameters for the component: (?, [object Object]) in the Jasmine component Unit Test

While defining a UT for a component with an extended class using i8nService and ChangeDetectionRef, I encountered an error preventing me from instantiating it: Failed: Can't resolve all parameters for BrandingMultiselectComponent: (?, [object Object] ...

Adjust the size of an image with jquery without relying on server-side scripts

I am currently developing an application for Samsung Tizen TV that displays images from live URLs. On one screen, there are approximately 150 images, each with a size of around 1 MB and a resolution of 1920 by 1080. Navigating between these items has bec ...

Neither the context nor props contain the element 'store' that you are searching for

Just stepping into the world of React can be overwhelming, but I'm determined to get my page to render properly: import React, { Component } from "react"; import { connect } from "react-redux"; import Header from '../components/Header'; imp ...

Title of a property left `undetermined`

When dealing with a class, it is possible to retrieve the name of a defined property or function. For instance, the class name can be obtained using the following code snippet... console.log(`${this.constructor.name} is my name); Similarly, the name of a ...

An issue arose in nodejs when attempting to use redirect, resulting in the error: "Error [ERR_HTTP_HEADERS_SENT]: Unable to modify headers after they have

I am currently working on a project where I encountered an unexpected error. My goal was to redirect the server to specific routes based on certain conditions, but I am facing difficulties. routes.post("/check", (req, res) => { console.log(& ...

Error: React unable to locate module './WebpackMissingModule'

Recently I started diving into React, and I'm encountering some difficulties trying to export components. Here is my current index.js file setup: import React from 'react'; import ReactDOM from 'react-dom'; import SearchBar from ...

Transforming a JSON structure into a tree model for use with the angular-tree-control component

I need help converting a complex JSON schema into a format compatible with Angular Tree Control. The issue is that the schema does not follow the required treemodel structure for Angular Tree Control, particularly because the children in the schema are not ...

Is there a way to eliminate a div and all its contents from the DOM?

As I work on my web application, I am trying to implement a system where error messages can be returned via ajax upon success or failure. The ajax script is functioning correctly in terms of returning errors or successes. However, my challenge lies in com ...

Undefined elements in an array of objects in Javascript

I've been working on creating an array of objects in JavaScript, but I'm facing an issue when attempting to print the array to the console in Chrome. It keeps returning undefined unless I print the array right after pushing new elements into it. ...