I'm using CC3MeshIntersection to get the face intersected (selected).
#define kMeshHitCountMax 1
CC3Ray touchRay = [self.activeCamera unprojectPoint:touchPoint];
CC3Ray localRay = [aNode.globalTransformMatrixInverted transformRay:touchRay];
[node findFirst:kMeshHitCountMax intersections:myMeshIntersection ofLocalRay:localRay acceptBackFaces:NO acceptBehindRay:NO];
When there is a face behind the top face that I select,
myMeshIntersection returns the face behind it.
If I raise the
kMeshHitCountMax to the amount of faces the ray passes through, I can get the top face but the top face is always last to be indexed by the intersection.
I thought that since I'm not accepting backFaces or BehindRay, I could access the topFace via:
Is this a bug or am I doing something wrong here or is this just the way it is?
so it looks like the
findFirst: method actually returns the index where the top intersect happened. I just took that and assigned it to a GLuint and subtracted one from it and it gives me the correct index.
GLuint atIndex = [node findFirst:kMeshHitCountMax intersections:myMeshIntersection ofLocalRay:localRay acceptBackFaces:NO acceptBehindRay:NO] -1;
and I access it lika so:
hope that helps someone if they ever come across it.