bullet3 icon indicating copy to clipboard operation
bullet3 copied to clipboard

Restitution not working for btConvexHullShape for small timesteps it does work for btBoxShape

Open bbird5490 opened this issue 1 year ago • 0 comments

Hi,

I have an issue with restitution for btConvexHullShape for small timesteps.

I modified the BasicDemo to show my problem. You can find the changed code here: https://github.com/bbird5490/bullet3

Basically I:

  • changed the timestep in examples/CommonInterfaces/CommonRigidBodyBase.h to:

m_dynamicsWorld->stepSimulation(0.002, 10, 0.0002);

  • replaced the btBoxShape by a ConvexHullShape that has the same shape and dimensions in
                 // btBoxShape* colShape = createBoxShape(btVector3(.1, .1, .1));

		btConvexHullShape* colShape = new btConvexHullShape();
		colShape->addPoint(btVector3(-.1, -.1, -.1));
		colShape->addPoint(btVector3(-.1, -.1,  .1));
		colShape->addPoint(btVector3(-.1,  .1, -.1));
		colShape->addPoint(btVector3(-.1,  .1,  .1));
		colShape->addPoint(btVector3( .1, -.1, -.1));
		colShape->addPoint(btVector3( .1, -.1,  .1));
		colShape->addPoint(btVector3( .1,  .1, -.1));
		colShape->addPoint(btVector3( .1,  .1,  .1));
  • added restitution values for the ground and the convex hull using setRestitution

If you run the basic demo you will see that the convex hull does not bounce, while if you switch back to the BoxShape, it does bounce.

Also if you go back to the standard timestep the convex hull bounces too.

Am I doing something wrong?

Many thanks!

bbird5490 avatar Sep 19 '22 15:09 bbird5490