Temp node

hello.



after getting my models node with



myModel.getchild(0);



every time I use this utility it change the part of model.



for example, if we think a human model, first time I try it gives me the arms second time it get head of my model.



is it usual? or weird.



how do I solve this??? I want to get same part of my model every time I try to get.



thanks a lot

getChild method doesn't modify model node, so getChild(0) must return always the same part.

I think you modify your model before, maybe with attachModel(getChild(0)) which detach part 0 from your model?



Try to debug and see model children changes.

pitchonel said:

getChild method doesn't modify model node, so getChild(0) must return always the same part.
I think you modify your model before, maybe with attachModel(getChild(0)) which detach part 0 from your model?

Try to debug and see model children changes.


somethings wrong with me, I have been worked on it for a while. But I cannot get over.
it is like crazy, always changing :S

Maybe the best solution is to get children with their names, like getChild("arm") and you will be sure that arm exists or not. I do like that every time I get part of an object.

pitchonel said:

Maybe the best solution is to get children with their names, like getChild("arm") and you will be sure that arm exists or not. I do like that every time I get part of an object.


in this way, it will be quite efficient but I dont know their exact names I can't find out. actually I search in the forum now, I found a post about this issue but it was not ended

http://www.jmonkeyengine.com/jmeforum/index.php?topic=8737.0

how do you find out their names ? would you explain it?
thanks

Hey,

well i guess you are talking about an imported model.

The prob with getCild(0) is, that the order of the modelparts is'nt consistent by importing the model.

So at first import the head gets ID 0, the next time the arm… thats the prob.



The solution is definately to get them by name. The names should be set within the modelling tool, but by experiance there are some probs as well. 3DS for example allows only names with 10chars length, and shortens long names during export.



But u can check the names by debugging, and take a look into every node's name.

Another solution may be using the scenegraphmonitor (check the forums), which allows u to observe your scenegraph. I guess nodenames are visible there. But i'm not sure, haven't used the SGM yet.

Another solution is to write a small, recursive loop, that iterates over your model and all childe nodes and prints out the names. Once u know the names, u can use them. They should be consistant during several imports.



Hope this helps.



Greetz

Imm0

I am working on it right now, you got the point I guess.



thanks.

Another solution may be using the scenegraphmonitor (check the forums), which allows u to observe your scenegraph. I guess nodenames are visible there. But i'm not sure, haven't used the SGM yet.


yes, the scenegraph shows all parts

I couldn't use the scene graph monitor but I look the names of nodes with the loop like you sad.

it write the console



temp1

temp2

temp3… and so on





importer gives the names itself and these are also changed :S



how do I make these constant.

a good question.

I think it depends on what model format u're using.

I had probs by loading models (and their names with .3ds, .obj and .dea) exported by 3DS / Blender

I guess its not only the jme importers fault, but the exporters from the model tools.



Check the modelfiles, and the included names, and look/debug into the the used jme-importer.

Maybe you'll find a pattern and are able to find a solution, or even be able to fix it.

I think it is very weird that in the flag rush tut. the programmer can reach the node easily and it is working properly.



I am working hard on it. but it seems to be it is very difficult to work with exporters.



I am using .obj format usually because .3ds is not efficient. I didnt understand either what is wrong with this .3ds type, it always appear wrong in the screen.



I plan that using "monkey world" tool to reach the part of model (in fact not reaching, but I try to merge my items in that tool.)(but I cant use this tool properly and there is not enough tutorial for this tool) :S



anyway I must find a solution.