PxGeometryQuery::raycast false positive

Hello - I hope this is the right forum for this question.

I am using PxGeometryQuery::raycast to select objects onscreen. Sometimes, I am registering a hit with this function when I am not actually clicking on the geometry. It’s probably a fault with the way I am calling it, or maybe me not understanding fully how it is supposed to work.

So, in my test case, I have a whisky bottle shape, with a fat body and a narrow neck. I’m clicking in mid-air beside the neck. So, if the bottle had a bounding box, I’d be inside the box but not inside the neck of the bottle.

Here’s the way I’m calling the function.

bool bResult = PxGeometryQuery::raycast(PxVec3(poPosition->m_fX, poPosition->m_fY, poPosition->m_fZ), 
										PxVec3(poDirection->m_fX, poDirection->m_fY, poDirection->m_fZ),
										apoShapeBuffer[nIndex]->getGeometry().any(),
										oShapeTransform,
										fLength,
										PxHitFlag::eDISTANCE | PxHitFlag::eNORMAL, 
										1,
										&oHitData,
										false);

It returns a result of 1, for a single hit. The ‘flags’ value of this ‘false’ hit is 6 - which makes sense, since I believe that corresponds to DISTANCE and NORMAL data. And I do see what looks like valid values for these in my returned oHitData. So I guess it thinks it has a real hit - but I am not even clicking very close to the bottle neck? With my other objects it seems to have pixel-perfect precision…

Looking at the return values for other clicks on other objects where I expect a hit, that ‘flags’ value is 15 - so I guess sometimes it returns other data, like position, even if only requested distance and normal? It’s a bit confusing.

Any idea why I would be getting a hit registered when I am not actually clicking on the geometry? I don’t think it has to do with transformation errors, since my other objects respond like I expect…

EDIT: I tried calling getType() on my geometry, and I think it partially explains the problem. The bottle is reporting as a convex mesh, whereas some of my other objects report as triangle meshes. A convex mesh enclosing my bottle would indeed report hits in the space around the neck. But the triangle mesh must exist, since I am rendering it. I didn’t write this code, so I guess now I need to find out where/how it is distinguishing between the detailed mesh I render and the convex one it uses for physx testing…

Thanks!