borrow method

Pointer<JPH_Shape>? borrow(
  1. Shape3D shape
)

shape for a query, kept while no body holds it among the last idleLimit used that way.

Implementation

Pointer<JPH_Shape>? borrow(Shape3D shape) {
  final ref = _ref(shape);
  if (ref == null) return null;
  if (ref.bodies == 0) {
    _idle
      ..remove(shape)
      ..add(shape);
    while (_idle.length > idleLimit) {
      final oldest = _idle.first;
      _idle.remove(oldest);
      _refs.remove(oldest)?.release();
    }
  }
  return ref.pointer;
}