Searches parent's direct children for name match (returns first match, 0 if not found).
Takes entity (parent entity handle), childName (name string to search for).
Returns child handle as Int (first matching child handle, 0 if not found or invalid parent).
3D Graphics
Parameters & Returns
Parameters
entityInt
childNameString
Returns
Int
Quick Summary
Searches parent's direct children for name match (returns first match, 0 if not found).
Takes entity (parent entity handle), childName (name string to search for).
Returns child handle as Int (first matching child handle, 0 if not found or invalid parent).
Technical Exegesis...
Searches parent's direct children for name match (returns first match, 0 if not found). Takes entity (parent entity handle), childName (name string to search for). Returns child handle as Int (first matching child handle, 0 if not found or invalid parent). Validates childName!=nullptr and parent exists, iterates parent.children vector, compares each child.name with childName (exact string match, case-sensitive), returns first matching child->handle, returns 0 if no match or invalid parent.
Searches parent's direct children for name match (returns first match, 0 if not found). Takes entity (parent entity handle), childName (name string to search for). Returns child handle as Int (first matching child handle, 0 if not found or invalid parent). Validates childName!=nullptr and parent exists, iterates parent.children vector, compares each child.name with childName (exact string match, case-sensitive), returns first matching child->handle, returns 0 if no match or invalid parent. Name-based child lookup.
This function searches children by name. Search scope: only searches direct children (first level in hierarchy, not grandchildren or deeper descendants), iterates parent.children vector in order (insertion order, order children were parented). Name matching: exact string match required (case-sensitive, "Player" != "player"), compares child->name with childName parameter (string equality, full string must match). First match: returns first child with matching name (stops searching after first match), if multiple children have same name, only first encountered returned (order depends on parenting sequence). Return values: returns child entity handle (integer, same type used in other entity functions), returns 0 if name not found among children, returns 0 if parent invalid, returns 0 if childName==nullptr. Use cases: (1) Named entity lookup (find specific child by identifier), (2) GLB model navigation (access named parts of imported models like "Wheel" or "Turret"), (3) Scene queries (locate child objects by name), (4) Component access (find child representing specific game component), (5) Hierarchy navigation (name-based instead of index-based). Common pattern: wheel = b3dFindChild(car, "Wheel"), if wheel != 0: b3dRotateMesh(wheel, ...), or turret = b3dFindChild(tank, "Turret"), b3dPointEntity(turret, targetX, targetY, targetZ). Typical usage: find children of loaded GLB models (models have node names from file, access by name instead of index), or locate dynamically-named children (entities named during creation). GLB import: loaded models preserve node names from GLB scene graph (b3dLoadMesh creates hierarchy with names, use b3dFindChild to access specific nodes like "Body", "Head", "Weapon"). Name uniqueness: if multiple children have same name, only first match returned (use unique names for reliable lookup, or iterate with b3dGetChild/b3dGetChildCount for all matches). Recursive search: function only searches direct children (not recursive), for deep search: implement recursive FindChildRecursive(parent, name): child = b3dFindChild(parent, name), if child != 0 return child, for each child of parent: result = FindChildRecursive(child, name), if result != 0 return result. Case sensitivity: matching is case-sensitive (use exact capitalization from b3dSetEntityName or GLB file). Performance: O(N) where N=number of children (linear search through children vector, string comparisons per child), small child counts fast, large child counts slower (consider indexing if many children). Null handling: childName==nullptr returns 0 (safe, no crash). Related: b3dGetChild retrieves child by index (position-based access), b3dGetChildCount returns child count, b3dSetEntityName sets searchable names, b3dGetEntityName retrieves names, GLB loader preserves node names.