Done
This commit is contained in:
+21
-9
@@ -247,16 +247,28 @@ voxel* Chunks::rayCast(glm::vec3 start,
|
|||||||
iend.z = iz;
|
iend.z = iz;
|
||||||
|
|
||||||
if (!def->rt.solid) {
|
if (!def->rt.solid) {
|
||||||
const AABB& box = def->rotatable
|
std::vector<AABB> hitboxes;
|
||||||
? def->rt.hitboxes[voxel->rotation()]
|
if (def->hitboxExplicit) {
|
||||||
: def->hitbox;
|
hitboxes = {
|
||||||
scalar_t distance;
|
def->rotatable
|
||||||
Ray ray(start, dir);
|
? def->rt.hitboxes[voxel->rotation()]
|
||||||
if (ray.intersectAABB(iend, box, maxDist, norm, distance) > RayRelation::None){
|
: def->hitbox
|
||||||
end = start + (dir * glm::vec3(distance));
|
};
|
||||||
return voxel;
|
} else {
|
||||||
}
|
hitboxes = def->rotatable
|
||||||
|
? def->rt.modelBoxes[voxel->rotation()]
|
||||||
|
: def->modelBoxes;
|
||||||
|
}
|
||||||
|
|
||||||
|
scalar_t distance;
|
||||||
|
Ray ray(start, dir);
|
||||||
|
|
||||||
|
for (const auto& box : hitboxes) {
|
||||||
|
if (ray.intersectAABB(iend, box, maxDist, norm, distance) > RayRelation::None) {
|
||||||
|
end = start + (dir * glm::vec3(distance));
|
||||||
|
return voxel;
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
iend.x = ix;
|
iend.x = ix;
|
||||||
iend.y = iy;
|
iend.y = iy;
|
||||||
|
|||||||
Reference in New Issue
Block a user