getChildEntity method

  1. @override
Future<ThermionEntity> getChildEntity(
  1. ThermionEntity parent,
  2. String childName
)
override

Finds the child entity named childName associated with the given parent. Usually, parent will be the return value from loadGlb/loadGltf and childName will be the name of a node/mesh.

Implementation

@override
Future<ThermionEntity> getChildEntity(
    ThermionEntity parent, String childName) async {
  final entityId = _module.ccall(
      "find_child_entity_by_name",
      "int",
      ["void*".toJS, "int".toJS, "string".toJS].toJS,
      [_sceneManager!, parent.toJS, childName.toJS].toJS,
      null) as JSNumber;
  if (entityId.toDartInt == -1) {
    throw Exception("Failed to find child entity");
  }
  return entityId.toDartInt;
}