[ODE] Restoring Force

Tobias Zimmer tozim at gmx.de
Sun Jul 8 13:06:24 MST 2007


Hi all!

I'm still working at my brushes and returned to the matter of the  
restoring force.

The restoring forces are mostly calculated over the objects distance  
to the position
where it should be. But if an object is turning around in space this  
distance isn't fix.
So I decided to take the way over the angle of the segments in the  
bristles. If the
angle is zero and the bristle such is not bended the force is zero as  
well. With
growing angle the force gets bigger. This is the way I programmed it:


   dReal force= -0.00000000015;
   for (i=25; i<100; i++) {
       dReal angle1 = dJointGetUniversalAngle1(joint[i]);
       dReal angle2 = dJointGetUniversalAngle2(joint[i]);
       dBodyAddForce (segment[i],-1*force*sin(angle1),-1*force*sin 
(angle2),0);
       }


Pitily it doesn't really work, the bristles are not returning to  
their position. The
angles even get values which they are forbidden to get because of the  
hi- and
lostop-params.

So, any idea, what I did wrong? How would you program a flexible  
"stick"?
Imagine a carbone bar or something similar. You should be able to  
bend it, but
it has to return to its straight form after the deformation.

desperate sunday-evening regards,
Tobias


More information about the ODE mailing list