Custom collector for getPenetrations() function

Custom collector for getPenetrations() function


So I think there are 3 available collectors. Correct me if I'm wrong:

  • hkpFlagCdBodyPairCollector will return a boolean hit as soon as it finds one. When a hit is found, the code early exits and does not process more objects.
  • hkpFirstCdBodyPairCollector is exactly the same, but it stores some additional information about the touched object.
  • hkpAllCdBodyPairCollector basically stores & returns everything.

So now imagine a scene with a sphere touching two highly-tesselated meshes. I am looking for a collector that would return two hits in that case (i.e. the two meshes). However it seems that none of the available collectors do that:

  • hkpFlagCdBodyPairCollector and hkpFirstCdBodyPairCollector will return one hit only
  • hkpAllCdBodyPairCollector will apparently return a huge number of hits, probably one for each touched triangle. This is way more than I need, and probably slower than necessary.

Is that roughly correct? And is there a collector that would do what I need here? Or a way to create a custom one?


- Pierre

publicaciones de 3 / 0 nuevos
Último envío
Para obtener más información sobre las optimizaciones del compilador, consulte el aviso sobre la optimización.

Hi Pierre,

Those are the only 3 collectors we provide but you can create your own custom collector, it will just need to inherit from hkpCdBodyPairCollector and implement an addCdBodyPair(...) function.

Amy Developer Support Engineer Havok

Thanks, I will try this.

Deje un comentario

Por favor inicie sesión para agregar un comentario. ¿No es socio? Únase ya