fix broken optimisation for skipping internal voxels when making collision hull

This commit is contained in:
Seth Alves 2015-08-17 08:49:00 -07:00
parent 1ee773a532
commit af11e97daa

View file

@ -696,12 +696,12 @@ void RenderablePolyVoxEntityItem::computeShapeInfo(ShapeInfo& info) {
for (int x = 0; x < _voxelVolumeSize.x; x++) {
if (getVoxel(x, y, z) > 0) {
if ((x > 0 && getVoxel(x - 1, y, z) == 0) &&
(y > 0 && getVoxel(x, y - 1, z) == 0) &&
(z > 0 && getVoxel(x, y, z - 1) == 0) &&
(x < _voxelVolumeSize.x - 1 && getVoxel(x + 1, y, z) == 0) &&
(y < _voxelVolumeSize.y - 1 && getVoxel(x, y + 1, z) == 0) &&
(z < _voxelVolumeSize.z - 1 && getVoxel(x, y, z + 1) == 0)) {
if ((x > 0 && getVoxel(x - 1, y, z) > 0) &&
(y > 0 && getVoxel(x, y - 1, z) > 0) &&
(z > 0 && getVoxel(x, y, z - 1) > 0) &&
(x < _voxelVolumeSize.x - 1 && getVoxel(x + 1, y, z) > 0) &&
(y < _voxelVolumeSize.y - 1 && getVoxel(x, y + 1, z) > 0) &&
(z < _voxelVolumeSize.z - 1 && getVoxel(x, y, z + 1) > 0)) {
// this voxel has neighbors in every cardinal direction, so there's no need
// to include it in the collision hull.
continue;