Entity Child Recursive Search

Blitz3D Forums/Blitz3D Programming/Entity Child Recursive Search

Anyone have any good code for finding all the children of an entity, and their children?

type child
field child ;yes you can do this
end type

if countchildren(entity)>0 then
    for childcount = 1 to countchildren(entity)
        child=getchild(entity,childcount)
            if child>0 then
                 for i = 1 to countchildren(child)
                      entity.child = new child
                      entity\child=getchild(child,i)
                      next
                 end if
        next
    end if
untested. At work :(

+BlackD

Here is one way
Function core()
	; do it here
End Function


Function doMesh(m,xoff#,yoff#,zoff#)

	Local c
	Local childcount=CountChildren(m)
	
	If childcount
		For c=1 To childcount
			core m,xoff#,yoff#,zoff#
			doMesh GetChild(m,c),xoff#,yoff#,zoff#
		Next
	Else
		core m,xoff#,yoff#,zoff#
	EndIf
End Function


This is my very handy solution (to many things):
http://www.blitzbasic.com/codearcs/codearcs.php?code=796