Page 1 of 1

Revolute joint between two particles

Posted: Wed Feb 06, 2013 11:12 pm
by c0der
Hi,

I am having trouble with implementing a revolute joint between two particles. I am representing the particle as having a position, velocity and acceleration and no angular dynamic components.

So the constraint derivation is as follows:

C = xa + ra - xb - rb
CDot = va - vb

CDot = [ 1 -1] [va vb]T

So the Jacobian is [1 -1]

I initially store the anchor in local coords of each particle

localA = worldAnchor - particleA.position
localB = worldAnchor - particleB.position

Since the particles do not rotate, they have an identity matrix at all times with translation components on their last row

[ 1 0 0 0 ]
[ 0 1 0 0 ]
[ 0 0 1 0 ]
[ tx ty tz 1 ]

So transferring the anchor points to world coords, I do the following:

worldAnchor1 = localA + m_pParticleA->position
worldAnchor2 = localB + m_pParticleB->position

Then the radii between the anchors and the bodies becomes:

ra = worldAnchor1 - m_pParticleA->position
rb = worldAnchor2 - m_pParticleB->position

This undoes the previous addition and returns world anchors to local anchors. How do I go about doing this properly?