Jump to content

Loading OBJ files with several objects with unique ID's


genvvk
 Share

Recommended Posts

Hi there, 

I have one single OBJ file with several objects within. Each element has its unique name.

Is it possible to load each object as a single mesh?

Tried to do this:

var parts = [];

obj.onSuccess = function (task) {  

       for(var i = 0; i < task.loadedMeshes.length; i++){

             parts.push(task.loadedMeshes[i]);
             parts[parts - 1].material = uniqueMat;

             ...

       }

}

But it seems that each next mesh / geometry has all previous ones like an avalanche. 

Loading OBJ with 5 similar spheres as a test

Geometry {delayLoadState: 0, _totalVertices: 266, _isDisposed: false, id: "c0d23769-a422-47c5-8060-fabd67a55b1a", _engine: Engine…}
main.js:254 Geometry {delayLoadState: 0, _totalVertices: 532, _isDisposed: false, id: "e83a4890-a107-425d-969c-eea1f356e200", _engine: Engine…}
main.js:254 Geometry {delayLoadState: 0, _totalVertices: 798, _isDisposed: false, id: "19b85286-2066-4ef7-9e95-bba19d906e71", _engine: Engine…}
main.js:254 Geometry {delayLoadState: 0, _totalVertices: 1064, _isDisposed: false, id: "22bc102d-1acc-4fa8-9576-77a9915e666f", _engine: Engine…}
main.js:254 Geometry {delayLoadState: 0, _totalVertices: 1330, _isDisposed: false, id: "3eb8eab7-1871-4fed-b484-c18fc881cb23", _engine: Engine…}
main.js:234 0

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...