How do I create a body from multiple convex shapes*?

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
JabberWorx
Posts: 10
Joined: Sat Mar 26, 2011 9:33 am

How do I create a body from multiple convex shapes*?

Post by JabberWorx »

I'm trying to figure out how I can create a body from several parts ofa mesh which I want to combine together, each part is convex and I was wondering if I added a bunch of convex shapes to the same body if it would be treated concave with some degree of accuracy.

With boxes and such I just do a new BoxShape(), however the ConvexShape() constructor is protected so I can't access it. So how am I supposed to create ConvexShapes?

Thanks for any help!
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: How do I create a body from multiple convex shapes*?

Post by Norbo »

each part is convex and I was wondering if I added a bunch of convex shapes to the same body if it would be treated concave with some degree of accuracy
A CompoundShape will act concave when it has multiple convexes in it, yes. You can use the prefab entity type CompoundBody to simplify the construction process. Check out the CompoundBodiesDemo for an example of how to set up the elements.
With boxes and such I just do a new BoxShape(), however the ConvexShape() constructor is protected so I can't access it. So how am I supposed to create ConvexShapes?
I think you might be looking for the ConvexHullShape. ConvexShape is the superclass of all convex shapes, including BoxShape and ConvexHullShape.
JabberWorx
Posts: 10
Joined: Sat Mar 26, 2011 9:33 am

Re: How do I create a body from multiple convex shapes*?

Post by JabberWorx »

Norbo wrote:
each part is convex and I was wondering if I added a bunch of convex shapes to the same body if it would be treated concave with some degree of accuracy
A CompoundShape will act concave when it has multiple convexes in it, yes. You can use the prefab entity type CompoundBody to simplify the construction process. Check out the CompoundBodiesDemo for an example of how to set up the elements.
With boxes and such I just do a new BoxShape(), however the ConvexShape() constructor is protected so I can't access it. So how am I supposed to create ConvexShapes?
I think you might be looking for the ConvexHullShape. ConvexShape is the superclass of all convex shapes, including BoxShape and ConvexHullShape.
Oh ok, awesome! I'll look into all of that then :)

As an aside is there any thorough documentaiton on Bepu?
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: How do I create a body from multiple convex shapes*?

Post by Norbo »

Apart from the demos that come with the source, there's this documentation: http://bepuphysics.codeplex.com/documentation
Post Reply