getSideNormals method

List<Vector3> getSideNormals(
  1. List<Vector3> sixTargetVectors, [
  2. Quaternion? quat
])

Get the box 6 side normals @param sixTargetVectors An array of 6 vectors, to store the resulting side normals in. @param quat Orientation to apply to the normal vectors. If not provided, the vectors will be in respect to the local frame.

Implementation

List<Vector3> getSideNormals(List<Vector3> sixTargetVectors, [Quaternion? quat ]){
  final List<Vector3> sides = sixTargetVectors;
  final Vector3 ex = halfExtents;
  sides[0].setValues(ex.x, 0, 0);
  sides[1].setValues(0, ex.y, 0);
  sides[2].setValues(0, 0, ex.z);
  sides[3].setValues(-ex.x, 0, 0);
  sides[4].setValues(0, -ex.y, 0);
  sides[5].setValues(0, 0, -ex.z);

  if (quat != null) {
    for (int i = 0; i != sides.length; i++) {
      quat.vmult(sides[i], sides[i]);
    }
  }
  return sides;
}