[ODE] contact points

Jaroslav Sinecky jsinecky at tiscali.cz
Thu Apr 12 23:24:29 MST 2007


Lewis Foster wrote:
> Sorry, i am populating the dContact structure. I meant that i was 
> adding to that structure, up to the maximum number of contacts 
> specified by the user. The callback function is correctly adding the 
> joint between g1 and g2.
> The thing is though, as two objects collide i run through the following:
> I find out where they are touching.
> I have to then add to the dContact structure, but if i just add once 
> per point of contact I end up affecting just one of the bodies. 
> Therefore surely, for each point of contact I must add to the dContact 
> structure twice, once with g1=object1 and g2=object2, and a second 
> with g1=object2, g2=object1...this one would have an inverted normal.
This is definitely not necessary, only one dContact for the point is 
> If i dont do this, then only one of the objects will move as you 
> mentioned. One will move the distance required such that they no 
> longer touch....however what if that object cannot move....the other 
> object should move but has no way of moving as the normal is pointing 
> toward the object that cannot move.
> Imagine a ball bouncing on the floor....if the contact normal was 
> pointing vertically down into the floor and the floor was g1...then 
> the floor would try to move the distance to seperate the ball and the 
> floor....but it cannot move?
The contact joint created based on dContact structure will make the 
objects pushed out along the normal, whichever of them can be moved, 
will be moved, it's tottaly irrelevant which object (or geom) goes first 
and which is second. The phrase from manual about moving g1 along the 
normal is just to explain how to orient the normal, the collision 
resolution doesn't literally work like that.
If this is not happening, something is wrong, but not in the collision 
> I hope i'm not being completely stupid with this.
> Thanks for your replies, i appreciate your time.
> Lewis

More information about the ODE mailing list