Ball bouncing like crazy sometimes

Discuss any Chipmunk bugs here.

Ball bouncing like crazy sometimes

Postby nguillemot » Mon Aug 22, 2011 12:30 am

Hello Chipmunk community,

I recently picked up this library, and I'm liking it.
I also picked up the C++ wrapper, but it was very far out of date. I had to make many modifications to make it work with the latest version of chipmunk physics.

I was impressed to see that I could quickly apply forces to a ball in a space, but problems started happening when I created a square shaped frame of static segments around my game's screen boundaries.

I created a free floating ball, whose movement is affected by gravity and some impulses sent by pressing the arrow keys. Sometimes, when this ball bounces on a segment, it makes a healthy bounce. Other times, instead of bouncing from a segment normally, the ball will, on contact with the segment, suddenly be sent flying outside of the play area. Due to the insane speed, it goes right through my walls and goes faaaaar away.

Does somebody know what could be causing this issue? Could it be a problem with the C++ wrapper, am I forgetting to set a default value? I tried playing with mass and elasticity with no luck.

As for the updates to the C++ wrapper I had to implement, I would be glad to upload them somewhere and share them with the community, but I want to be sure that it's not causing any issues.

Thank you in advance!

ps: If somebody wants to work with me on updating and cleaning up the C++ wrapper, feel free to contact me at
Posts: 2
Joined: Mon Aug 22, 2011 12:15 am

Re: Ball bouncing like crazy sometimes

Postby slembcke » Mon Aug 22, 2011 1:23 am

Is it possible that your ball is spinning really fast which is causing it to bounce haywire? Can you post the code you are using to apply the impulse, and perhaps the code that is calling in the wrapper?

Also, you might find the extract_protos.rb script handy. I can't remember if I put it in the release or just in version control though. It will spit out all the Chipmunk functions for you and bunch of info about them. A C++ wrapper should be fairly straightforward and you can probably automate generating most of the wrapping functions. An up to date C++ wrapper would be pretty handy to the community if you have it in a state that you'd be willing to release.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! ->
User avatar
Site Admin
Posts: 4164
Joined: Tue Aug 14, 2007 7:13 pm

Re: Ball bouncing like crazy sometimes

Postby nguillemot » Thu Aug 25, 2011 1:57 am

It looks like I fixed the issue by implementing better management of delta time in my game. Weird.

Anyways, the features of the patched up C++ wrapper seem to work right now, but it probably lacks some features of the latest versions of chipmunk. I'll see if I have time to make any significant improvement, and if I can I will notify the community.
Posts: 2
Joined: Mon Aug 22, 2011 12:15 am

Return to Bugs

Who is online

Users browsing this forum: No registered users and 0 guests