Skip to content

clutter: Work around inadequate graphene ray tracing when picking

The ray tracing implementation for intersecting a ray with a box, used for picking actors, doesn't handle ray directions that perfelctly align with the X/Y axises. When this happens, various intermediate variables ends up being NaN, which causes havoc and results in faulty detection of whether a ray interesects with a box.

Work around this by detecting when we're about to ray trace with an axis aligned ray direction, and ever so slightly dudge it (with 2 * FLT_EPSILON). This effectively avoids the NaN results during calculations, and makes the picking work again.

See https://github.com/ebassi/graphene/issues/214 for details.

Merge request reports