Penetration depth for STL files
Posted: Tue Mar 01, 2016 11:27 am
Hi!
I have been developing a simple simulation software, where I want to load few STL files, and determine the penetration depth if collision occurs.
I managed to load STL file into btTriangleIndexVertexArray format, so converted to btGImpactMeshShape format, which was easy to handle as a btCollisionObject. I can now easily detect collisions, but if I want to determine the minimum translation vector that brings the objects into contact, the calculated solution I get is wrong. In short, I first perform a discrete collision detection, iterate on the manifolds/contact points, and display the contact points (getPositionWorldOnA() / getPositionWorldOnB()) with the deepest penetration depth found.
The interesting thing is, if I insert a sphere instead of an STL model, the calculated penetration depth/vector is correct. As you can see in the attached image (green one is the STL model, red points are the contact points correspond to the deepest penetration, white one is the sphere), if I translate the STL model along the penetration vector (vector which connects the two red points), we can imagine the two objects exactly come into contact.
The point is, with two complex 3D model, this penetration calculation method does not work (it provides two very very close contact points instead), but changing one of them to a sphere "solves" the problem (so it calculates correct/deepest contact points).
So my question would be, is it possible to calculate accurately the penetration depth for two complex btGImpactMeshShape with Bullet library?
I'm quite new to Bullet Library, so sorry if I'm asking something obvious.
Thanks,
Blabla
I have been developing a simple simulation software, where I want to load few STL files, and determine the penetration depth if collision occurs.
I managed to load STL file into btTriangleIndexVertexArray format, so converted to btGImpactMeshShape format, which was easy to handle as a btCollisionObject. I can now easily detect collisions, but if I want to determine the minimum translation vector that brings the objects into contact, the calculated solution I get is wrong. In short, I first perform a discrete collision detection, iterate on the manifolds/contact points, and display the contact points (getPositionWorldOnA() / getPositionWorldOnB()) with the deepest penetration depth found.
The interesting thing is, if I insert a sphere instead of an STL model, the calculated penetration depth/vector is correct. As you can see in the attached image (green one is the STL model, red points are the contact points correspond to the deepest penetration, white one is the sphere), if I translate the STL model along the penetration vector (vector which connects the two red points), we can imagine the two objects exactly come into contact.
The point is, with two complex 3D model, this penetration calculation method does not work (it provides two very very close contact points instead), but changing one of them to a sphere "solves" the problem (so it calculates correct/deepest contact points).
So my question would be, is it possible to calculate accurately the penetration depth for two complex btGImpactMeshShape with Bullet library?
I'm quite new to Bullet Library, so sorry if I'm asking something obvious.
Thanks,
Blabla