I’m currently having some problems with the Collision of two Meshes.
I have one Mesh that has been batched out of several Meshes via GeometryBatchFactory (the green Spheres),
and I have a simple Cube.
I want to check:
-Is the Cube inside of the Mesh?, or
-Is the Cube outside of the Mesh?, or
-Does the Cube overlap with the surface of the Mesh?
(The Cube will later be a part of a 3D-Grid, I need to check those collisions for recalculating the barycenter of batched (complex) Meshs, but thats another topic)
I’m using collideWith() twice for checking the collisions:
-First I do: customMesh.collideWith(cube.getWorldBound(), results);
That way I check, if the Cube overlaps with the surface of the Mesh.
If it does so, the Triangles, which the Cube overlaps with, get marked with blue dots.
-Then I do: cube.collideWith(customMesh.getWorldBound(), results);
With this I check, whether the Cube is completely inside the Mesh, or not.
(Definition for “inside”: the cube is inside of the mesh and doesn’t break through the surface from within)
If it is inside, it will get marked with red dots.
The problem is, that the BoundingVolume of the complex Mesh is very simplified,
thus the collideWith() check sometimes returns, that the cube is completley inside of the Mesh although it isn’t.
If collideWith() would work for Geometry-Geometry collisions, and not only for Geometry-BoundingVolume collisions,
there would be no problem for me.
So my question is: Is there any way to check for Geometry-Geometry collisions?
Or would you solve the problem (Cube inside, outside, or overlapping with the Mesh) in another way?
I already tried GhostControl but this is not really what I’m searching for.
Thank you for any help!