Simple constraint force experiment, need feedback

Please don't post Bullet support questions here, use the above forums instead.
h4tt3n
Posts: 25
Joined: Wed Mar 12, 2008 9:08 am

Simple constraint force experiment, need feedback

Post by h4tt3n »

Hello all,

Trying to wrap my mind around the concept of rigid body constraints I've started out with finding a straight-forward solution to the simple "bead-on-a-circular-wire" problem:

For each program loop I simply find the point on the circle closest to the bead's actual position, and then I calculate backwards and find the exact force needed to make the bead move to that spot within one timestep, its current velocity taken into consideration.

since both bead and "rest-position" vectors are known, I can find the neccesary force:

dv = dx / dt
a = (dv - db) / dt
f = m * a

or simply

f = m * ( (dx / dt) - vb)/dt

where f = force, m = mass, a = acceleration, dv = the required velocity, dx = distance the bead needs to travel, db = bead velocity vector projected onto normalised distance vector.

(sample program + commented source attached)

The method seems incredibly stable, and the energy of the system doesn't change over time, so I assume no work is done by the constraint. I'd really appreciate some feedback on wether this method is a dead-end or wether it's any good in the bigger perspective, ie. can be generalized to constraint for instance a row of particles forming a rigid chain or similar bigger bodies of interconnected particles?

Please help a novice along!

Cheers,
Michael
You do not have the required permissions to view the files attached to this post.