Page 1 of 1

colliding with on-the-fly tessellated tri meshes

Posted: Fri Apr 09, 2010 2:25 am
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.

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

Posted: Fri Apr 09, 2010 10:33 pm
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.

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

Posted: Sat Apr 10, 2010 8:53 pm
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.

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

Posted: Sat Apr 10, 2010 9:37 pm
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

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

Posted: Mon May 23, 2011 6:58 pm
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?