10-12-2020, 08:44 AM
TriangleIndex is an index of a triangle and not an index of a TriangleIndice. You can get the index in the TriangleIndices collection or in IndexBuffer by multiplying TriangleIndex by 3 - for example, triangle indices for the 3rd triangle (in this case TriangleIndex is 2) start at TriangleIndice with index 6.
You should change your calculation of t0 ... t2 to:
You should change your calculation of t0 ... t2 to:
PHP Code:
int t0 = rayHitResult.TriangleIndex * 3;
int t1 = t0 + 1;
int t2 = t0 + 2;
Andrej Benedik

