Problem importing obj

Hi,



I’ve quite recently started using jME, as Java3D really didn’t cut it. Now, my problem is that the geometry for one of my models is divided into different goups, that I animate programatically - i.e. propeller, different control surfaces etc. When trying to migrate this code to jME i run into problems as the geometry seems to be grouped according to material, and that the names of the geometry generated is temp0,temp1 etc. Many of my control surfaces are using the same material…



In Java3D, finding geometry by name and doing transforms on it was pretty straightfoward. Am I doing something wrong?



Kind regards,

Grey

The compact silence means I missed something rather obvious, right? :// Should probably go read the code, it’s just that I went with the binary distro… Oh well.



Regards,

Grey

Nah, it’s more that it’s a hard thing to go over without seeing the model and such. Maybe cep would have something to say here…

Hi Renanse,



The model should be reachable here: http://hirt.se:8091/@md=d&cd=//depot/searobots/src/se/hirt/searobots/resources/&cdf=//depot/searobots/src/se/hirt/searobots/resources/test-sub-reduced.obj&c=YwP@//depot/searobots/src/se/hirt/searobots/resources/test-sub-reduced.obj?ac=64&rev1=2



I made the original model in max and a friend of mine used Blender to reduce the number of polys.



Thanks for your time.



Kind regards,

Grey

Ok, looks like the convertion class ignores the names of the groups and meshes. Cep if you read this and can fix it, please post. Otherwise I’ll have a look in a week or so.

The obj loader groups things by material for efficiency. Allows for the minimum number of TriMesh objects that way. If you want to group by object you have two options:


  1. Edit your ObjToJme source file. You could have it look for "o" tags. Store an ararylist of "o" names. When addFaces is called, you would add the parts to the current object. Then change buildStructures to build from your object array instead of the materials list array


  2. Maybe load it with ms3d then convert to jME. MS3D should sort by object not material



    Let me know if you need more help

I agree. The obj format will forever be a work in progress because it supports numerous things that most people don’t even think about (like curves for instance). If you code a fix to support grouping by object, test it out on a few models of your own and off the Internet. And if it works, submit it for inclusion into jME. And if you need any help doing that let me know.

Hi Cep,



Sure, why not. How does the process work, i.e. how do I start contributing?



/Grey

Code the fix, then take what you’ve made and post to User Code. People will look at it and after a review period it will get commited if it’s something the developers agree with.