colliding with on-the-fly tessellated tri meshes

Post Reply
bone
Posts: 231
Joined: Tue Feb 20, 2007 4:56 pm

colliding with on-the-fly tessellated tri meshes

Post by bone »

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.
krux
Posts: 11
Joined: Tue Apr 06, 2010 7:25 pm

Re: colliding with on-the-fly tessellated tri meshes

Post by krux »

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.
bone
Posts: 231
Joined: Tue Feb 20, 2007 4:56 pm

Re: colliding with on-the-fly tessellated tri meshes

Post by bone »

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.
User avatar
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

Post by Erwin Coumans »

1) Am I missing an interface that might do this already?
You could directly derive your custom shape from the btConcaveShape interface, and implement the btConcaveShape::processAllTriangles.

Code: Select all

CustomTesselationShape::processAllTriangles(btTriangleCallback* callback,const btVector3& aabbMin,const btVector3& aabbMax) const
And report all triangles that are overlapping with the axis aligned bounding boxes (aabbMin/aabbMax) using the callback. You can also check out the btHeightfieldTerrainShape for an example of a custom btConcaveShape.
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.
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.
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).

Thanks,
Erwin
klanger13
Posts: 1
Joined: Mon May 23, 2011 6:54 pm

Re: colliding with on-the-fly tessellated tri meshes

Post by klanger13 »

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).
Any chance you found a solution to this?
Post Reply