Findchild types?

Blitz3D Forums/Blitz3D Programming/Findchild types?

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

FindChild works with entities. A type is a data structure and has nothing to do with entities.

All of the commands which create or load entities will return an entity handle, which can be used with FindChild, however, unless you use LoadAnimMesh to load your mesh model, the model mesh entity will not contain any children for FindChild to find. You will also need to know what value was assigned to the namestring of the rocket flame, so that you can specify that value when using FindChild.

You can also try using EntityClass to determine if the rocket flame entity is actually a mesh entity.

You can find more info about FindChild at: http://www.blitzbasic.co.nz/b3ddocs/command.php?name=FindChild&ref=comments

This code will load the model you specify in the filepath$ variable and print out the namestring values for all of its children.

; Set this to the filepath of the file you wish to load.
filepath$ = ""

Graphics3D 800, 600, 0, 2

Global mesh = LoadAnimMesh( filepath$ )

OutputChildNames( mesh )

WaitKey

End


;---


Function OutputChildNames( entity )

Local i, count

Print EntityName( entity )

count = CountChildren( entity )
For i = 1 To count
	OutputChildNames( GetChild( entity, i ) )
Next
End Function



Once you know the name of the rocket flame, you can use FindChild to get its entity handle.

eg.
; Set this to the filepath of the file you wish to load.
filepath$ = ""

; Set this to the name of the child entity you wish to find.
child_name$ =""

Graphics3D 800, 600, 0, 2

Global mesh = LoadAnimMesh( filepath$ )

child_entity_handle = FindChild( mesh, child_name$ )

End