.x models with children

Blitz3D Forums/Blitz3D Programming/.x models with children

Ken Lynch(Posted 2003) [#1]
I'm having a bit of a problem with loading DirectX models that have child entities. I'm using 3D Canvas to create my models and I'm using LoadAnimMesh to load them. Whenever I use CountChildren it always returns 1, no matter how many children I have.

Does anyone else use 3D Canvas or has anyone come across this before. I have no idea whether it is a bug in 3D Canvas's export or Blitz3D's import or whether I'm missing something obvious.


GfK(Posted 2003) [#2]
1. Are you loading it with LoadAnimMesh()? If not, you should be doing.

2. Otherwise, try this:
C = CountChildren(GetChild(Entity,1))
I'm not really sure how 3D Canvas exports models but someone has previously mentioned that some package or other creates a new pivot and parent the entire hierarchy to it prior to exporting. It might have been 3D Canvas....?


jhocking(Posted 2003) [#3]
Note that CountChildren will only return the direct child of the entity and not the children of those children. So for example if you have several objects linked in a chain (ie. each object is the child of the previous object and has one child) then even though the root object has several objects below it in the heirarchy CountChildren will only return 1, the number of children directly linked.

As a test of your art pipeline you may want to use FindChild. With that command you search directly for a specific object name and it will search along the entire heirarchy, not just the directly linked children.


Ken Lynch(Posted 2003) [#4]
Got it sorted. Canvas indeed has an extra level of heirachy, so you have to use something like:

mesh = LoadAnimMesh("blah.x")
mesh_scene = GetChild(mesh, 1)

and it is mesh_scene that contains the children I want.

Thanks for the help.