buildBoneHierarchy method

void buildBoneHierarchy(
  1. Object3D root,
  2. dynamic joints,
  3. List<Map<String, dynamic>> boneData
)

Implementation

void buildBoneHierarchy(Object3D root, joints, List<Map<String,dynamic>> boneData ) {
  // setup bone data from visual scene
  root.traverse( ( object ) {
    if ( object is Bone) {
      Matrix4? boneInverse;
      // retrieve the boneInverse from the controller data

      for (final joint in joints) {
        if ( joint['name'] == object.name ) {
          boneInverse = joint['boneInverse'];
          break;
        }
      }

      boneInverse ??= Matrix4.identity();
      boneData.add({'bone': object, 'boneInverse': boneInverse, 'processed': false } );
    }
  });
}