[ODE] how to glue bodies together ?

Roel van Dijk roelvandijk at home.nl
Sat Jan 31 17:49:23 MST 2004


On Friday 30 January 2004 04:18, Nate W wrote:
> Does Roel implement the mass-combining and mass-separating functions, or
> is his code implemented as multiple ODE bodies connected with fixed
> joints?
Now, I just modified the code that handles joints. Nothing fancy. I am not a 
physics or math guy ;-)

The whole breakable joints thing works really simple. First I implemented it 
outside ODE in my wrapper class for joints. I used the dJointFeedback struct 
to get the forces working on the joint. Above a certain threshold I would 
disconnect the joint.
Then to put it inside ODE I simply searched the source files for the place 
where the dJointFeedback struct is filled (step.cpp line: 964). Now the code 
that fills the dJointFeedback struct is executed both if the user called 
dJointSetFeedback and if a joint is breakable. But a few lines lower the 
comment says: "no feedback is required, let's compute cforce the faster way". 
But I don't know exactly how much faster that is. 

There's another part of the breakable joints that can be very expensive. In 
the processIslands function (ode.cpp) I loop over all the joints the check if 
they are breakable. If they are I check if they are broken. But if you have a 
lot of joints then this could be expensive.

A possible solution would be to have a seperate linked list of breakable 
joints and only loop over that list in the processIslands  function to see if 
they are broken. And each breakable joint should have a pointer to it's next 
and previous breakable joint to speed up insertion and removal from that 
list.

When I have the time I can profile the breakable joints by comparing them with 
original joints and with enabled and disabled breakable joints. 


More information about the ODE mailing list