The triangle ranges three's Mesh.raycast tests (_computeIntersections):
the draw range, or with an array of materials each group within it.
Matched step for step, including ranges that don't start or end on a
multiple of 3: three steps j = start, start + 3, ... while j < end, and
tests the triangle of indices j, j + 1, j + 2, so a range that isn't a
whole number of triangles ends in a triangle that reads past it (into the
next group, or past the draw range), and one that starts off a multiple of 3
tests triangles made of neighbouring triangles' corners. A triangle that
would read past the index (or, without one, the positions) is dropped:
three reads undefined there and never hits it. Each range's count is
therefore a multiple of 3. Overlapping groups give overlapping ranges, as
three tests (and reports) such triangles once per group. A group whose
material is missing is skipped (three throws on it).
The triangle ranges three's
Mesh.raycasttests (_computeIntersections): the draw range, or with an array of materials each group within it.Matched step for step, including ranges that don't start or end on a multiple of 3: three steps
j = start, start + 3, ...whilej < end, and tests the triangle of indicesj, j + 1, j + 2, so a range that isn't a whole number of triangles ends in a triangle that reads past it (into the next group, or past the draw range), and one that starts off a multiple of 3 tests triangles made of neighbouring triangles' corners. A triangle that would read past the index (or, without one, the positions) is dropped: three readsundefinedthere and never hits it. Each range'scountis therefore a multiple of 3. Overlapping groups give overlapping ranges, as three tests (and reports) such triangles once per group. A group whose material is missing is skipped (three throws on it).