public void SetCenteringForMeshGroup(MeshGroup meshGroup) { AxisAlignedBoundingBox bounds = meshGroup.GetAxisAlignedBoundingBox(); Vector3 boundsCenter = (bounds.maxXYZ + bounds.minXYZ) / 2; centering = Matrix4X4.CreateTranslation(-boundsCenter); // and move the translation back so the part does not move translation *= Matrix4X4.CreateTranslation(boundsCenter); }
static AxisAlignedBoundingBox GetAxisAlignedBoundingBox(MeshGroup meshGroup, Matrix4X4 transform) { return meshGroup.GetAxisAlignedBoundingBox(transform); }