[ODE] StackOverflowException due to dJointAttach

darkrunic@aol.com darkrunic at aol.com
Fri Dec 1 03:50:25 MST 2006

Hi all,
I'm having a bit of a strange error here, which I've tracked down to dJointAttach (at least, I think I have.  When I comment it out I don't have the problem, though dJointAttach might just be the catalyst).
For testing, I've created a 10x10 'grid' of spheres and then I apply some force to one of them into the others and watch the chain reaction.  Besides the fact that I'm getting some seemingly excessive torque on my first sphere (still have some parameter tweaking to do), everything seems to be going okay...  that is, until I get about 30 seconds into the simulation, where I get a StackOverflowException (which, from what I've read, can be caused by excessive nested method calls?).  Here's the contents of my NearCallback method, maybe I'm just doing something stupid that one of you can point out to me.  Thanks for any input!
void CollisionCallBack(void* data, dGeomID o1, dGeomID o2)
    int maxContacts = 1;
    dContactGeom* contacts = new dContactGeom[maxContacts];
    if (dCollide(o1, o2, maxContacts, contacts, sizeof(dContactGeom)) > 0)
        for (int i = 0; i < maxContacts; i++)
            dContact currentContact;
            currentContact.geom = contacts[i];
            dJointAttach(dJointCreateContact(space->worldId, 0, &currentContact), dGeomGetBody(o1), dGeomGetBody(o2));
Check out the new AOL.  Most comprehensive set of free safety and security tools, free access to millions of high-quality videos from across the web, free AOL Mail and more.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://q12.org/pipermail/ode/attachments/20061201/4530a4f7/attachment.htm

More information about the ODE mailing list