Collision detection with Vertices

MatthiasA
Posts: 4
Joined: Tue May 26, 2009 4:38 pm

Collision detection with Vertices

Post by MatthiasA »

Hello,

iam new in bullet
i implemented bullet in openscenegraph

in my osg project, i use a loader which uses vertex arrays

how can i create a collision detection object
with vertices? or what is the best method?

it would be very great if anybody of you could help me and post some code snippet

kind regards matthias
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: Collision detection with Vertices

Post by Erwin Coumans »

Please check this diagram, or the most recent (Bullet 2.74 or later) Bullet_User_Manual.pdf around page 14 (included in each Bullet SDK package).
Image


Then there are demos that implement most of the collision shapes,
Thanks,
Erwin
MatthiasA
Posts: 4
Joined: Tue May 26, 2009 4:38 pm

Re: Collision detection with Vertices

Post by MatthiasA »

ive already checked the diagram
ive a moving object
which i cannot approximate with primitives

i can use a convexhull
or a impact triangle mesh shape

what is the difference?
my models have a lot of quads and triangles ;-)

which example would you prefer?

ive the complete code i need only the initializing of an vertexarray
btCollisionShape *pShape = ??
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: Collision detection with Vertices

Post by Erwin Coumans »

Can you describe the usage for the moving models more in detail? Is it a single rigid body? A vehicle, or character?

Convex Hull description: http://en.wikipedia.org/wiki/Convex_hull
You can automatically create an approximate convex decomposition of multiple convex hulls into a compound shape (btCompoundShape) . See Bullet/Demos/ConvexDecompositionDemo.

If possible, it is best to avoid using a Gimpact triangle mesh shape, it is slower and less stable than a compound of convexes. But you can try your luck, check out Bullet\Demos\MovingConcaveDemo

We should update the documentation, because this is a frequently asked question.
Thanks,
Erwin
MatthiasA
Posts: 4
Joined: Tue May 26, 2009 4:38 pm

Re: Collision detection with Vertices

Post by MatthiasA »

okay iam developing a lego editor
now i want to set up the bricks with a collision
to make it possible to build with different lego bricks
every brick is a object and has a vertex array
You do not have the required permissions to view the files attached to this post.
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: Collision detection with Vertices

Post by Erwin Coumans »

Interesting. Could you share 1 brick model, with holes and pegs for testing?

There are several options for this. Will the entire lego-brick model be 'fixed', and adding a moving brick that gets 'fixed' to the model?
A btCompoundObject might be a good choice. Approximating each individual bricks by a btCompoundShape of lots of spheres might work pretty well in practice:
Image
taken from Takahiro Harada's GDC 2009 presentation.

Then, after you detect that two pieces are attached, you could merge them in a single btCompoundObject.
Do you also need to break the a model into separate bricks afterwards?

Thanks,
Erwin
MatthiasA
Posts: 4
Joined: Tue May 26, 2009 4:38 pm

Re: Collision detection with Vertices

Post by MatthiasA »

Could you share 1 brick model, with holes and pegs for testing?
wich format you need?