Findchild types?
Blitz3D Forums/Blitz3D Programming/Findchild types?
| ||
hi, i have a rocket model with a flame at the end. i want to be able to edit the flame on its own. im trying to use findchild but it keeps saying the it is not a model. does findchild no work with types? the rocket is a type.. |
| ||
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 |