3d models

I've been working with anim8tor for some time now and can build some pretty nice models.  When building my models they usually consist of many different objects … leftLeg, rightLeg, window1 … ect. At this time I export my models in 3ds … My question is when I load the model with JME is there a way to access each individual object my model is build from … or is it always accessed as a whole. I figure being able to interact with each individual piece could lead to some very cool effects.

phmenard said:

I've been working with anim8tor for some time now and can build some pretty nice models.  When building my models they usually consist of many different objects ... leftLeg, rightLeg, window1 ... ect. At this time I export my models in 3ds ... My question is when I load the model with JME is there a way to access each individual object my model is build from ... or is it always accessed as a whole. I figure being able to interact with each individual piece could lead to some very cool effects.


Just look at the scene tree after attaching the import.  Doesn't require anything other than Node.getChildren(), Spatial.getName() and Spatial.getClass().

I thought so … I just wanted to be sure before I begun building the models I need. Hey thanks blaine … you've been a huge help with all  my questions. I tried this … just as a test … 



Node.getChild("window1").getLocalRotation().fromAngles(0, rotateAngle,0);



This worked just as I predicted … the object rotates about the z axis but its the z axis from the center of the model as a whole not the center of the object itself. I wanted to use updateGeometry() to ajust the center but updateGeometry() is not defined for the type Spatial. I'm figuring with a little math I can work this out but like with the initial reason for starting this thread if there is a method attached to a Spatial for this then by all means help me out … I hate reinventing the wheel … I seem to find myself doing it all the time.

phmenard said:

...
This worked just as I predicted ... the object rotates about the z axis but its the z axis from the center of the model as a whole not the center of the object itself. I wanted to use updateGeometry() to ajust the center but updateGeometry() is not defined for the type Spatial. I'm figuring with a little math I can work this out but like with the initial reason for starting this thread if there is a method attached to a Spatial for this then by all means help me out ... I hate reinventing the wheel ... I seem to find myself doing it all the time.


It makes no sense to run updateGeometry() on a non-Geometry Spatial.  Those methods are clearly implementation-class-specific, so you must cast before using.  I told you the methods you can use to find the exact class of each Spatial that you have to work with.  Use the jME API Spec to see what you can do with those classes.

I don't know about 3ds imports, because I don't use them.  I know that imports from HottBJ perserve origins of all meshes as they are in the source models.