dCustomHingeActuator::dCustomHingeActuator(const dMatrix& pinAndPivotFrame, dFloat angularRate, dFloat minAngle, dFloat maxAngle, NewtonBody* const child, NewtonBody* const parent)
	:dCustomHinge (pinAndPivotFrame, child, parent)
	,m_angle(0.0f)
	,m_minAngle(minAngle)
	,m_maxAngle(maxAngle)
	,m_angularRate(angularRate)
    ,m_maxForce(1.0e20f)
{
	m_actuatorFlag = true;
	EnableLimits(false);
}
dCustomHingeActuator::dCustomHingeActuator(const dMatrix& pinAndPivotFrame, NewtonBody* const child, NewtonBody* const parent)
	:dCustomHinge (pinAndPivotFrame, child, parent)
	,m_angle(0.0f)
	,m_minAngle(-D_CUSTOM_LARGE_VALUE)
	,m_maxAngle( D_CUSTOM_LARGE_VALUE)
	,m_angularRate(0.0f)
	,m_maxForce(1.0e20f)
{
	m_actuatorFlag = false;
	EnableLimits(false);
}
dAnimationRigHinge::dAnimationRigHinge(const dMatrix& basicMatrix, dAnimationRigJoint* const parent, NewtonBody* const body)
	:dAnimationRigLimb(parent, body)
	,dCustomHinge (basicMatrix, body, parent->GetNewtonBody())
	,m_rowAccel(0.0f)
{

	dMatrix boneAligmentMatrix(
		dVector( 0.0f, 1.0f, 0.0f, 0.0f),
		dVector( 0.0f, 0.0f, 1.0f, 0.0f),
		dVector( 1.0f, 0.0f, 0.0f, 0.0f),
		dVector( 0.0f, 0.0f, 0.0f, 1.0f));
	dMatrix matrix (boneAligmentMatrix * basicMatrix);
	CalculateLocalMatrix(matrix, m_localMatrix0, m_localMatrix1);

	EnableLimits(true);
}