missing init for btSolverConstraint relpos1CrossNormal

Post Reply
maletinkert9n
Posts: 2
Joined: Wed Feb 18, 2015 1:17 pm

missing init for btSolverConstraint relpos1CrossNormal

Post by maletinkert9n »

The field m_relpos1CrossNormal of btSolverConstraint does not seem to get initialised. There are only a few places in the code where it is assigned to. I found all of these by grepping the bullet root dir for "m_relpos1CrossNormal". By adding printfs I found that none of these is actually being called.

Is there some alternative mechanism for initializing m_relpos1CrossNormal, maybe by accessing the btSolverConstraint struct by pointer dereference?
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA
Contact:

Re: missing init for btSolverConstraint relpos1CrossNormal

Post by Erwin Coumans »

For contact and contact friction constraints, it just gets assigned in btSequentialImpulseConstraintSolver.cpp (see for example line #L556).

For non-contact constraints, it gets assigned in the 'getInfo2' virtual method of the particular btTypedConstraint derived class, through the info2.m_J1angularAxis pointer, which points to m_relpos1CrossNormal.

Code: Select all

					info2.m_J1linearAxis = currentConstraintRow->m_contactNormal1;
					info2.m_J1angularAxis = currentConstraintRow->m_relpos1CrossNormal;
					info2.m_J2linearAxis = currentConstraintRow->m_contactNormal2;
					info2.m_J2angularAxis = currentConstraintRow->m_relpos2CrossNormal;
					info2.rowskip = sizeof(btSolverConstraint)/sizeof(btScalar);//check this
					///the size of btSolverConstraint needs be a multiple of btScalar
		            btAssert(info2.rowskip*sizeof(btScalar)== sizeof(btSolverConstraint));
					info2.m_constraintError = &currentConstraintRow->m_rhs;
					currentConstraintRow->m_cfm = infoGlobal.m_globalCfm;
					info2.m_damping = infoGlobal.m_damping;
					info2.cfm = &currentConstraintRow->m_cfm;
					info2.m_lowerLimit = &currentConstraintRow->m_lowerLimit;
					info2.m_upperLimit = &currentConstraintRow->m_upperLimit;
					info2.m_numIterations = infoGlobal.m_numIterations;
					constraints[i]->getInfo2(&info2);
Hope this helps,
Erwin
Post Reply