createProxy method

int createProxy (AABB aabb, Object userData)
override

Create a proxy. Provide a tight fitting AABB and a userData pointer.

@param aabb @param userData @return

Implementation

int createProxy(final AABB aabb, Object userData) {
  final int node = _allocateNode();
  // Fatten the aabb
  final AABB nodeAABB = _aabb[node];
  nodeAABB.lowerBound.x = aabb.lowerBound.x - Settings.aabbExtension;
  nodeAABB.lowerBound.y = aabb.lowerBound.y - Settings.aabbExtension;
  nodeAABB.upperBound.x = aabb.upperBound.x + Settings.aabbExtension;
  nodeAABB.upperBound.y = aabb.upperBound.y + Settings.aabbExtension;
  _userData[node] = userData;

  _insertLeaf(node);

  return node;
}