Converting FBX buffergeometry into ThreeJS geometry

I needed to convert a buffer geometry from an FBXloader to a standard geometry.

let myGeometry;
const loader = new THREE.FBXLoader();

loader.load( 'models/path_to_mesh.fbx',  ( object ) => {
  object.traverse(  ( child ) => {
      if ( child.isMesh && child.geometry.isBufferGeometry) {
         myGeometry = (new THREE.Geometry()).fromBufferGeometry(child);
      }
  } );
} );

Encountered the following error:

TypeError: THREE.Geometry is not a constructor

I attempted creating a simple geometry and received the same error:

const geo = new THREE.Geometry();

Using Three.min 127dev version

Appreciate your help in advance

Answer №1

The THREE.Geometry object has been removed from the core library since version r125. However, it is still accessible as an ES6 module in the examples directory, at least up to version r126. If you need to use it, you can import it as follows:

import { Geometry } from 'three/examples/jsm/deprecated/Geometry.js';

It is advised not to rely on this class anymore, as other engine components like helpers, exporters, and renderers have ceased support for it.

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

Difficulty in locating elements within ngView-loaded elements using jQuery [AngularJS]

I am attempting to retrieve the offset().top of an element <div class='profile'></div> located within a ngView controlled by app.js. However, I encounter an error in the console: Uncaught TypeError: Cannot read property 'top&a ...

Minimize CPU consumption in your threejs application

I've been working on a project where I'm coding Snake in Threejs (I know there are simpler methods). Everything works smoothly until the snake reaches a certain size, causing CPU usage to spike to 50% or more and freezing the entire browser tab. ...

Handling error reporting using JSON in jQuery AJAX post success

UPDATE: I have resolved the PHP errors mentioned in previous Answers, however, the issue still persists. I am attempting to implement an error message display in case of a failed POST request and a success message for successfully completed requests. Curr ...

Managing JWT and refresh tokens in a client-side Express application: Best practices for handling authentication tokens

Hello everyone, I am currently working on two express applications. One is dedicated to the backend where I have set up a REST API for all CRUD operations to the database. The second application serves as the client, structured separately in Express. Here ...

Tips for adjusting the text color of input fields while scrolling down

I am currently working on my website which features a search box at the top of every page in white color. I am interested in changing the color of the search box to match the background color of each individual page. Each page has its own unique background ...

Surprising use of template string value

After following a tutorial, I decided to create ProductScreen.js and Product.js. However, when implementing my code, I encountered some warnings. Can anyone help me identify the issue? product.js import React from 'react' import Rating from &apo ...

Encountering the "Invalid Element Type" error in a Vue Native project right after setting it up

After creating a vue-native project with the command vue-native init henry-pager, I navigated to the directory and initiated the online builder by running expo start. However, when attempting to run it on the web platform, an error message appeared: Error: ...

MongoDB Sorting Techniques

I'm struggling to figure out how to retrieve an ordered list from MongoDB data. I need to fetch the results from a Mongo collection using return and .find(), structured like this: For instance, let's say I have one collection for cars with 10 do ...

Implementing global event callback in JavaScript

Is there a way to globally add an `onerror` function for the `div.circle_thumb>img` event? Instead of adding an `onerror` event to each img tag individually, such as shown below. <div class="circle_thumb" ><img src="some/url" onerror="this.sr ...

The functionality of Ajax autocomplete with jQuery does not function properly when the text field contains existing text

Currently, I am utilizing Ajax autocomplete for jquery in my project. Below is the HTML code snippet I have implemented: <input type="text" name="autocomplete" id="globalBCCAutoComplete"> Furthermore, here is the JS code utilized for the autocomple ...

Checking for the existence of a Vue.js component

In the ready: method of the root instance, I have certain tasks to perform but only if some components are not present (not declared in the HTML). Is there a way to verify the existence of a component? ...

Using JQuery, a button is programmed to take a URL and then proceed to submit

My application is designed to shorten URLs for users who are authenticated. The form only requires the full URL input, and it will then generate a shortened version of the link. I am interested in creating a button that can be embedded on pages with long, ...

Failure to trigger on change event

I am struggling with dynamically generating input fields of the file type. Unfortunately, when I attempt to access its triggered event, nothing seems to happen. Below is the code snippet for the dynamic input file: <div id="documentlist" class="col-lg ...

What is the best way to add a sliding effect to this presentation?

https://www.w3schools.com/howto/tryit.asp?filename=tryhow_js_slideshow I am attempting to create a sliding effect for image transitions instead of the typical fade in and out. However, I'm uncertain about how to approach this challenge. My concept i ...

An easy guide to comparing date and time using Moment.js

Hey there, I'm looking for some help in validating two instances of date time moments. I am using this helpful Package which allows us to select hour, minute, and second. I want to validate whether the selected date time is before or after, as shown i ...

Pictures that can be chosen in a fashion similar to checking off a box

I am just starting out in the world of web development and I have a specific idea in mind. I want to create images that act like checkboxes, where only one can be selected at a time. Here is an example of what I'm looking for: https://i.sstatic.net/Nu ...

Error: Unable to load L.GeometryField constructor in django-leaflet library

I'm having trouble saving a geolocation to a Postgres database using Django-leaflet. I keep getting an error message that says Uncaught TypeError: L.GeometryField is not a constructor. My code involves AJAX calls. <script> var csrftoke ...

Installation of a cloned Parse server

I downloaded the Parse server repository from parse-server-example and set up MongoDB, as well as installed Node.js packages using npm install. However, when I try to start the app with npm start, I encounter this error in the terminal!! How can I resolve ...

Sometimes Google Maps API doesn't load properly on my page until I hit the refresh button

Occasionally, I encounter a problem where my Google Map fails to load when the webpage is first opened, resulting in a blank map. However, upon refreshing the page, the map loads correctly. The error message appearing in the Chrome console reads as follow ...

What is the best way to update state for changing colors?

I have a specific condition that requires setting the state properly. However, when I attempt to do so using setColor within the if method, an error occurs - "Too many re-renders. React limits the number of renders to prevent an infinite loop." State: con ...