mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 13:09:52 +02:00
don't include interrior voxels in cubic collision hull
This commit is contained in:
parent
c60a8e7dfc
commit
1ee773a532
1 changed files with 12 additions and 0 deletions
|
@ -695,6 +695,18 @@ void RenderablePolyVoxEntityItem::computeShapeInfo(ShapeInfo& info) {
|
||||||
for (int y = 0; y < _voxelVolumeSize.y; y++) {
|
for (int y = 0; y < _voxelVolumeSize.y; y++) {
|
||||||
for (int x = 0; x < _voxelVolumeSize.x; x++) {
|
for (int x = 0; x < _voxelVolumeSize.x; x++) {
|
||||||
if (getVoxel(x, y, z) > 0) {
|
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<glm::vec3> pointsInPart;
|
QVector<glm::vec3> pointsInPart;
|
||||||
|
|
||||||
float offL = -0.5f;
|
float offL = -0.5f;
|
||||||
|
|
Loading…
Reference in a new issue