I need to create concave triangle meshes on-the-fly (basically tessellating a higher-order representation), and I wanted to investigate the possibility of using Bullet collision on them. Currently it looks like the only interface is to create a btBvhTriangleMeshShape every time I tessellate, which would seem to be a bit inefficient in real time. In my case, it would just be more efficient to check against all X local triangles because I'll only be generating the ones that are close enough to collide with. So my questions are:
1) Am I missing an interface that might do this already? If not, I think I can probably figure out how to create one, I just didn't want to duplicate the effort if somebody else has already done it.
2) I suppose this could cause a problem with persistent manifolds. Any suggestions? I suppose if I'm real smrt I could avoid releasing any triangles that are still in a manifold.
3) Any chance all of this will work with the new "internal edge" workaround?
Thanks for any ideas or pointers.
colliding with on-the-fly tessellated tri meshes
Re: colliding with on-the-fly tessellated tri meshes
I don't know much, but as far i can tell you, collision detection with polymeshes is inefficient. Tesselated polys (tons of them) are far more inefficient. So don't expect that there is an interface for tesselated objects.
Re: colliding with on-the-fly tessellated tri meshes
All I'm really looking for here is a btBvhTriangleMeshShape without the Bvh, which is unnecessary overhead in my case. I am free to control the detail level of the tessellation to balance accuracy vs. efficiency, so I'm not worried about that issue.
- Erwin Coumans
- Site Admin
- Posts: 4221
- Joined: Sun Jun 26, 2005 6:43 pm
- Location: California, USA
- Contact:
Re: colliding with on-the-fly tessellated tri meshes
You could directly derive your custom shape from the btConcaveShape interface, and implement the btConcaveShape::processAllTriangles.1) Am I missing an interface that might do this already?
Code: Select all
CustomTesselationShape::processAllTriangles(btTriangleCallback* callback,const btVector3& aabbMin,const btVector3& aabbMax) const
The contact points keep references to triangles, so there should be no problem. If the triangle position changes, you could flush the contacts and make sure the object in the area are not sleeping/deactivated.2) I suppose this could cause a problem with persistent manifolds. Any suggestions? I suppose if I'm real smrt I could avoid releasing any triangles that are still in a manifold.
This should be possible with a bit of work (we can discuss details later).3) Any chance all of this will work with the new "internal edge" workaround?
Thanks,
Erwin
Re: colliding with on-the-fly tessellated tri meshes
Any chance you found a solution to this?3) Any chance all of this will work with the new "internal edge" workaround?
This should be possible with a bit of work (we can discuss details later).