Get normal with DXEngine raycast
#2
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:

PHP Code:
int t0 = rayHitResult.TriangleIndex * 3;
int t1 = t0 + 1;
int t2 = t0 + 2; 
Andrej Benedik
  


Messages In This Thread
Get normal with DXEngine raycast - by janovrom - 10-09-2020, 11:23 AM
RE: Get normal with DXEngine raycast - by abenedik - 10-12-2020, 08:44 AM

Forum Jump:


Users browsing this thread:
1 Guest(s)