The following works for me.
In BoundingVolumeBase.as:
public function transformBy(m : Matrix3D) : BoundingVolumeBase
{
var vs : Vector.<Number> = this.aabbPoints;
for(var i : uint = 0; i< vs.length; i+=3)
{
var v : Vector3D = m.transformVector(new
Vector3D(vs[i], vs[i+1],
vs[i+2]));
vs[i] = v.x;
vs[i+1] = v.y;
vs[i+2] = v.z;
}
var bvb : BoundingVolumeBase = new BoundingVolumeBase();
bvb.fromVertices(vs);
return bvb;
}
In ObjectContainer3D.as (Quick patch):
public function calculateBounds() : BoundingVolumeBase
{
var minx : Number = Number.POSITIVE_INFINITY;
var miny : Number = Number.POSITIVE_INFINITY;
var minz : Number = Number.POSITIVE_INFINITY;
var maxx : Number = Number.NEGATIVE_INFINITY;
var maxy : Number = Number.NEGATIVE_INFINITY;
var maxz : Number = Number.NEGATIVE_INFINITY;
var i : uint;
var len : uint = _children.length;
var child : ObjectContainer3D;
while (i < len) {
child = _children[i++];
var bvbChild : BoundingVolumeBase = new
BoundingVolumeBase();
bvbChild.fromExtremes(child.minX, child.minY,
child.minZ,
child.maxX, child.maxY, child.maxZ);
bvbChild = bvbChild.transformBy(child.transform);
minx = Math.min(bvbChild.min.x, minx);
miny = Math.min(bvbChild.min.y, miny);
minz = Math.min(bvbChild.min.z, minz);
maxx = Math.max(bvbChild.max.x, maxx);
maxy = Math.max(bvbChild.max.y, maxy);
maxz = Math.max(bvbChild.max.z, maxz);
}
var bvb : BoundingVolumeBase = new BoundingVolumeBase();
bvb.fromExtremes(minx, miny, minz, maxx, maxy, maxz);
return bvb;
}
/**
* The minimum extremum of the object along the X-axis.
*/
public function get minX() : Number
{
return calculateBounds().min.x;
}
/**
* The minimum extremum of the object along the Y-axis.
*/
public function get minY() : Number
{
return calculateBounds().min.y;
}
/**
* The minimum extremum of the object along the Z-axis.
*/
public function get minZ() : Number
{
return calculateBounds().min.z;
}
/**
* The maximum extremum of the object along the X-axis.
*/
public function get maxX() : Number
{
return calculateBounds().max.x;
}
/**
* The maximum extremum of the object along the Y-axis.
*/
public function get maxY() : Number
{
return calculateBounds().max.y;
}
/**
* The maximum extremum of the object along the Z-axis.
*/
public function get maxZ() : Number
{
return calculateBounds().max.z;
}