Problem with hinge constructor with only rbA's data as param

Kanttori
Posts: 38
Joined: Thu Jul 08, 2010 12:52 am

Problem with hinge constructor with only rbA's data as param

Post by Kanttori »

The m_rbBFrame in btHingeConstraint should be afaik set to be the worldspace equivalent of the rbAFrame transformation when there is no second rigidbody, but now it's set to be rbAFrame's localspace rotation with rbAFrame's worldspace origin.

from svn-r2243

Code: Select all

00154 btHingeConstraint::btHingeConstraint(btRigidBody& rbA, const btTransform& rbAFrame, bool useReferenceFrameA)
00155 :btTypedConstraint(HINGE_CONSTRAINT_TYPE, rbA),m_rbAFrame(rbAFrame),m_rbBFrame(rbAFrame),
00156 m_angularOnly(false),
00157 m_enableAngularMotor(false),
00158 m_useSolveConstraintObsolete(HINGE_USE_OBSOLETE_SOLVER),
00159 m_useOffsetForConstraintFrame(HINGE_USE_FRAME_OFFSET),
00160 m_useReferenceFrameA(useReferenceFrameA),
00161 m_flags(0)
00162 {
00164 
00165         m_rbBFrame.getOrigin() = m_rbA.getCenterOfMassTransform()(m_rbAFrame.getOrigin());
...
This omits the fact that rbA may have been rotated which ever way; the "target" for the constraint will not reflect this, but will be set to rbAFrame's rotation as if worldspace were it's localspace.

I think a simple fix to both rbA-only constructors is to set m_rbBFrame to rbAFrame's worldspace equivalent as in

Code: Select all

m_rbBFrame = rbA.getCenterOfMassTransform()*rbAFrame;
Should I make a bug-report of this with a patch or is there something I've misunderstood?