Minor kdtree fixes/workarounds
Not sure why, but it misses some collisions with that t >= 0.0 clause...
This commit is contained in:
parent
90b6769278
commit
ba98ae3386
@ -83,7 +83,7 @@ class CollisionSystem : public EntitySystem {
|
||||
glm::vec3 direction_glm = mouse_look->get_look_direction();
|
||||
Vector direction = Vector(direction_glm.x, direction_glm.y, direction_glm.z);
|
||||
|
||||
Ray ray(origin, direction * 5.0);
|
||||
Ray ray(origin, direction);
|
||||
|
||||
Vector collision_position(0, 0, 0);
|
||||
Triangle *result = kdtree->intersect_ray(ray, collision_position);
|
||||
|
@ -122,7 +122,7 @@ class KDTree {
|
||||
|
||||
// No collision here either. Does it make sense to also check the far node?
|
||||
// Only if the axes are not parallel and if that area is not behind us
|
||||
if (ray.direction[node->axis] != 0.0 && t >= 0.0) {
|
||||
if (ray.direction[node->axis] != 0.0) { // FIXME: should include && t >= 0.0
|
||||
// It does make sense to check the far node.
|
||||
// For this, calculate a new ray origin and continue towards that direction, but with
|
||||
// the new origin (we can leave behind what we already checked)
|
||||
|
Loading…
x
Reference in New Issue
Block a user