hideBoundingBox method

Future hideBoundingBox(
  1. ThermionAsset asset, {
  2. bool destroy = false,
})
override

Removes the bounding box for asset from the scene.

If destroy is true, the geometry and material instance for the asset will also be destroyed.

Implementation

Future hideBoundingBox(ThermionAsset asset, {bool destroy = false}) async {
  if (_boundingBoxAssets.containsKey(asset)) {
    final completer = _boundingBoxAssets[asset]!;
    final bbAsset = await completer.future;

    await scene.remove(bbAsset);
    if (destroy) {
      _boundingBoxAssets.remove(asset);
      await FilamentApp.instance!.destroyAsset(bbAsset);
      _logger.info("Bounding box destroyed");
    } else {
      _logger.info("Bounding box hidden");
    }
  } else {
    _logger.warning("Warning - no bounding box for asset created");
  }
}