Bug in constructor btHingeConstraint(body, pivot, axis) fixed. Build under MSVC 7.1 fixed

This commit is contained in:
rponom
2008-09-19 21:10:01 +00:00
parent 6a21ee6146
commit 486b172f58
2 changed files with 5 additions and 10 deletions

View File

@@ -61,7 +61,8 @@ subject to the following restrictions:
// Specific methods implementation // Specific methods implementation
#ifdef WIN32 //SSE gives errors on a MSVC 7.1
#if (defined (WIN32) && (_MSC_VER) && _MSC_VER >= 1400)
#define DBVT_SELECT_IMPL DBVT_IMPL_SSE #define DBVT_SELECT_IMPL DBVT_IMPL_SSE
#define DBVT_MERGE_IMPL DBVT_IMPL_SSE #define DBVT_MERGE_IMPL DBVT_IMPL_SSE
#define DBVT_INT0_IMPL DBVT_IMPL_SSE #define DBVT_INT0_IMPL DBVT_IMPL_SSE

View File

@@ -75,27 +75,21 @@ btHingeConstraint::btHingeConstraint(btRigidBody& rbA,btRigidBody& rbB, const bt
} }
btHingeConstraint::btHingeConstraint(btRigidBody& rbA,const btVector3& pivotInA,btVector3& axisInA) btHingeConstraint::btHingeConstraint(btRigidBody& rbA,const btVector3& pivotInA,btVector3& axisInA)
:btTypedConstraint(HINGE_CONSTRAINT_TYPE, rbA), m_angularOnly(false), m_enableAngularMotor(false) :btTypedConstraint(HINGE_CONSTRAINT_TYPE, rbA), m_angularOnly(false), m_enableAngularMotor(false)
{ {
// since no frame is given, assume this to be zero angle and just pick rb transform axis // since no frame is given, assume this to be zero angle and just pick rb transform axis
// fixed axis in worldspace // fixed axis in worldspace
btVector3 rbAxisA1 = rbA.getCenterOfMassTransform().getBasis().getColumn(0); btVector3 rbAxisA1, rbAxisA2;
btScalar projection = rbAxisA1.dot(axisInA); btPlaneSpace1(axisInA, rbAxisA1, rbAxisA2);
if (projection > SIMD_EPSILON)
rbAxisA1 = rbAxisA1*projection - axisInA;
else
rbAxisA1 = rbA.getCenterOfMassTransform().getBasis().getColumn(1);
btVector3 rbAxisA2 = axisInA.cross(rbAxisA1);
m_rbAFrame.getOrigin() = pivotInA; m_rbAFrame.getOrigin() = pivotInA;
m_rbAFrame.getBasis().setValue( rbAxisA1.getX(),rbAxisA2.getX(),axisInA.getX(), m_rbAFrame.getBasis().setValue( rbAxisA1.getX(),rbAxisA2.getX(),axisInA.getX(),
rbAxisA1.getY(),rbAxisA2.getY(),axisInA.getY(), rbAxisA1.getY(),rbAxisA2.getY(),axisInA.getY(),
rbAxisA1.getZ(),rbAxisA2.getZ(),axisInA.getZ() ); rbAxisA1.getZ(),rbAxisA2.getZ(),axisInA.getZ() );
btVector3 axisInB = rbA.getCenterOfMassTransform().getBasis() * -axisInA; btVector3 axisInB = rbA.getCenterOfMassTransform().getBasis() * -axisInA;
btQuaternion rotationArc = shortestArcQuat(axisInA,axisInB); btQuaternion rotationArc = shortestArcQuat(axisInA,axisInB);