FindChild problem
Blitz3D Forums/Blitz3D Programming/FindChild problem
| ||
I've created a tree in Milkshape with two groups (child entities) called Trunk and Leaves, then exported as a .B3D. So that I can fly, climb, etc through the leaves but bump into the trunk, I want to set the collisions separately: [CODE] parent = LoadAnimMesh("Tree1.b3d") child = FindChild(parent,"Leaves") If child <>0 EntityType child,0 EntityPickMode child,0 EndIf child = FindChild(parent,"Trunk") If child <>0 EntityType child,TYPE_OBJ, False EntityPickMode child,2 ; polygon EndIf [/CODE] But the 'child' variable always returns 0, so they are never set. If I export as a .X file it works! I want to use .B3D if only because the scaling is correct, and for future compatibility. Anyone know what I am doing wrong? |
| ||
purhaps the letters are lowercase or uppercase? (the names of the children)? |
| ||
Nah, just checked. Case doesn't matter. But just checked, and the .X file contains refs to both LEAVES and TRUNK. The .B3D file contains none. Is this then a problem with Milkshape? But I thought plenty of other people were already manipulating Ms3D>B3D entities (hands etc) or so the forums would have you believe. |
| ||
This should tell you all you need to know:parent= LoadAnimMesh("Tree1.b3d") ent = parent While ent Debuglog EntityName(ent) ent = NextChild(ent) Wend ;in the code archive Function NextChild(ent) If CountChildren(ent)>0 Return GetChild(ent,1) EndIf Local foundunused=False Local foundent = 0, parent,sibling While foundunused=False And ent<>0 parent = GetParent(ent) If parent<>0 If CountChildren(parent)>1 If GetChild(parent,CountChildren(parent))<>ent For siblingcnt = 1 To CountChildren(parent) sibling = GetChild(parent,siblingcnt) If sibling=ent foundunused = True foundent = GetChild(parent,siblingcnt+1) EndIf Next EndIf EndIf EndIf ent = parent Wend Return foundent End Function |
| ||
No, actually. With all due respect and thanks this doesn't help. If the literal child entity names 'TRUNK' and 'LEAVES' are not exported in a Milkshape>B3D then getting the handle of each child entity won't help. I would merely have a list of child entity handles without knowing what I could do with them. Any other ideas? |
| ||
Sorry, I misunderstood the problem. Are the TRUNK and LEAVES two separate Surfaces in the B3D file? If so, you might have to remove one and rebuild it in its own Entity. |
| ||
TRUNK and LEAVES are two separate child entities already, but it seems that Milkshape does NOT export the names in a B3D, but DOES export the names in an X file! (-with bad scaling). I'll find a workaround somehow. Thanks for trying to help. But this is getting very tedious. So many people on the forums are wittering on about using GetChild/FindChild to manipulate hands,guns etc so what the hell modeller are they using which preserves the child entity names when exported? And please don't say 3DS Max. Yecchh! |
| ||
I use CharacterFX. Please notify the guys of Umbalum, the maker of Milkshape, or the maker of the B3D export plugin, they might correct this bug, it really seems to be a bug. |
| ||
send me the tree model and i'll try messing in milkshape with it, i always use milkshape for my exports and never have any trouble so something wrongs going on. |
| ||
Thanks sinu, it's on its way. Cheers, john. |
| ||
Sinu, your email address failed. Any other? |
| ||
John, A daft question but no one has asked it asaik - you have the very latest B3D exporter for Milkshape yes? (Well I did say it was a daft question). EDIT: You may also find this useful: B3D Tweak Utility By Michael Reitzenstein I think it is available from: http://www.mking.com/demonstarsm2/index.html IPete2. |