[ODE] exception in dCollide

Javier Loureiro Varela derethor at derethor.net
Mon Feb 6 13:59:12 MST 2006


        Hello, my name is Javier Loureiro, and this is my first
        message to the list, so, greetings to all the subscribers, and
        sorry for my poor english.

        ODE is working now properly, at least on small scenes. I can
        check collitions with cubes and spheres, and I wrote a trimesh
        geometry exporter that works pretty well.

        Now, I tried with a small polymesh setup as a Geom, and few
        spheres, and one of them is bouncing on the end of a corridor.
        Said sphere causes dCollide to throw an exception forever,
        trying to read from address 0x00000008...

        I dont know how to explain all the details, so I start with
        the collision code.

        Please, any suggestion?

static void NearCallBack (void *data, dGeomID o1, dGeomID o2 )
{
        if ( ! CurrentWorld )
        {
                return;
        }

        if ( ! CurrentJointGroup )
        {
                return;
        }

        if ( o1 == 0 && o2 == 0)
        {
                return;
        }

        dBodyID b1 = dGeomGetBody(o1);
        dBodyID b2 = dGeomGetBody(o2);

        if ( b1 == 0 && b2 == 0)
        {
                return;
        }

        if (b1 && b2 && dAreConnectedExcluding (b1,b2,dJointTypeContact))
        {
                return;
        }

        dContact contacts [CurrentMaxCollisionPoints];

        try
        {
                int numCollisions = dCollide ( o1, o2, CurrentMaxCollisionPoints, &contacts[0].geom, sizeof(dContact) );

                for(int i = 0; i < numCollisions; ++i)
                {
                        contacts[i].surface.mode = dContactBounce | dContactApprox1 | dContactSoftERP | dContactSoftCFM;
                        contacts[i].surface.mu = 1;
                        contacts[i].surface.bounce = 0.6;
                        contacts[i].surface.bounce_vel = 0.15;
                        contacts[i].surface.soft_erp = 0.8;
                        contacts[i].surface.soft_cfm = 0.01;

                        dJointID c = dJointCreateContact(CurrentWorld, CurrentJointGroup, &contacts[i]);
                        dJointAttach (c, b1, b2);
                }
        }
        catch (...)
        {
                std::cerr << "dCollide throw an exception" << std::endl;
        }
}



--
Signed,

  Javier Loureiro Varela




More information about the ODE mailing list