Three.js: Loading DAE Files

Having trouble loading a DAE file in Three.js. Can anyone offer some assistance?

I have the model.dae file in the same directory as my index.html, but when I load the page, it's just showing a black screen.

I originally had an FBX file and exported it to FBX_DAE using Maya.

<html>
<head>
    <title>My first Three.js app</title>
    <style>canvas { width: 100%; height: 100% }</style>
</head>
<body>
    <style type="text/css">
        html, body {
            margin:0;
            padding: 0;
        }
    </style>
    <script src="js/three.min.js"></script>
    <script src="js/ColladaLoader.min.js"></script>
    <script>
        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, window.innerHeight );
        document.body.appendChild( renderer.domElement );

        loader = new THREE.ColladaLoader();
        loader.load('model.DAE',function colladaReady( collada ){
        player = collada.scene;
        skin = collada.skins [ 0 ];
        scene.add( player );
        });

        /*
        var geometry = new THREE.CubeGeometry(1,1,1);
        var material = new THREE.MeshBasicMaterial( { color: 0x00ff00 } );
        var cube = new THREE.Mesh( geometry, material );
        scene.add( cube );
        */

        camera.position.z = 5;

        function render() {
            requestAnimationFrame(render);
            renderer.render(scene, camera);

            //cube.rotation.x += 0.1;
            //cube.rotation.y += 0.1;
        }
        render();

    </script>
</body>
</html>

Answer №1

It seems like there might be an issue with how you are loading the ColladaLoader.

The correct way to load it should look like this:

<script src="js/ColladaLoader.js"></script>

Instead of the incorrect way shown below:

<script src="js/ColladaLoader.min.js"></script>

If this is indeed the problem, an error should be displayed in the console.

Answer №2

In order to successfully load the .dae files, it may be required for you to execute your sample on a web server as JavaScript prohibits file access on a client side for security purposes.

Answer №3

Dealing with DAE-Files from Cinema4D has been a struggle for me too. I found that the best solution was to first export an FBX from C4D, then import it into Blender and finally export the DAE file using Blender.

It seems like there might be some issues with C4D's DAE Exporter.

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

Having Trouble Parsing JSON Object with JQuery?

I'm having trouble extracting data from a valid JSON object using jQuery/JavaScript - it always returns as 'undefined'. var json = (the string below). var obj = $.parseJSON(JSON.stringify(JSON.stringify(json))); alert(obj); // aler ...

When comparing TypeScript class functions with regular functions and variables, which one yields better performance?

When it comes to defining functions, is it better to use variables or functions directly? Also, how does this affect tree-shaking? I am dealing with a lot of calculation-intensive helper classes and I am unsure about the optimal approach in terms of memor ...

Unable to generate two tables

I have a dynamic table creation issue. The tables are meant to be created based on the user's input for the "super" value. For example, if the user inputs "2" for super, then it should create 2 tables. However, this is not happening as expected becaus ...

Tips for setting up listeners across multiple modules using socket.io

Last year, I created a multiplayer game using node.js and socket.io. Now, as part of my efforts to enhance the game, I am working on breaking down the code into modules. Currently, I am utilizing expressjs 4.4 along with socket.io 1.0. One challenge I enco ...

The ng-change and onchange events are not functioning as expected for the input field with the type "file"

<button ng-click="controller.foo()">Click<button> is functioning properly. However, <input type="file" ng-model="logo" onchange="controller.foo()"> seems to be malfunctioning. Additionally, <input type="file" ng-model="logo" ng-ch ...

Exploring the capabilities of using Next.js with grpc-node

I am currently utilizing gRPC in my project, but I am encountering an issue when trying to initialize the service within a Next.js application. Objective: I aim to create the client service once in the application and utilize it in getServerSideProps (wit ...

Set $scope.model childs to an empty string or a null value

While working on a form, I am using a $http request to send the information through Angular in the following manner: $http({ method:"POST", url: "controllers/servicerequest.php", data: { servicerequest: $scope. ...

Issues with template literals not displaying line breaks

I am working with a template literal on node8.1.2 let gameDayReport = `Next 7th Day: ${nextSeventh} ${gameHours} : ${gameMinutes} Day: ${gameDay}` When I view it in my browser, the text appears as a single line instead of retaining the line breaks. It se ...

Error: Calendar tool malfunctioning within duplicated element

Struggling with cloning accordion using a datepicker. Despite researching online, the cloned datepicker is not functioning properly. When the user selects a date from the original datepicker, everything works as expected. However, when the user clicks the ...

Is there a way to arrange elements in an array based on the second value in each nested array?

I need help organizing an object {a: 1, b: 20, c: 3, d: 4, e: 1, f: 4} into the following format {a: 1, e: 1, c: 3, d: 4, f: 4, b:20} (sorting the object numerically in ascending order) using a specific set of steps. Here are the steps I have outlined: ...

Instructions for transforming rows into columns in JSON format

Looking to convert an array of JSON objects into a format where rows become columns and the values at the side become column values, similar to the crosstab function in PostgreSQL. The JSON data looks something like this: {"marketcode":"01","size":"8,5", ...

Using bootstrap can alter the positioning of elements that have margins relative to other elements

After exploring suggestions from my previous post on Stack Overflow, I have implemented a modified version to animate drag movements. While the HTML5 draggable attribute can achieve dragging, its limitations and side effects are something I aim to avoid. ...

Troubleshooting: Issues with Angular form validation functionality

I am completely new to Angular and attempting to create a signup form. Despite following tutorials, the form I've built doesn't seem to be validating properly. Below is the code that I have been using: <div class="signup-cont cont form-conta ...

Changing the color of a specific span using Angular

I am working with a dynamic mat-table where columns are added and populated on the fly. The table headers are styled using divs and spans. My goal is to change the color of a header to black when clicked, but also un-toggle any previously selected header. ...

Encountering a syntax error with the AngularJS ng-class expression

While navigating through a tutorial application designed for use with the Ionic platform, which is based on angular 1.2.4, I encountered a perplexing error in this Angular markup: <content has-header="true" scroll="false"> <list> ...

Could you advise on the best placement for my upcoming JQuery animation?

Here is the code I am currently working with: $(function() { $("button").click(function() { $("#box1").animate({ left: $(window).width() - 800 }, { complete: function() { $("#box1").hide(); } }); $("#box2").a ...

Difficulty in toggling the visibility of the react-date-range picker package when selecting a date

I need assistance with a problem I'm facing. I am having trouble hiding and showing the react-date-range picker upon date selection. The issue is related to a package that I am using for date range selection. You can find the package link here - https ...

Tips for altering the value of a previously checked checkbox in jQuery

My current task involves creating a form using JavaScript. There is an option to add an address dynamically by clicking on a specific link that triggers the function addNewAddress(). The form layout includes input fields for Address Line 1 and Address Lin ...

Troubleshooting Material-UI: The Mystery of the Missing Dialog

I have been struggling with getting a pop-up dialog to appear when a form is incorrectly filled out. Despite my efforts, the code that should trigger the dialog upon submission does not seem to be working as expected. The function renderError(), responsib ...

Pass an item along with its superclass using express

Is there a way to send an object from an express server and then check the instanceof of that object on the receiving end? I am working on integration tests for express and need to verify the instanceof of the response body. Unfortunately, it seems like t ...