geometryOf method
The triangles of model's mesh meshName (every mesh merged when it
is empty), in the model's space; null while they are not there yet —
the model still loading — or when there are none. The system asks
again each step until it gets them.
Implementation
@override
ModelGeometry? geometryOf(String model, String meshName) {
if (model.isEmpty) return null;
final asset = assets.get<ModelAsset>(model);
if (asset == null) {
if (_requested.add(model) && assets.hasLoader(AssetType.model)) {
assets
.load<ModelAsset>(model, AssetType.model)
.then(
(_) {},
onError: (Object error) =>
debugPrint('Physics3D: no collider from $model: $error'),
);
}
return null;
}
if (meshName.isNotEmpty) return asset.geometryOf(meshName);
if (identical(_mergedFrom[model], asset)) return _merged[model];
_mergedFrom[model] = asset;
return _merged[model] = merge([
for (final name in asset.meshNames) ?asset.geometryOf(name),
]);
}