Hey guys
Just a quick question, is it possible to use bullet to create a body inside another body?
I'm trying to create a simulation of the inside of the cell so for now I'm trying to create a bunch of small spheres inside a larger sphere but the smaller spheres keep shooting out of the big one.
I'm using btConvexHullShape for all the bodies and mass of 0.f for the big sphere (making it static)
Feedback would be appriciated
Body inside another body
-
- Posts: 169
- Joined: Sun Jan 14, 2007 7:56 pm
- Location: Norway
Re: Body inside another body
For the cell's shell you'll have to use some shape that is hollow, so the only thing I can think of is a mesh shape. The mesh triangles are double sided and "paper thin". If the cell body is static, you can use the btBvhTriangleMeshShape.
(if you want it dynamic, maybe the btConvexTriangleMeshShape could work. I'm not sure if that one allows something being trapped inside it's mesh. If it fails, you could try using the Gimpact shape)
Cheers,
Ola
(if you want it dynamic, maybe the btConvexTriangleMeshShape could work. I'm not sure if that one allows something being trapped inside it's mesh. If it fails, you could try using the Gimpact shape)
Cheers,
Ola
-
- Site Admin
- Posts: 4221
- Joined: Sun Jun 26, 2005 6:43 pm
- Location: California, USA
Re: Body inside another body
The most recommended concave (hollow) shape, that can be used for dynamic rigid bodies, is the btCompoundShape. Just add a bunch of convex children shapes (boxes, convex hulls) to the compound to approximate the hollow shape.ola wrote:For the cell's shell you'll have to use some shape that is hollow, so the only thing I can think of is a mesh shape.
Alternatively, you can indeed use the btBvhTriangleMeshShape for static (non-moving) world environment, or btGimpactShape for moving hollow triangle meshes. But again, using the btCompoundShape is preferred over any btGimpact*Shape.
Hope this helps,
Erwin
-
- Posts: 4
- Joined: Mon Jun 22, 2009 9:57 pm
Re: Body inside another body
Well, I tried using btBvhTriangleMeshShape (with a btTriangleMesh as a btStridingMeshInterface) for the shell and a btConvexHullShape for a sphere inside, but the sphere inside still shoots out (without any force applied on either). Is there something I need to set in the WorldInfo or in the world for the collision to work inwards as well?
I wish I could use the compound shape, but we will need some pretty accurate results for many shapes so creating compound shapes becomes either inaccurate or inefficient for our purposes.
I wish I could use the compound shape, but we will need some pretty accurate results for many shapes so creating compound shapes becomes either inaccurate or inefficient for our purposes.
-
- Posts: 4
- Joined: Mon Jun 22, 2009 9:57 pm
Re: Body inside another body
okay, so everything is awesome
I've got both btBvhTriangleMeshShape and btGImpactMeshSahpe working with convex shapes
However, one final question on the topic, for some reason I can't put a btGImpactMeshShape inside the Bvh
they go through each other. Is there a way to make them collide? or are they not designed to do so because they are both concave shapes?
I've got both btBvhTriangleMeshShape and btGImpactMeshSahpe working with convex shapes
However, one final question on the topic, for some reason I can't put a btGImpactMeshShape inside the Bvh
they go through each other. Is there a way to make them collide? or are they not designed to do so because they are both concave shapes?
-
- Posts: 237
- Joined: Tue Jun 29, 2010 10:27 pm
Re: Body inside another body
Is there a reason you aren't using btSphereShape for the spherical objects inside the cell? (maybe you are; just doesn't sound like it so I'm curious why)
-
- Posts: 4
- Joined: Mon Jun 14, 2010 9:30 pm
Re: Body inside another body
Why don't you simply set the collision groups and collision masks to make the cell body not able to collide with the organelles? Of course this will only keep other stuff out, not keep the cell contents in.
It would be nice if there were a "negative shape" class that takes any other shape as its constructor, and swaps the inside-outside relationship of that shape.
It would be nice if there were a "negative shape" class that takes any other shape as its constructor, and swaps the inside-outside relationship of that shape.