code-google-com / bullet

Automatically exported from code.google.com/p/bullet
0 stars 0 forks source link

Allow to dynamically changing capsule radius/length #325

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago

Right now there is no API to set the radius/length of a capsule, after it has 
been created. 

Currently the only way is to remove the rigid body from the world, replace 
the capsule shape with a new one.

There are some issues when changing the collision shape. In particular some 
caches related to contact points need to be flushed.

Provide some API to change radius/length and explanation how to flush those 
caches.

Original issue reported on code.google.com by erwin.coumans on 8 Jan 2010 at 4:32

GoogleCodeExporter commented 9 years ago

Warning: changing collision shapes for objects in a world is not recommended, 
it can 
cause invalid contact points etc.

Either make the change while the object is not in the world 
(removeCollisionObject/removeRigidBody) or use the following line:

_btBroadphaseInterface->getOverlappingPairCache()->cleanProxyFromPairs( 
_btRigidBody-
>getBroadphaseProxy(), _btCollisionDispatcher );

See also this forum topic for the request:
http://bulletphysics.org/Bullet/phpBB3/viewtopic.php?f=9&t=4561

We'll add a 'setImplicitShapeDimentions' to btConvexInternalShape with above 
warning 

Original comment by erwin.coumans on 19 Jan 2010 at 6:18

GoogleCodeExporter commented 9 years ago

setImplicitShapeDimensions, with warning, is added here:
http://code.google.com/p/bullet/source/detail?r=1881

To change the radius/length of a btCapsuleShape (Y = up/half length)

capsule->setImplicitShapeDimensions(btVector3(radius,0.5*length, radius));

Original comment by erwin.coumans on 19 Jan 2010 at 6:37