calculateWorldAABB method
@todo use abstract for these kind of methods
Implementation
@override
void calculateWorldAABB(Vec3 pos, Quaternion quat, Vec3 min, Vec3 max) {
final verts = vertices;
double? minx;
double? miny;
double? minz;
double? maxx;
double? maxy;
double? maxz;
Vec3 tempWorldVertex = Vec3();
for (int i = 0; i < verts.length; i++) {
tempWorldVertex.copy(verts[i]);
quat.vmult(tempWorldVertex, tempWorldVertex);
pos.vadd(tempWorldVertex, tempWorldVertex);
final v = tempWorldVertex;
if (minx == null || v.x < minx) {
minx = v.x;
}
if (maxx == null || v.x > maxx) {
maxx = v.x;
}
if (miny == null || v.y < miny) {
miny = v.y;
}
if (maxy == null || v.y > maxy) {
maxy = v.y;
}
if (minz == null || v.z < minz) {
minz = v.z;
}
if (maxz == null || v.z > maxz) {
maxz = v.z;
}
}
min.set(minx!, miny!, minz!);
max.set(maxx!, maxy!, maxz!);
}