What is "contacts->dist==0" mean? When will it happen

Official forum for the Chipmunk2D Physics Library.
Post Reply
User avatar
mizyeh
Posts: 1
Joined: Tue Aug 18, 2009 4:38 am
Contact:

What is "contacts->dist==0" mean? When will it happen

Post by mizyeh »

I noticed that in collision callback function sometimes "contacts->dist==0" ,
I know dist is how far the two objects are penetrating eachother,but it seems nonzero value mostly .
"contacts->dist==0" seems to happen when objectA colliding objectB very slightly,
In order to using this characteristic , I'd like to know what is it mean and when will it happen, thanks :D
Miz
User avatar
slembcke
Site Admin
Posts: 4166
Joined: Tue Aug 14, 2007 7:13 pm
Contact:

Re: What is "contacts->dist==0" mean? When will it happen

Post by slembcke »

That should be extremely rare when using imprecise floating point numbers. It basically means that the objects are touching, but not overlapping. That probably happens from setting initial positions on objects, like creating two circles with radius 1 exactly two distance units apart.
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 15 guests