mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
Fix Nomals after #160
This commit is contained in:
parent
38e05f3514
commit
7ee0c672f0
1 changed files with 11 additions and 3 deletions
|
|
@ -260,15 +260,23 @@ voxel* Chunks::rayCast(glm::vec3 start,
|
|||
: def->modelBoxes;
|
||||
}
|
||||
|
||||
scalar_t distance;
|
||||
scalar_t distance = maxDist;
|
||||
Ray ray(start, dir);
|
||||
|
||||
bool hit = false;
|
||||
|
||||
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));
|
||||
return voxel;
|
||||
}
|
||||
}
|
||||
|
||||
if (hit) return voxel;
|
||||
} else {
|
||||
iend.x = ix;
|
||||
iend.y = iy;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue