bodies go through walls?

Official forum for the Chipmunk2D Physics Library.
Post Reply
rfkrakora
Posts: 12
Joined: Mon Jun 29, 2009 10:53 pm
Contact:

bodies go through walls?

Post by rfkrakora »

Ok, I've been working with chipmunk on the iPhone now for a few weeks ( via cocos2d ). As a test, I have four circles I am throwing around and four walls ( bounding the entire screen ). I can grab the circles, move them around, then use cpApplyImpulse to look like they are being thrown when I release them. It all works great and seems fine. But I can "push" them through the walls, if I grab one and drag it to the wall quickly, it will disappear, when I look at the body position, it is way outside my 300x480 screen.

I've tried making the walls thicker, changing the dt/number of steps, etc. and still no luck. I even downloaded the "grabbed_too" project and built and ran that to see how it behaved and it does the same thing ( allows me to move the balls through the walls, even if I modify that project to make the walls thicker ).

If I reduce my impulse it will not go through walls, but then the bodies do not move much either, which is not desirable. I am assuming many ( if not all ) of the developers using chipmunk have solved this and maybe I will as well, but I was hoping for some tips on what to do. Maybe an example project sitting out there somewhere that has all of this coded working to play with?

Any help or direction would be appreciated.

Thanks,
RK
User avatar
slembcke
Site Admin
Posts: 4166
Joined: Tue Aug 14, 2007 7:13 pm
Contact:

Re: bodies go through walls?

Post by slembcke »

Chipmunk does not do swept collisions. They are expensive to run, difficult to implement correctly, and most importantly not something that I find fun to do for a fun side project.

You either need to lower your timestep so objects move less in each step or make your walls thicker, possibly much thicker.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
rfkrakora
Posts: 12
Joined: Mon Jun 29, 2009 10:53 pm
Contact:

Re: bodies go through walls?

Post by rfkrakora »

This may be a stupid question, but is there any mechanism in Chipmunk that allows for specification of boundaries for bodies/shapes to stay within? Or maybe a boundary for the entire space to corral all it's bodies/shapes?

-RK
User avatar
slembcke
Site Admin
Posts: 4166
Joined: Tue Aug 14, 2007 7:13 pm
Contact:

Re: bodies go through walls?

Post by slembcke »

No, you will just have to make your walls thicker.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
rfkrakora
Posts: 12
Joined: Mon Jun 29, 2009 10:53 pm
Contact:

Re: bodies go through walls?

Post by rfkrakora »

Making the walls thicker did work, I was just wondering about any other features I may have missed. Chipmunk is great! Thanks for your time.
Post Reply

Who is online

Users browsing this forum: No registered users and 16 guests