container collision objects

binofet
Posts: 20
Joined: Fri Jun 15, 2007 5:03 pm

container collision objects

Post by binofet »

hello all,

I'm interested in what others might have implemented to create "container" objects; i.e. a barrel you can put collision objects in that would spill out if tipped over.

I was thinking it would be cool to have a Boolean cylinder/box/etc shape that was defined by the sum or subtraction of two shapes and collision is resolved vs the resultant implicit shape.

Obviously I can make a compound object out of some boxes to define a barrel and just use that for my container, but I thought I'd just ask about what complexities might arise from a boolean shape.


Thanks,

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

Re: container collision objects

Post by Erwin Coumans »

I've been discussing this approach with several people, but it is tricky.

Booleans would create concave objects, and the shortcuts/optimizations that apply to convex objects don't apply anymore. You can still try it, and create a custom collision shape (type) and collision algoritm to deal with this special case.

My best advice is to go with a btCompoundShape, with childshapes that have volume (a collection of boxes or convex hulls). Second choice is using GIMPACT, especially the new GIMPACT 0.3 has some features.

Hope this helps,
Erwin