# [ODE] contact points

Jaroslav Sinecky jsinecky at tiscali.cz
Wed Apr 11 23:38:18 MST 2007

```Hi,
the orientation of normal has to be consistent with ordering of g1 and
g2 (as you say it yourself). If you save box1 into g1 field of resulting
dContact structure and box2 into g2, normal should point from box2 into
box1. You can also save box1 into g2 and box2 into g1 and flip the
normal in that case (from box1 into box2).
The ode manual is very precise on this:
"The convention is that if body 1 is moved along the normal vector by a
distance depth (or equivalently
if body 2 is moved the same distance in the opposite direction) then the
contact depth will be reduced to
zero. This means that the normal vector points ”in” to body 1."

Hope this helps,
Jaroslav

Lewis Foster wrote:
> Hi all, i'm playing around with convex hull's at the minute and what
> i've got so far seems to be generating the correct contact normal and
> so i've moved on to creating the contact points.
>
> The problem i'm having is that the contact points are either doing
> nothing, or if anything they are pulling one object into the other, so
> you would think the normal was inverted. However the normal should be
> able to be in either direction, so long as you have the correct
> ordering of g1 and g2.
>
> Picture this, box1 is dropping onto box2 which is resting on the
> floor. The normal correctly points from box1 toward box2, downwards.
>
> Cycling through the points of box2, two points are correctly
> identified as being behind the plane of box1 and so are added to the
> contact array. The depth is correctly identified and is positive.
>
> Why then would box1 continue downwards into box2? It seems that as
> box2 is unable to move in the direction of the normal (due to the
> floor) it remains where it is and box1 simply continues to fall
> through....obviously the collision detection side of things doesn't
> need to know if there is an immovable object resisting one objects
> motion. In this case, how does the collision detection, or ODE, know
> to invert the normal and make the collision points act in the opposite
> direction on the other object, that is free to move?
>
> I hope that makes sense. Any help would be greatly appreciated...I
> wonder if i'll finish this before Erwin finishes the bullet
> integration...my work will be obsolete otherwise.
>
> Thanks.
>
> Lewis
> ------------------------------------------------------------------------
>
> _______________________________________________
> ODE mailing list
> ODE at ode.org
> http://mooshika.org/mailman/listinfo/ode

```