[ODE] Plane-Cylinder collision: how to reproduce problem

Mauro G. Todeschini mauro2006todeschini at itia.cnr.it
Sat Oct 28 00:22:33 MST 2006


Mauro G. Todeschini wrote:
> Bram Stolk wrote:
>> For me, cyl vs plane is OK for both geomoffset and trf geoms.
>>
>> Could you please do this test against svn-tree?
>>
>> - Run test_boxtest and press 'y' a few times.
>>
>> - Edit test_boxstack.cpp and change line 94 to:
>> #define USE_GEOM_OFFSET 0
>>   Rebuild, and re-run the test.
>>
>> For me, both cases are OK.
>> I just tested this with current svn, on linux, with double prec.
> Ok, the test you suggested works correctly in both cases but... I think
> that changing the #define doesn't make any difference for cylinders (ie.
> trf geoms are never used for cylinders). It only makes difference for
> composite objects (which don't contain any cylinder, only capsules).
> Try putting a printf after line 455 and You'll see that you never pass
> from that line with cylinders.
> 
> In my application I discovered that the problem with planes and
> transformed cylinders seems to happen when I define my plane like this
> (gravity is dWorldSetGravity (world,0,-9.8,0);):
> 
> dCreatePlane (space,0,1,0,-20);
> 
> but the problem seems to disappear if:
> 
> dCreatePlane (space,0,1,0,0);
> 
> I think that the negative value in the first definition has something to
> do with the problem.
> 
> Bye and Thanks
Hi,
	I'm not a diff and patch guru :D but I modified test_cylvssphere.cpp to
reproduce the problem I have in my application (use at your own risk
:D). Now I'm convinced that the problem happens when the last value in
dCreatePlane is negative. Try changing it to 0 and the problem seems to
disappear.
test_cylvssphere.cpp is my modified version, while
../../../ode-0.7-20061028/ode/test/test_cylvssphere.cpp is the
unmodified version from today svn. I hope the diff command i used is the
correct one to let you apply the patch.

Bye and Thanks

todeschini at MI-VME-106-NB /src/ode-0.7-20061027/ode/test
$ diff -u test_cylvssphere.cpp
../../../ode-0.7-20061028/ode/test/test_cylvssphere.cpp
--- test_cylvssphere.cpp        Sat Oct 28 06:44:54 2006
+++ ../../../ode-0.7-20061028/ode/test/test_cylvssphere.cpp     Sat Oct
28 05:47:02 2006
@@ -42,7 +42,6 @@

 static dBodyID cylbody;
 static dGeomID cylgeom;
-static dGeomID transfcylgeom;

 static dBodyID sphbody;
 static dGeomID sphgeom;
@@ -90,8 +89,8 @@
       contact[i].surface.soft_cfm = 0.02;
       dJointID c = dJointCreateContact (world,contactgroup,&contact[i]);
       dJointAttach (c,
-                   dGeomGetBody(o1),
-                   dGeomGetBody(o2));
+                   dGeomGetBody(contact[i].geom.g1),
+                   dGeomGetBody(contact[i].geom.g2));
     }
   }
 }
@@ -183,7 +182,7 @@
   dWorldSetGravity (world,0,0,-9.8);
   dWorldSetQuickStepNumIterations (world, 32);

-  dCreatePlane (space,0,0,1,-1);
+  dCreatePlane (space,0,0,1,0);

   cylbody = dBodyCreate (world);
   dQuaternion q;
@@ -195,12 +194,10 @@
   dBodySetQuaternion (cylbody,q);
   dMassSetCylinder (&m,1.0,3,CYLRADIUS,CYLLENGTH);
   dBodySetMass (cylbody,&m);
-  transfcylgeom = dCreateGeomTransform(0);
   cylgeom = dCreateCylinder(0, CYLRADIUS, CYLLENGTH);
-  dGeomTransformSetGeom(transfcylgeom, cylgeom);
-  dGeomSetBody (transfcylgeom,cylbody);
+  dGeomSetBody (cylgeom,cylbody);
   dBodySetPosition (cylbody, 0, 0, 2);
-  dSpaceAdd (space, transfcylgeom);
+  dSpaceAdd (space, cylgeom);

   sphbody = dBodyCreate (world);
   dMassSetSphere (&m,1,SPHERERADIUS);

todeschini at MI-VME-106-NB /src/ode-0.7-20061027/ode/test








More information about the ODE mailing list