strange bouncing issue

Official forum for the Chipmunk2D Physics Library.
Post Reply
revanthedarth
Posts: 2
Joined: Sat Aug 01, 2009 7:42 am
Contact:

strange bouncing issue

Post by revanthedarth »

I've been trying to make a pong game with a physics library to get used to the concept of using libraries. First I have chosen Box2D but it was written in C++ and i'm not used to using C++ libraries as much as C ones (I've been studying OpenGL for more than 2 years). Box2D has strange problems in bouncing. I've encountered the same problems when dealing with chipmunk.

First, bounced objects gain strange velocities. No matter how i set the value of elasticity, the objects gain strange velocities. Sometimes they speed up, sometimes speed down, it looks like random.

When i set friction a value other than zero, objects bounce even worse. They bounce to the left mostly, even when they are (and their velocities are) perpendicular.

Third, circles don't bounce. I don't know what i'm setting wrong but when i create circles as shapes, they don't even bounce.

Any help would be greatly appreciated.
maximile
Posts: 157
Joined: Mon Aug 20, 2007 12:53 pm
Location: London, UK
Contact:

Re: strange bouncing issue

Post by maximile »

Pong isn't actually very suited to a physics engine like Chipmunk. But there are things you could do to improve it.

Elasticity values of 1 and above quickly lose accuracy, so if you want the ball to stay travelling at a steady speed you'll need to check it manually from time to time.

Make sure you have the elastic iterations set to a high enough value. It's always a trade off between accuracy and simulation speed. Make sure you're using a fixed timestep.

No idea about the circles issue.
revanthedarth
Posts: 2
Joined: Sat Aug 01, 2009 7:42 am
Contact:

Re: strange bouncing issue

Post by revanthedarth »

Oh, n00bish of me, i wasn't rendering rotated primitives. Speeding up and wrong directional bouncing issue were about rotations. I still have some problems after solving rotation issue but they're minor. I dont know how but i've solved the circle problem too.


I hope this post will be read by n00bs of the physics libraries. Thanks anyway.
Post Reply

Who is online

Users browsing this forum: No registered users and 27 guests