How to enable permanent collision detection?

Official forum for the Chipmunk2D Physics Library.
Post Reply
Ichigo
Posts: 13
Joined: Wed May 02, 2012 7:23 am
Contact:

How to enable permanent collision detection?

Post by Ichigo »

Hello there,

As you all may know, the chipmunk doesn't detect all the time the collisions. In my case, i have bodys with great velocity. And what happens sometimes is that a non-static body passes through a static body.

How can i solve this? Is there a right way to do it? Or do i need to change game physics because of that?

Regards,
ichigo.
User avatar
slembcke
Site Admin
Posts: 4166
Joined: Tue Aug 14, 2007 7:13 pm
Contact:

Re: How to enable permanent collision detection?

Post by slembcke »

What you are looking for is often called swept collisions, continuous collision detection or just CCD. Chipmunk doesn't support that currently, and it's not terribly high on my todo list as most games don't really seem to need CCD.

If your fast moving objects are small, such as bullets you can use raycasts instead of objects. Box2D supports CCD if it's a must have feature.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
Ichigo
Posts: 13
Joined: Wed May 02, 2012 7:23 am
Contact:

Re: How to enable permanent collision detection?

Post by Ichigo »

Unfortunatelly my objects are bigger than bullets. Anyway, i will see what i can do.

Thanks for you answer.
User avatar
slembcke
Site Admin
Posts: 4166
Joined: Tue Aug 14, 2007 7:13 pm
Contact:

Re: How to enable permanent collision detection?

Post by slembcke »

Your other option is to use smaller time steps, although it uses more CPU time.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
Ichigo
Posts: 13
Joined: Wed May 02, 2012 7:23 am
Contact:

Re: How to enable permanent collision detection?

Post by Ichigo »

Well, if i do that, the update loop would be wrong. I would not see the bodys update at the right time, i believe.
User avatar
slembcke
Site Admin
Posts: 4166
Joined: Tue Aug 14, 2007 7:13 pm
Contact:

Re: How to enable permanent collision detection?

Post by slembcke »

Actually I would recommend keeping your updates and rendering separate anyway. This is a pretty good article on how to do that:
http://gafferongames.com/game-physics/f ... -timestep/
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
Ichigo
Posts: 13
Joined: Wed May 02, 2012 7:23 am
Contact:

Re: How to enable permanent collision detection?

Post by Ichigo »

Thank you! =)
Post Reply

Who is online

Users browsing this forum: Heise IT-Markt [Crawler] and 10 guests