Finding out the shape of a collision.

paleajed
Posts: 1
Joined: Mon Nov 21, 2011 11:57 pm

Finding out the shape of a collision.

Post by paleajed »

Hello all, first post.

And already questions, questions...

Just starting off with Bullet and I was wondering if it is possible to get the "shape" of a collision, this means for instance when I collide the point of a cone as a softbody with a cube, I would get a circle... Or at least how to get a list of triangles of an object that are colliding with another object at a certain time in then simulation...

Hope this is possible, as I am looking into the possibility of "painting" with softbodies on a canvas...


Gert.
User avatar
dphil
Posts: 237
Joined: Tue Jun 29, 2010 10:27 pm

Re: Finding out the shape of a collision.

Post by dphil »

Hm I'm not sure one is able to get something like the shape of the collision intersection. Also keep in mind that convex primitives (boxes, spheres, cones, etc) do not have triangles. They are implicit representations of a shape.

Interesting painting idea though. One random thought about how you might go about it.... Make your canvas a grid of squares (or flattened cubes; I don't recall if there is a 2D square collision shape, though maybe you could use btConvex2dShape or just two btTriangleShapeEx's per square) at whatever resolution you want to be able to paint (alternatively, some non-uniform canvas subdivision like Delaunay triangulation, for which you can just use btTriangleShapeEx for the individual regions). Then at each simulation step you can check which squares/triangles are colliding with the soft body "brush" and colour them accordingly (presumably via a graphics quad associated with each collision square). Or you could use simple collision points, and when you colour them the colour is then interpolated between neighbouring points to smear/fade the colour.