[ODE] cylinder plane bug

Tomek Klin klinikk at o2.pl
Tue Sep 19 05:43:12 MST 2006


Hi,

I find one bug in cylinder vs plane collide.
www.klinik.frehost.pl/filmiki/cylinder_plane_bug.avi
this is hapend when center of bottom disk intersect a plane.

I fixed this bug, but a think that problem is in isect_disc_plane(...)
or in isect_plane_plane(...)



collide_cylinder_plane.cpp (line 335)

  if (top_disc_does_intersect)
  {
+   if (dDOT(doi_top,planenorm)>0)
+      dVector3Scale(doi_top,-1);
    dContactGeom *Contact = SAFECONTACT(flags, contact, nContacts, skip);
    dVector3 tmp;
    dVector3Copy(doi_top, tmp);
    dVector3Scale(tmp, radius);
    dVector3Add(disc_top_pos, tmp, Contact->pos);
    // Note: ODE convention is: normal points *into* g1
    Contact->g1 = cylgeom;
    Contact->g2 = planegeom;
    dVector3Copy(planenorm, Contact->normal);
    dReal d = depth_top * dDOT(planenorm, doi_top);
    Contact->depth = dFabs(d);
    nContacts++;
  }

  if (bot_disc_does_intersect)
  {
+   if (dDOT(doi_bot,planenorm)>0)
+        dVector3Scale(doi_bot,-1);
    dContactGeom *Contact = SAFECONTACT(flags, contact, nContacts, skip);
    dVector3 tmp;
    dVector3Copy(doi_bot, tmp);
    dVector3Scale(tmp, radius);
    dVector3Add(disc_bot_pos, tmp, Contact->pos);
    // Note: ODE convention is: normal points *into* g1
    Contact->g1 = cylgeom;
    Contact->g2 = planegeom;
    dVector3Copy(planenorm, Contact->normal);
    dReal d = depth_bot * dDOT(planenorm, doi_bot);
    Contact->depth = dFabs(d);
    nContacts++;
  }

ps. I'm sorry for my english :)
-- 
Tomek Klin



More information about the ODE mailing list