Fix in generic 6dof constraint, when springs/limits/motors are combined
Added btGeneric6DofConstraint::getRelativePivotPosition to read relative linear position of the constraint frame (pivot)
This commit is contained in:
@@ -22,9 +22,11 @@ http://gimpact.sf.net
|
||||
#include "btGeneric6DofConstraint.h"
|
||||
#include "BulletDynamics/Dynamics/btRigidBody.h"
|
||||
#include "LinearMath/btTransformUtil.h"
|
||||
#include "LinearMath/btTransformUtil.h"
|
||||
#include <new>
|
||||
|
||||
|
||||
|
||||
#define D6_USE_OBSOLETE_METHOD false
|
||||
|
||||
|
||||
@@ -661,10 +663,15 @@ btVector3 btGeneric6DofConstraint::getAxis(int axis_index) const
|
||||
}
|
||||
|
||||
|
||||
|
||||
btScalar btGeneric6DofConstraint::getAngle(int axis_index) const
|
||||
btScalar btGeneric6DofConstraint::getRelativePivotPosition(int axisIndex) const
|
||||
{
|
||||
return m_calculatedAxisAngleDiff[axis_index];
|
||||
return m_calculatedLinearDiff[axisIndex];
|
||||
}
|
||||
|
||||
|
||||
btScalar btGeneric6DofConstraint::getAngle(int axisIndex) const
|
||||
{
|
||||
return m_calculatedAxisAngleDiff[axisIndex];
|
||||
}
|
||||
|
||||
|
||||
@@ -724,7 +731,7 @@ int btGeneric6DofConstraint::get_limit_motor_info2(
|
||||
J2[srow+1] = -ax1[1];
|
||||
J2[srow+2] = -ax1[2];
|
||||
}
|
||||
if((!rotational) && limit)
|
||||
if((!rotational))
|
||||
{
|
||||
btVector3 ltd; // Linear Torque Decoupling vector
|
||||
btVector3 c = m_calculatedTransformB.getOrigin() - body0->getCenterOfMassPosition();
|
||||
@@ -749,6 +756,7 @@ int btGeneric6DofConstraint::get_limit_motor_info2(
|
||||
if(!limit)
|
||||
{
|
||||
btScalar tag_vel = rotational ? limot->m_targetVelocity : -limot->m_targetVelocity;
|
||||
|
||||
btScalar mot_fact = getMotorFactor( limot->m_currentPosition,
|
||||
limot->m_loLimit,
|
||||
limot->m_hiLimit,
|
||||
|
||||
@@ -382,14 +382,21 @@ public:
|
||||
|
||||
//! Get the relative Euler angle
|
||||
/*!
|
||||
\pre btGeneric6DofConstraint.buildJacobian must be called previously.
|
||||
\pre btGeneric6DofConstraint::calculateTransforms() must be called previously.
|
||||
*/
|
||||
btScalar getAngle(int axis_index) const;
|
||||
|
||||
//! Get the relative position of the constraint pivot
|
||||
/*!
|
||||
\pre btGeneric6DofConstraint::calculateTransforms() must be called previously.
|
||||
*/
|
||||
btScalar getRelativePivotPosition(int axis_index) const;
|
||||
|
||||
|
||||
//! Test angular limit.
|
||||
/*!
|
||||
Calculates angular correction and returns true if limit needs to be corrected.
|
||||
\pre btGeneric6DofConstraint.buildJacobian must be called previously.
|
||||
\pre btGeneric6DofConstraint::calculateTransforms() must be called previously.
|
||||
*/
|
||||
bool testAngularLimitMotor(int axis_index);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user