What is preventing ColladaLoader.js in Three.js from loading my file?

Recently, I decided to experiment with three.js and wanted to load a .dae file called Raptor.dae that I obtained from Ark Survival Evolved. Despite having some web development knowledge, I encountered an issue when trying to display this particular file in a WebGL scene on my HTML page.

To remedy the cross-origin error preventing me from directly opening the HTML file, I set up a flask server to serve the assets. Everything seemed to be working fine until I attempted to load the Raptor.dae file, unlike the demo elf file which loaded successfully.

The problematic section of code where the Raptor file is supposed to be loaded is as follows:

var raptor
// loading manager
var loadingManager = new THREE.LoadingManager( function() {
    scene.add( raptor );
} );
// collada
var loader = new THREE.ColladaLoader( loadingManager );
loader.load( './static/models/Raptor/Raptor.dae', function ( collada ) {
    raptor = collada.scene;
    raptor.scale.set(0.1,0.1,0.1);
} );
loader.setCrossOrigin( '' );

This led to the following error message:

Navigated to http://127.0.0.1:5000/raptor
THREE.WebGLRenderer 89
THREE.ColladaLoader: DOMParser: 4.136962890625ms
...
Uncaught TypeError: Cannot read property 'childNodes' of undefined
...

If you want to take a closer look at these files mentioned in the error, here are the links:

three.js

ColladaLoader.js

elf.dae in three.js repository

Raptor.dae on Google Drive

I've compared the Raptor.dae and elf.dae files, but couldn't pinpoint what's causing the issue. Any assistance would be highly appreciated.

Answer №1

After successfully loading your COLLADA model in Blender, it seems there may be a bug within THREE.ColladaLoader. It is recommended to report this issue on the three.js repository with all relevant details.

In the meantime, you can try converting the model to glTF using a specialized blender exporter, which has been known to work well with three.js using THREE.GLTFLoader.

Access the converted glTF file on Google Drive here: https://drive.google.com/open?id=1h8po_76L3AgRMpIAF8sQtdTKLntHSAQG

For a preview of the result, visit:

See the successful conversion outcome below:

Answer №2

Upon further investigation, a glitch was discovered in the script that was causing issues with parsing the XML data accurately. Instead of assigning the correct value of "ID9" to the top most bone, it was incorrectly set to "ID8". This misalignment caused confusion as "ID8" was intended for the visual scene.

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

How can I delay the loading of a link until the pop-up is closed?

I have successfully implemented a pop-up on my website, but I am facing an issue where I need to prevent any linked pages from loading until the visitor clicks on the accept button. However, I am struggling to make it function as intended. Below is the sn ...

JavaScript: Closing a Tab

Using AngularJS for my project and I have a link that opens a tab. If the user right clicks on the link and selects open link in new tab, then on the page abc.html I have code like $window.close(); which is not working as expected. I am receiving the error ...

What is the best way to import the axios post method from a JavaScript file into a Vue component

I'm encountering an issue when trying to export the data received from the API in my JavaScript file and display it in my Vue file. Currently, I am sending a security JSON to the server using the POST method. Although I am able to retrieve the output ...

What is the best way to utilize functions in Express to dynamically display content on my Jade template?

I have successfully implemented a user registration and login page, but now I need to determine what content to display based on whether the user is logged in. I found this solution: app.use(function(req, res, next) { db.users.find({rememberToken: req.c ...

Testing API route handlers function in Next.js with Jest

Here is a health check function that I am working with: export default function handler(req, res) { res.status(200).json({ message: "Hello from Next.js!" }); } Alongside this function, there is a test in place: import handler from "./heal ...

AngularJS factory architecture for multiple functions

It's not the exact data I'm using in my project, but I'm simplifying it for demonstration purposes. In my AngularJS app, I have a factory like this: myApp.factory('inputinfo', function () { var self = { test: function (in) { ...

My JavaScript if-else statement isn't functioning properly

I'm facing an issue with my if statement not functioning correctly when trying to validate non-numeric inputs for the weight variable upon submission. What could be causing this problem? submitBtn.onclick = function(){ var name = document.get ...

How to retrieve values from a nested array in a Next.js application

I am diving into the world of nextjs and apollo for the first time, and I am currently facing a challenge with using .map to loop through database results. Below is the code for my component: import { gql, useQuery } from "@apollo/client" import ...

Issue with ng-bind-html in TranslateJS causing problems

I have been working on implementing translation in a web application using angularJS and the angular-translate repository, which can be found at . As per the documentation, it is possible to use this repository to set text for a specific element in the HTM ...

A guide on incorporating a Java loop with Selenium automation

// Searching and deleting process driver.findElement(By.cssSelector("input[type='search']")).sendKeys("Diversification Rule Template"); driver.findElement(By.className("delete-template")).click(); Alert alert = driver.switchTo.alert(); Thread. ...

What changes do I need to make in order for this code to be compatible with Google Sites?

I am working on creating a random redirect button and need to modify the code below in two ways: <script> <!-- /* Random redirect button- From JavaScript Kit (http://javascriptkit.com) Hundreds of scripts available for free! Please keep this cred ...

Unable to access property within JSON object sent via POST request

I encountered an issue TypeError: Cannot read property &#39;tasks&#39; of undefined While attempting a new POST request on my API, here is the request body I am using: { "name": "example1", "description": "teaching example1", "rules" ...

Dynamic SVG circles with timer and progress animation

Is there a way to modify the following: var el = document.getElementById('graph'); // get canvas var options = { percent: el.getAttribute('data-percent') || 25, size: el.getAttribute('data-size') || 220, lineW ...

Unexpected token error occurs when making cross-domain AJAX requests to the server and receiving a JSON object

I have set up an express server to handle get requests to specific url endpoints. When responding to these requests, I am sending back data in JSON format to enable making Ajax calls and retrieving data from the page. To allow for cross-domain requests, I ...

JavaScript getting overshadowed by other JavaScript libraries

My current CMS, Liferay, heavily relies on jQuery for various functions. Recently, I introduced a new feature to our website using fancybox. However, I realized that this new addition was causing issues with other jQuery functionalities on the page. Remov ...

How to insert a row above the header in an Excel sheet using JavaScript within

i am using excel js to export json data to excel. The json data is successfully exported to the sheet, but now I need to add a row that provides details of the sheet above the header text. for more details please refer image the code is shown below: i ...

Tips for continuing code execution in an ajax success function following the completion of a nested ajax call within the success block

I am facing an issue with a function that utilizes $.ajax. In the success section of the function, I have three nested functions. The first one executes properly, but the second one contains another $.ajax call. While the internal $.ajax call works fine, t ...

A guide to resizing images in Node.js prior to using the writeFile function

var file_path = files.file.path; fs.readFile(file_path, function (err, data) { fs.writeFile(file_path, data, function (err) { res.end(JSON.stringify({ message: 'file uploaded successfully', success: true }); }); }); I exp ...

Django Vue3 encounters access-control-allow-origin restriction

I am currently working on a Django rest-api project that uses Vue on the front-end. Unfortunately, I encountered an error while making requests via Vue: Console output: The following error is displayed: Access to XMLHttpRequest at 'https://api.iyziw ...

When new AJAX content is loaded, Isotope container fails to properly target the new objects and instead overlaps the existing ones

My webpage loads all content through an AJAX call. Initially, I tried placing my isotope initialization code inside a document ready function, but it didn't work as expected: $(function(){ container = $('#content'); contain ...