getCenter method

Vector3 getCenter(
  1. Vector3 target
)

target — the result will be copied into this Vector3.

Returns the center point of the box as a Vector3.

Implementation

Vector3 getCenter(Vector3 target) {
  if (isEmpty()) {
    target.setValues(0, 0, 0);
  }
  else {
    target.add2(min, max).scale(0.5);
  }

  return target;
}