From 1ee773a5322ff08fbf0204b995e6be06fad25066 Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Sun, 16 Aug 2015 14:11:37 -0700 Subject: [PATCH] don't include interrior voxels in cubic collision hull --- .../src/RenderablePolyVoxEntityItem.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/libraries/entities-renderer/src/RenderablePolyVoxEntityItem.cpp b/libraries/entities-renderer/src/RenderablePolyVoxEntityItem.cpp index 7044eb0b3c..edccffd397 100644 --- a/libraries/entities-renderer/src/RenderablePolyVoxEntityItem.cpp +++ b/libraries/entities-renderer/src/RenderablePolyVoxEntityItem.cpp @@ -695,6 +695,18 @@ void RenderablePolyVoxEntityItem::computeShapeInfo(ShapeInfo& info) { for (int y = 0; y < _voxelVolumeSize.y; y++) { 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)) { + // this voxel has neighbors in every cardinal direction, so there's no need + // to include it in the collision hull. + continue; + } + QVector pointsInPart; float offL = -0.5f;