0

And how can I solve this issue? Me trying to load an object into Three.js file that I have loaded in my web browser I am trying to load an image of this https://clara.io/view/5a3b1964-df03-4695-8464-787472eb023a#

into a Three.js tutorial that I am using to learn the library. But I am at a loss for what is going on. I looked at the documentation and what I have is what is shown. https://threejs.org/docs/index.html?q=loader#api/en/loaders/ObjectLoader.parseImages

I have tried using the <script type="module" src="...."></script> way, but that seems to cause more problems. Then I start getting 404'd.

I have tried creating an object, since my error was saying that my object was undefined.

 var loader = new THREE.ObjectLoader();
    var object = new Object();
    object.loader = 'Models/amy.json',
    loader.load(
            'Models/amy.json',
            
            function( object ) {
                scene.add( object );
            }
        );

and I am still obtaining the same error message as above

This is how I am introducing my scripts, most importantly my ObjectLoader

<script src="js/three.js"></script>
<script src="js/OrbitControls.js"></script>
<script src="js/ObjectLoader.js"></script>

I am also confused as to the "cannot use import statement outside of a module". Does that mean that I should be again defining my <script> to a module, although it returns a larger amount of errors?

Sebastian Simon
  • 18,263
  • 7
  • 55
  • 75
  • Why do you focus on that error first? Not loading the module correctly seems to be the bigger issue here. You don’t have “a UUID issue”, you have undefined variables that are never set correctly. That’s what the error message is trying to tell you. – Sebastian Simon Sep 18 '21 at 22:21
  • I'm unsure of what you mean. which variables are undefined? The variables needed are defined? Please elaborate. – goldwind1111 Sep 18 '21 at 22:26
  • The error message says “Cannot set property '`uuid`' of `undefined`”. Whatever the `uuid` property is being set on is `undefined`. Don’t focus too much on the property name. Something is undefined that shouldn’t be. The module, if correctly loaded, will set the correct variables; that’s why this error message comes _first_ and you should fix that _first_. So use ` – Sebastian Simon Sep 18 '21 at 22:29
  • JS files that use `import` and `export` _must_ be loaded with `type="module"`. The number of errors is irrelevant. Which resource(s) exactly get the 404 status? See the Network tab in your developer tools and check the response and the URL of each file. – Sebastian Simon Sep 18 '21 at 23:35
  • I've changed it. things like: ScriptLOD.js ScriptMesh.js ScriptSkinnedMesh.js ScriptBone.js ScriptSkeleton.js ScriptShape.js ScriptFog.js Are met with "Failed to load response data" So I am guessing that it is still referring back to my undefined object, that I am trying to define. By me not defining it properly, I am not allowing Three.js to utilize these things? – goldwind1111 Sep 18 '21 at 23:40

0 Answers0