mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-09 21:11:50 +00:00
Done
This commit is contained in:
parent
5c3eafb331
commit
70d309dfd9
1 changed files with 21 additions and 9 deletions
|
|
@ -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;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue