Esharc wrote:Also we have a custom rope joint that uses the NewtonUserJointAddGeneralRow function from Newton 3.14, but I see that it is not in 4. Will you be able to add a AddGeneralRowJacobian function to the joints please.
on thatquestion, I did not provide a clear answer.
But is quite easy to set general row with newton 4.0
this is because the c++ interface facilitates exposing all the core functionality, so it does not need that many functions.
there are few examples, you can use as templates to copy from.
the simpler one I can thon off is the ndJointPulley
- Code: Select all
void ndJointPulley::JacobianDerivative(ndConstraintDescritor& desc)
{
ndMatrix matrix0;
ndMatrix matrix1;
// calculate the position of the pivot point and the Jacobian direction vectors, in global space.
CalculateGlobalMatrix(matrix0, matrix1);
AddAngularRowJacobian(desc, matrix0.m_front, ndFloat32(0.0f));
ndJacobian& jacobian0 = desc.m_jacobian[desc.m_rowsCount - 1].m_jacobianM0;
ndJacobian& jacobian1 = desc.m_jacobian[desc.m_rowsCount - 1].m_jacobianM1;
jacobian0.m_linear = matrix0.m_front.Scale(m_gearRatio);
jacobian1.m_linear = matrix1.m_front;
const ndVector& veloc0 = m_body0->GetVelocity();
const ndVector& veloc1 = m_body1->GetVelocity();
const ndVector relVeloc(veloc0 * jacobian0.m_linear + veloc1 * jacobian1.m_linear);
const ndFloat32 w = relVeloc.AddHorizontal().GetScalar() * ndFloat32(0.5f);
SetMotorAcceleration(desc, -w * desc.m_invTimestep);
}
basically, you add a linear of angular row, does matter, the you get the reference to the jacobians from the descriptor, and you override them.
there are many examples if you just do a global search for desc.m_jacobian you will find them all.
you just subclass you joint from ndJointBilateralConstraint and you implement you JacobianDerivative and that should do the trick, let me know if you still have problems.
also do not forget to sync, I finally found that moronic bug that was hunting me for month.