Actually this is not correct in the general case and this is in my experience the reason people ususally have problems with prismatic joints. The linear constraints for a prismatic joint are:For 2-body constraints you only have one J ( actualy you have two, but J1 = -J2 )
C1 = (x2 - r2 - x1- r1) * u1
C2 = (x2 - r2 - x1- r1) * v1
Here u1 and v1 are mutually orthonormal axes to the slider axis. Now we build the time derivative and find the Jacobian by inspection (here I use C1):
dC1/dt = d/dt * (x2 - r2 - x1- r1) * u1 + (x2 - r2 - x1- r1) * du1/dt
The point is that the time-derivative of u1 doesn't vanish as it does for non-penetration constraints, so we get:
dC1/dt = (v2 - w2 x r2 - v1- w1 x r1) * u1 + (x2 - r2 - x1- r1) * (w1 x u1)
In this case the angular entries of J1 and J2 don't match anymore. Actually they also don't match for a simple spherical joint since r1 != r2 usually.
Cheers,
-Dirk