Fix Nomals after #160
This commit is contained in:
parent
38e05f3514
commit
7ee0c672f0
@ -260,15 +260,23 @@ voxel* Chunks::rayCast(glm::vec3 start,
|
|||||||
: def->modelBoxes;
|
: def->modelBoxes;
|
||||||
}
|
}
|
||||||
|
|
||||||
scalar_t distance;
|
scalar_t distance = maxDist;
|
||||||
Ray ray(start, dir);
|
Ray ray(start, dir);
|
||||||
|
|
||||||
|
bool hit = false;
|
||||||
|
|
||||||
for (const auto& box : hitboxes) {
|
for (const auto& box : hitboxes) {
|
||||||
if (ray.intersectAABB(iend, box, maxDist, norm, distance) > RayRelation::None) {
|
scalar_t boxDistance;
|
||||||
|
glm::ivec3 boxNorm;
|
||||||
|
if (ray.intersectAABB(iend, box, maxDist, boxNorm, boxDistance) > RayRelation::None && boxDistance < distance) {
|
||||||
|
hit = true;
|
||||||
|
distance = boxDistance;
|
||||||
|
norm = boxNorm;
|
||||||
end = start + (dir * glm::vec3(distance));
|
end = start + (dir * glm::vec3(distance));
|
||||||
return voxel;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (hit) return voxel;
|
||||||
} else {
|
} else {
|
||||||
iend.x = ix;
|
iend.x = ix;
|
||||||
iend.y = iy;
|
iend.y = iy;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user