Circle shape body penetrations

Chipmunk2D Bindings for the Unity3D engine
Post Reply
ensomniac
Posts: 17
Joined: Thu Sep 05, 2013 1:54 pm
Contact:

Circle shape body penetrations

Post by ensomniac »

Hey Guys,
Another quick question. I have a bunch of circle shapes with ChipmunkBodys attached. When the objects collide, they occasionally penetrate with each other. What is the best method for avoiding this without killing performance?

Thanks
Ryan
compass3
Posts: 37
Joined: Fri Aug 30, 2013 4:27 pm
Contact:

Re: Circle shape body penetrations

Post by compass3 »

I think increase the fixed update rate may help
ensomniac
Posts: 17
Joined: Thu Sep 05, 2013 1:54 pm
Contact:

Re: Circle shape body penetrations

Post by ensomniac »

Unfortunately increasing or decreasing the fixed timestep doesn't help completely. Decreasing it helps a little bit, but not enough. I have to decrease it so low that the motion no longer looks natural. Surely there's a better way to handle shape penetrations? To be fair, I had the same exact problem using physX...
User avatar
slembcke
Site Admin
Posts: 4166
Joined: Tue Aug 14, 2007 7:13 pm
Contact:

Re: Circle shape body penetrations

Post by slembcke »

Decreasing the fixed timestep shouldn't make anything look unnatural. Are you making it so small that it's actually slowing down the whole simulation?

As for the issue, Chipmunk doesn't support swept collisions. This means that it moves objects to their new positions and then checks for overlaps. PhysX does support swept collisions, but it's off by default because it's *very* expensive. You have to turn it on for individual objects and you can really only do it for a few in the scene without killing your performance. There is also some very specific rules about which objects can have swept collisions against others.

If decreasing the timestep isn't an option, the next best thing you can do is to cap your object's velocity. Alternatively, you can change the Chipmunk.collisionBias value to make the overlap disappear more quickly.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
Post Reply

Who is online

Users browsing this forum: No registered users and 14 guests