libCCD doesn't properly take into account geom offsets.

Issue #38 wontfix
Former user created an issue

I am seeing some strange results with libCCD enabled. This only occurs when I use geom offsets. See the following video (where I switch between ODE and Bullet):

https://omarkermad-demo3d.tinytake.com/sf/OTE1Njg4XzM4NzkyMzE

The cylinder is a z-axis aligned cylinder with an offset rotation of 90 degrees about the x-axis.

Comments (8)

  1. Oleh Derevenko Account Deactivated

    There were corrections for cylinder collisions recently. Please test with the latest version downloaded from trunk.

  2. Oleh Derevenko Account Deactivated

    Also, please make sure you allow 8 or more contacts for the cylinder collision.

  3. Omar Kermad

    I'm up to date. Also, looking back over the recent commits, it seems that the changes were for cylinder-cylinder collisions only. The problem only occurs when the cylinder is given a rotation offset. It's fine when the cylinder has just a position offset or when the box has position or rotation offsets. I have also found that if I drop the cylinder on the center of the box then it works fine. It gets progressively worse as I drop the cylinder further away from the center of the box:

    https://omarkermad-demo3d.tinytake.com/sf/OTE4NDQ3XzM4ODczMTA

    The capsules work fine.

    Thanks.

  4. Oleh Derevenko Account Deactivated

    I tried to reproduce your example but I could not. If I rotate a z-axis aligned cylinder 90 degrees about the x-axis I get it with the cylinder axis horizontal while in your video the cylinder axis seems to be vertical. Could you provide parameters you use to create your objects/geometries?

  5. Oleh Derevenko Account Deactivated

    So, you probably configure ZX plane to be the horizontal and Y axis to be the vertical. I have looked through collision implementation in collision_libccd.cpp and I do not see any obvious issues except for the collision returning at most 1 contact and that means, it would be better if it was improved similarly to how the cylinder-cylinder collision was.

    To test I used the following changes in demo_boxstack and pressed 'r', then 'b', then 'y' keys.

    diff -r f4481d8d54b3 ode/demo/demo_boxstack.cpp
    --- a/ode/demo/demo_boxstack.cpp    Mon Jul 11 01:06:10 2016 +0300
    +++ b/ode/demo/demo_boxstack.cpp    Sun Aug 21 01:15:00 2016 +0300
    @@ -242,8 +242,14 @@
    
             obj[i].body = dBodyCreate(world);
    
    -        for (k=0; k<3; k++)
    -            sides[k] = dRandReal()*0.5+0.1;
    +        if (cmd == 'b') {
    +            for (k=0; k<3; k++)
    +                sides[k] = 1;
    +        }
    +        else {
    +            for (k=0; k<3; k++)
    +                sides[k] = dRandReal()*0.5+0.1;
    +        }
    
             dMatrix3 R;
             if (random_pos)  {
    @@ -259,9 +265,18 @@
                     if (pos[2] > maxheight)
                         maxheight = pos[2];
                 }
    -            dBodySetPosition(obj[i].body, 0,0,maxheight+1);
    -            dRSetIdentity(R);
    -            //dRFromAxisAndAngle (R,0,0,1,/*dRandReal()*10.0-5.0*/0);
    +
    +            if (cmd == 'b')
    +            {
    +                dBodySetPosition(obj[i].body, 0.7, 1, maxheight+1);
    +                dRSetIdentity(R);
    +            }
    +            else
    +            {
    +                dBodySetPosition(obj[i].body, 1, 1, maxheight+1);
    +                dRFromAxisAndAngle (R,1,0,0,/*dRandReal()*10.0-5.0*/0.03);
    +            }
    +
             }
    
             dBodySetRotation(obj[i].body,R);
    
  6. Omar Kermad

    Yes, I have the zx-plane as my horizontal plane.

    I investigated a little more on Friday and I found that I didn't need to have an offset rotation. Just rotating the body 90 degrees about the x-axis resulted in the same behavior. I also found, however, that the behavior is very sensitive to the size of the cylinder, the size of the box and how far from the edge of the box that the cylinder is dropped. I can provide the exact dimensions on Monday.

    The contact positions seem to be calculated correctly in all cases. It's the penetration depth and normal that are not, which suggests that the problem is in libCCD's MPR routine. I am going to try and switch to using GJK next and also updating libCCD (since the version that ODE is using is rather dated). I'll report back on whether either of these make a difference.

    Thanks.

  7. Piotr Piastucki

    Alternatively you can try passing the following option:

    --with-box-cylinder=default
    

    when running configure to make ODE use the built-in collider instead of libccd and see if it helps.

  8. Log in to comment