[ODE] Interesting... quirks

Wesley Paugh wespaugh at gmail.com
Tue Jul 18 10:15:07 MST 2006


That has helped me understand a lot, thank you.

The problems still seem to be occurring, unfortunately. Here's the code for
the simulation loop:


            if( !contactGroup )
                contactGroup = new dContactGeom[1];

            int numC = dCollide(*leftBox, *rightBox, 1, contactGroup,
(int)sizeof(dContact));

            if( !contacts )
                contacts = dJointGroupCreate(1);

            for(int i = 0; i < numC; ++i)
            {
                // create a contact joint between both objects
                dContact c;
                c.surface.mode = ::dContactSoftERP;
                c.surface.mu = .1;
                c.surface.soft_erp = .1;
                c.geom = contactGroup[i];

                // create create the joint
                dJointID contact_joint = dJointCreateContact(theWorld,
contacts, &c);
                // attach the joint to both objects
                dJointAttach(contact_joint, dGeomGetBody(leftBox->id()),
dGeomGetBody(rightBox->id()));
            }

            // code to update graphics is here

            dWorldStep(theWorld, simStepSize + (0 - timeTilStep)); //
simulate one step
            timeTilStep = simStepSize;

            dJointGroupEmpty(contacts);

Commenting out that last line allows the collision to take place, but the
objects disappear shortly afterward. Uncommented, no collision occurs, for
reasons that are beyond me.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://q12.org/pipermail/ode/attachments/20060718/611c7615/attachment.htm


More information about the ODE mailing list