spawn method
Acquires a node from the pool and attaches it to parent.
Implementation
Node spawn({
Node? parent,
vm.Matrix4? transform,
void Function(Node node)? onSpawn,
}) {
final Node node;
if (_idle.isNotEmpty) {
node = _idle.removeLast();
} else {
node = factory();
}
if (transform != null) {
node.localTransform = transform.clone();
}
if (parent != null) {
parent.add(node);
}
_active.add(node);
onSpawn?.call(node);
return node;
}