java – How do I use Bullet Ghost objects in libGDX?

So I researched how Bullet's ghost objects work in libGDX. The Java port had none of this, so I tried to translate some of the found C ++ code into Java. However, there were several issues that I came across.

First, the C ++ version of Bullet uses a type called btAlignedObjectArray which does not have a corresponding type in the Java port. Second, there is a line in the C ++ code that says: if (spirit) { Where spirit is an example btGhostObject, That does not make sense to me, this statement just does not work in Java.

After that I tried it ghostObj.getNumOverlappingObjects () and ghostObj.getOverlappingObject (0) Instead of the approximately nine lines used for collision detection in C ++ code, to be honest, that was the only idea I had to make. Well, that did not work either.

And there is not much to do in the source code. As far as I can see getNumOverlappingObjects () should Work, but I know that's not true.

Could someone please explain how to build and test collisions for ghost objects? Bonus points for explaining pitfalls that you might encounter when using them for ray casting.