setBoneTransform method

  1. @override
Future setBoneTransform(
  1. ThermionEntity entity,
  2. int boneIndex,
  3. Matrix4 transform, {
  4. int skinIndex = 0,
})
override

Implementation

@override
Future setBoneTransform(
    ThermionEntity entity, int boneIndex, Matrix4 transform,
    {int skinIndex = 0}) async {
  if (skinIndex != 0) {
    throw UnimplementedError("TOOD");
  }
  final ptr = allocator<Float>(16);
  for (int i = 0; i < 16; i++) {
    ptr[i] = transform.storage[i];
  }
  var result = await withBoolCallback((cb) {
    set_bone_transform_ffi(
        _sceneManager!, entity, skinIndex, boneIndex, ptr, cb);
  });

  allocator.free(ptr);
  if (!result) {
    throw Exception("Failed to set bone transform");
  }
}