range_libc icon indicating copy to clipboard operation
range_libc copied to clipboard

CDDTCast does not always honor max range

Open droemer7 opened this issue 4 years ago • 0 comments

When using CDDTCast, the max_range parameter is not always honored. The behavior seems to be limited to two scenarios.

Let's say max_range is set to 30.0:

  1. An obstacle lies along the ray being cast at a true range of 50.0. CDDTCast::calc_range() will return 50.0 (incorrect, 30.0 expected).
  2. No obstacle lies along the ray being cast (the map is open). CDDTCast::calc_range() will return 30.0 (correct).

It's not immediately obvious where the bug itself is because the algorithm is so complex and has lots of return statements. I'm not sure what a proper fix is but a workaround would be to clamp the max range returned by CDDTCast::calc_range().

The other raycasting methods Bresenham (BL), Ray Marching (RM), and Giant Lookup Table (GLT) are not affected.

droemer7 avatar Feb 20 '21 20:02 droemer7