Code archives/3D Graphics - Mesh/FindChild command replacement

This code has been declared by its author to be Public Domain code.

Download source code

FindChild command replacement by Chroma2007
Here's an easy way to FindChild on a .b3d model. Works with .3ds etc etc. Again, this was made for .B3D models.
;sample use
truck = LoadAnimMesh("F100.b3d")
tire1 = FindChild(truck,"left_wheel")
HideEntity tire1

Function FindChild(mesh,mesh_name$)
	Local num% = CountChildren(mesh)
	For count = 1 To num
		tempmesh = GetChild(mesh,count)
		If EntityName(tempmesh) = mesh_name Return tempmesh
	Next
	Return 0
End Function

Comments

MadJack2007
Err - sorry Chroma, but I can't see the point of this code snippet?

In that it does exactly the same as Blitz's native findchild and doesn't handle finding child entities recursively?


Chroma2007
It allows you to find a child in a .b3d model file. You can then hide, move, etc etc. It doesn't work with the regular native command.

And a bonus is that it works will .3ds etc so you can use it for all. But it was made specifically for finding .b3d children, which like I said...can't be done with the regular FindChild command.


Beaker2007
which like I said...can't be done with the regular FindChild command.

Er.. yes it can. :) And it works with 3ds etc. Madjack is correct.


Vorderman2007
Yeah, I've been using findchild() on .B3D meshes for years.


Chroma2007
I know it works with other 3d file formats like .3ds, I've been using that for years also. But the built in FindChild doesn't work with .b3d to find a child so you can hide it etc. You have to count through the children to find it like in the function.


puki2007
This surely doesn't work as is.

FindChild is internal to Blitz3D. Plus EntityName is surely a string?


Code Archives Forum