Erwin Coumans wrote:
Actually, it seems you are not just asking for more contact points, you want a mapping between vertices of the mesh, and contact points.
When a concave trimesh versus trimesh is colliding/overlapping, ultimately this ends up in multiple triangle versus triangle tests. This gives one or more contact points, with a penetration depth and normal. Those contact points are not necessary related to vertices: imaging a big triangle, with a smaller triangle overlapping in the middle: The 'closest points' or more accurate, the points that define the penetration depth (or minimum translational distance) can be determined by a face of one triangle, and an edge of another triangle.
You can however retrieve the partId and triangleIndex for each of the contact points, at the time when they are added. You can use a callback, see the 'CustomMaterialCombinerCallback' in ConcaveDemo.cpp how to do this:
Thanks for the reply.
Well, having a map would be the best choice, but knowing the triangles colliding would be almost as great. I try to use a callback and tell if I have any problem/success. I just have a point to clear out. For each pair of contact points, how many normals I get? In the case this is just one, it can't be normal to both the triangle faces, so it's just the direction of the line connecting the two points? I hope the question is clear.
Erwin Coumans wrote:
We could store the partId/index for the triangle in the contact point. However, then we would also need to store a pointer to the childshape, including an accumulated transform for this childshape: you can store multiple trianglemeshes inside a compound shape, so we would need to identify which childshape is used.
Hope this helps,
Erwin
Ok I understand. I hope the callback will satisfy my needings then.
projectileman wrote:
Are you trying to make deformable bodies?? great!!
Let me know about that please, I want to test if the last version of GIMPACT (0.3) can support deformations.
GIMPACT 0.3? That sounds great!
Yes I have a deformable model based on tetrahedral meshes, and I'm using GIMPACT to detect collisions of its trimesh boundary. I'm using the GIMPACT present in the last release of Bullet, and it's seems that collisions work after the deformation, what I do is:
- create a kinematic rigid body having the trimesh as its shape
- move each vertex of the mesh each time step according to the computed solution of the deformable solver
- detect collisions
- input the velocities of the colliding points to the deformable solver
and the trimesh seems to realistic colliding with the environment, though often I don't retrive the right faces/vertices corresponding to the collision points (the reason why I opened this topic).
projectileman wrote:
At this moment I recommend using GJK for triangle collisions in deformable bodies, because the original tri-collision from GIMPACT only takes the face normals as separation axes, without considering edge-edge directions. Just uncomment the BULLET_TRIANGLE_COLLISION define for enabling GJK, in the btGImpactCollisionAlgorithm.h file.
Also I've considered tetrahedrization as a new feature on GIMPACT, which would be more well suited for deformables.
About the collision info, you must determine which triangle faces are collided and then apply the respective forces-impules to the linked vertices acording with the collision impulse-point, it's a though.
What would it be the difference between the separation axes and GJK in pratical terms? Do they both give a collision point + a normal? This might be important because I could just take care of getting the callback suggested by Erwin without having to implement different versions for different collision algorithms, and try which one works better.
For the impulse, I just need to know the velocity of the collision point and the id of the colliding face/vertex, then the deformable model takes care to compute the corresponding deformation and response force. I just want to avoid after a collision detection (which is basically a search) to search again for the triangles containing the contact points.