Sphere against walls, bounce problem

asancho
Posts: 3
Joined: Fri Apr 15, 2011 10:05 am

Sphere against walls, bounce problem

Post by asancho »

Hi,
I have a scenario with a btCollisionShape that I use as a wall and a btRigidBody (and sphere) that I use like a pool ball.

I'm trying to reach this scenario:
Image

But unfortunately, I can't reach the bounce. When my sphere collides with the box, the ball just remains in the same position.

I'm trying to solve this playing with the restitution value of both elements (using value 1.0 for example) without succes.

How can I solve it? help please.
Nickeeh
Posts: 14
Joined: Wed Feb 09, 2011 8:35 pm

Re: Sphere against walls, bounce problem

Post by Nickeeh »

Does your bouncing look like in this video?

http://www.astrant.net/Bullet-Debug-Spheres.mov
asancho
Posts: 3
Joined: Fri Apr 15, 2011 10:05 am

Re: Sphere against walls, bounce problem

Post by asancho »

Nickeeh wrote:Does your bouncing look like in this video?

http://www.astrant.net/Bullet-Debug-Spheres.mov
Yes, do you know why? T_T

Thanks for the reply.
Nickeeh
Posts: 14
Joined: Wed Feb 09, 2011 8:35 pm

Re: Sphere against walls, bounce problem

Post by Nickeeh »

For me, it was because I set a minimum velocity on all my objects. At least, when I removed the minimum velocity, the problem disappeared, and spheres are now bouncing more or less like I expected.

About the restitution: I'm having the same problem. Even with both objects given a "high" restitution, energy is still lost. I'm currently simulating spheres bouncing on kinematic objects in a zero-gravity environment. The spheres have restitution 1.0, kinematic objects do too, but still the velocity is going down when the spheres bounced. If I turn the restitiution of both up to something like.. 1.5 or even higher, energy keeps getting added, quite extremely, but also randomly! One bounce will greatly accelerate the object (as expected with these high values) while another bounce will accelerate it much less if not slow it down. :/
asancho
Posts: 3
Joined: Fri Apr 15, 2011 10:05 am

Re: Sphere against walls, bounce problem

Post by asancho »

How do you have modified the minimum velocity?
bitshifternz
Posts: 6
Joined: Sun Apr 17, 2011 11:19 pm

Re: Sphere against walls, bounce problem

Post by bitshifternz »

I think there may be a bug with sphere <-> box collision and restitution. If I set restitition on a box collision shape if works as expected when colliding with another box, but sphere frequently loses all it's velocity when it collides (with a box in my case).

Perhaps it's an issue with the btConvexConvexAlgorithm which is what box <-> sphere collisions use, because if I replace btBoxBoxCollisionAlgorithm with btConvexConvexAlgorithm my box doesn't bounce as well as it does when using btBoxBoxCollisionAlgorithm.

To try it out do:
m_dispatcher->registerCollisionCreateFunc(BOX_SHAPE_PROXYTYPE,BOX_SHAPE_PROXYTYPE,m_collisionConfiguration->getCollisionAlgorithmCreateFunc(CONVEX_SHAPE_PROXYTYPE,CONVEX_SHAPE_PROXYTYPE));

That's about all I've worked out so far.