[ODE] StackOverflowException due to dJointAttach

darkrunic@aol.com darkrunic at aol.com
Fri Dec 1 15:20:44 MST 2006


I think I've got it figured out.  From reading the docs, I misunderstood when it says "Contact joints typically have a lifetime of one time step. They are created and deleted in response to collision detection."
 
Didn't read that as being something I had to handle myself :D
 
Thanks!

darkrunic at aol.com wrote:
> 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));
>         }
>     }

      delete [] contacts;
> }
________________________________________________________________________
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/2247b93a/attachment.htm


More information about the ODE mailing list