I would like to have a number of objects, eg spheres, trapped inside a larger sphere and affected by gravity. Think gumballs in a gumball machine, or similar.
Is there an existing collision object that could represent the containing sphere?
If not, how would I go about implementing one (class to subclass, etc)?
Thanks for your help!
Collision with INSIDE of sphere?
-
Flix
- Posts: 456
- Joined: Tue Dec 25, 2007 1:06 pm
Re: Collision with INSIDE of sphere?
Concave objects in Bullet can be handled this way (as far as I know):
1) static objects:
a) btBvhTriangleMeshShape
b) btGImpactMeshShape
c) btCompoundShape + libConvexDecomposition
d) btGImpactConvexDecompositionShape (in libGImpactUtils)
2) dynamic (i.e. moving) objects:
a) btGImpactMeshShape
b) btCompoundShape + libConvexDecomposition
c) btGImpactConvexDecompositionShape (in libGImpactUtils)
If the big sphere is static I would use a btBvhTriangleMeshShape (of course you need to model it in a 3d program before usage).
The main problem if that the surface would be very thin (tunnelling might happen more easily).
As an aternative you could use a btCompoundShape made up by a lot of btConvexHullShapes that have enough depth (but it's not very easy to split a sphere "shell" into multiple convex hull shapes I guess).
P.S. If you were thinking of creating a new collision shape type for it inside Bullet, I can't give you any clue...
Good luck.
1) static objects:
a) btBvhTriangleMeshShape
b) btGImpactMeshShape
c) btCompoundShape + libConvexDecomposition
d) btGImpactConvexDecompositionShape (in libGImpactUtils)
2) dynamic (i.e. moving) objects:
a) btGImpactMeshShape
b) btCompoundShape + libConvexDecomposition
c) btGImpactConvexDecompositionShape (in libGImpactUtils)
If the big sphere is static I would use a btBvhTriangleMeshShape (of course you need to model it in a 3d program before usage).
The main problem if that the surface would be very thin (tunnelling might happen more easily).
As an aternative you could use a btCompoundShape made up by a lot of btConvexHullShapes that have enough depth (but it's not very easy to split a sphere "shell" into multiple convex hull shapes I guess).
P.S. If you were thinking of creating a new collision shape type for it inside Bullet, I can't give you any clue...
Good luck.
-
Erwin Coumans
- Site Admin
- Posts: 4221
- Joined: Sun Jun 26, 2005 6:43 pm
- Location: California, USA
Re: Collision with INSIDE of sphere?
It should be easy to create a btConpoundShape with btConvexHullShape child shapes, making a thick shell, either programatically or using a modeler (Blender, Maya etc).
Thanks,
Erwin
Thanks,
Erwin