oh is was a simple change, the value is calculate for each row.
but is us to try to resolve penetration. and that's a big mistake.
- Code: Select all
//desc.m_zeroRowAcceleration[index] = (relPosit * desc.m_invTimestep + relVeloc) * desc.m_invTimestep;
desc.m_zeroRowAcceleration[index] = relVeloc * desc.m_invTimestep;
I change to only calculate the acceleration needed to stop the joint, disregarding the distance.
the is the responasobility of teh joint to do the distance is it desired too.
Thsi permit more flexibility.
1-It is not knows is the error is a constraint violation, so in most case that produce a huge acceleration,
2-even if the error is a constriction violation, is margin the penetration acceleration and teh velocity make difficult to use the value and no matte what tweak is use.
now the joint always knwo that the value is the acceleration that will stop teh joint dead. and can use that as start point to do calculations.
this allown for the joint to extrapolate the contact point a ray case.
basically is say base of teh velocity of the joint point, what fraction of the time step can the joint travel to hit the contact, and if the fraction is smaller that the time step, then
the joint can calculate a velocity that will move the joint to the stop.
teh thsi acceleration is added to the zeroAcceleration. and teh joint will move to a point that is, ideally the stop, in reality very close, but subsequence frame the same condition apply but that the velocity is close to stop.
yes you can do it the joint, it is just the difference between the velocity at teh contact points divided by the time step.
teh reason is in the SDK is because this calculation is different for angular and linear of other kind of joints. where in the SDK is just the position time the Jacobean.
I will apply the same to spring damper to complete that joint and use that as the model to build the others.