|
Bullet Collision Detection & Physics Library
|
Go to the documentation of this file.
27 #define HINGE_USE_OBSOLETE_SOLVER false
29 #define HINGE_USE_FRAME_OFFSET true
44 m_enableAngularMotor(false),
47 m_useReferenceFrameA(useReferenceFrameA),
68 rbAxisA2 = axisInA.
cross(rbAxisA1);
69 rbAxisA1 = rbAxisA2.
cross(axisInA);
85 #ifndef _BT_USE_CENTER_LIMIT_
90 m_relaxationFactor = 1.0f;
91 m_limitSoftness = 0.9f;
104 m_angularOnly(false), m_enableAngularMotor(false),
107 m_useReferenceFrameA(useReferenceFrameA),
137 #ifndef _BT_USE_CENTER_LIMIT_
142 m_relaxationFactor = 1.0f;
143 m_limitSoftness = 0.9f;
144 m_solveLimit =
false;
157 m_angularOnly(false),
158 m_enableAngularMotor(false),
161 m_useReferenceFrameA(useReferenceFrameA),
168 #ifndef _BT_USE_CENTER_LIMIT_
173 m_relaxationFactor = 1.0f;
174 m_limitSoftness = 0.9f;
175 m_solveLimit =
false;
187 m_angularOnly(false),
188 m_enableAngularMotor(false),
191 m_useReferenceFrameA(useReferenceFrameA),
201 #ifndef _BT_USE_CENTER_LIMIT_
206 m_relaxationFactor = 1.0f;
207 m_limitSoftness = 0.9f;
208 m_solveLimit =
false;
226 btVector3 relPos = pivotBInW - pivotAInW;
240 for (
int i=0;i<3;i++)
326 return accAngle + result;
489 for(i = 0; i < 3; i++)
550 #ifdef _BT_USE_CENTER_LIMIT_
555 limit = (limit_err >
btScalar(0.0)) ? 1 : 2;
574 if(limit && (lostop == histop))
593 k = info->
fps * currERP;
616 #ifdef _BT_USE_CENTER_LIMIT_
619 btScalar bounce = m_relaxationFactor;
624 vel -= angVelB.
dot(ax1);
643 if(newc < info->m_constraintError[srow])
650 #ifdef _BT_USE_CENTER_LIMIT_
698 #ifdef _BT_USE_CENTER_LIMIT_
703 m_solveLimit =
false;
704 if (m_lowerLimit <= m_upperLimit)
746 if (qHinge.
getZ() < 0)
747 targetAngle = -targetAngle;
754 #ifdef _BT_USE_CENTER_LIMIT_
757 if (m_lowerLimit < m_upperLimit)
759 if (targetAngle < m_lowerLimit)
760 targetAngle = m_lowerLimit;
761 else if (targetAngle > m_upperLimit)
762 targetAngle = m_upperLimit;
767 btScalar dAngle = targetAngle - curAngle;
805 btVector3 ax1 = ax1A * factA + ax1B * factB;
828 relA = orthoA + totalDist * factA;
829 relB = orthoB - totalDist * factB;
831 p = orthoB * factA + orthoA * factB;
844 tmpA = relA.
cross(p);
845 tmpB = relB.
cross(p);
848 tmpA = relA.
cross(q);
849 tmpB = relB.
cross(q);
858 tmpA = relA.
cross(ax1);
859 tmpB = relB.
cross(ax1);
886 rhs = k * q.
dot(ofs);
888 rhs = k * ax1.
dot(ofs);
928 k = info->
fps * normalErp;
941 #ifdef _BT_USE_CENTER_LIMIT_
946 limit = (limit_err >
btScalar(0.0)) ? 1 : 2;
965 if(limit && (lostop == histop))
984 k = info->
fps * currERP;
1007 #ifdef _BT_USE_CENTER_LIMIT_
1010 btScalar bounce = m_relaxationFactor;
1015 vel -= angVelB.
dot(ax1);
1034 if(newc < info->m_constraintError[srow])
1041 #ifdef _BT_USE_CENTER_LIMIT_
1055 if((axis == -1) || (axis == 5))
1089 if((axis == -1) || (axis == 5))
TypedConstraint is the baseclass for Bullet constraints and vehicles.
The btRigidBody is the main class for rigid body objects.
void test(const btScalar angle)
Checks conastaint angle against limit.
btScalar getLowerLimit() const
#define btAssertConstrParams(_par)
void testLimit(const btTransform &transA, const btTransform &transB)
void btPlaneSpace1(const T &n, T &p, T &q)
virtual void getInfo1(btConstraintInfo1 *info)
internal method used by the constraint solver, don't use them directly
void getInfo2Internal(btConstraintInfo2 *info, const btTransform &transA, const btTransform &transB, const btVector3 &angVelA, const btVector3 &angVelB)
The btQuaternion implements quaternion to perform linear algebra rotations in combination with btMatr...
virtual void getInfo1(btConstraintInfo1 *info)
internal method used by the constraint solver, don't use them directly
btScalar getAngle() const
Return the angle [0, 2Pi] of rotation represented by this quaternion.
void setValue(const btScalar &_x, const btScalar &_y, const btScalar &_z)
const btVector3 & getAngularVelocity() const
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
static btVector3 vHinge(0, 0, btScalar(1))
static btScalar btShortestAngularDistance(btScalar accAngle, btScalar curAngle)
Jacobian entry is an abstraction that allows to describe constraints it can be used in combination wi...
btScalar getCorrection() const
Returns correction value evaluated when test() was invoked.
btVector3 cross(const btVector3 &v) const
Return the cross product between this and another vector.
btQuaternion inverse() const
Return the inverse of this quaternion.
btScalar * m_J2angularAxis
virtual void setParam(int num, btScalar value, int axis=-1)
override the default global value of a parameter (such as ERP or CFM), optionally provide the axis (0...
btScalar dot(const btVector3 &v) const
Return the dot product.
const btRigidBody & getRigidBodyB() const
btScalar m_motorTargetVelocity
btScalar m_accMotorImpulse
btScalar getRelaxationFactor() const
Returns limit's relaxation factor.
btScalar * m_J2linearAxis
@ BT_HINGE_FLAGS_ERP_STOP
#define HINGE_USE_OBSOLETE_SOLVER
btQuaternion & normalize()
Normalize the quaternion Such that x^2 + y^2 + z^2 +w^2 = 1.
const btTransform & getCenterOfMassTransform() const
btScalar getBiasFactor() const
Returns limit's bias factor.
bool m_useSolveConstraintObsolete
const btScalar & getX() const
Return the x value.
#define HINGE_USE_FRAME_OFFSET
const btVector3 & getInvInertiaDiagLocal() const
static btScalar btShortestAngleUpdate(btScalar accAngle, btScalar curAngle)
btScalar m_accumulatedAngle
btScalar btFabs(btScalar x)
btQuaternion shortestArcQuat(const btVector3 &v0, const btVector3 &v1)
void updateRHS(btScalar timeStep)
@ BT_HINGE_FLAGS_CFM_STOP
btScalar btNormalizeAngle(btScalar angleInRadians)
btScalar * m_constraintError
btMatrix3x3 transpose() const
Return the transpose of the matrix.
btScalar getInvMass() const
btVector3 getColumn(int i) const
Get a column of the matrix as a vector.
static btScalar btNormalizeAnglePositive(btScalar angle)
btVector3 can be used to represent 3D points and vectors.
void fit(btScalar &angle) const
Checks given angle against limit.
void getInfo2NonVirtual(btConstraintInfo2 *info, const btTransform &transA, const btTransform &transB, const btVector3 &angVelA, const btVector3 &angVelB)
btScalar m_accLimitImpulse
btJacobianEntry m_jacAng[3]
void getInfo2InternalUsingFrameOffset(btConstraintInfo2 *info, const btTransform &transA, const btTransform &transB, const btVector3 &angVelA, const btVector3 &angVelB)
btScalar m_appliedImpulse
const btScalar & getZ() const
Return the z value.
const btScalar & getY() const
Return the y value.
void setMotorTarget(const btQuaternion &qAinB, btScalar dt)
@ BT_HINGE_FLAGS_ERP_NORM
const btScalar & getZ() const
Return the z value.
void setValue(const btScalar &xx, const btScalar &xy, const btScalar &xz, const btScalar &yx, const btScalar &yy, const btScalar &yz, const btScalar &zx, const btScalar &zy, const btScalar &zz)
Set the values of the matrix explicitly (row major)
btScalar m_maxMotorImpulse
bool m_useOffsetForConstraintFrame
void getInfo1NonVirtual(btConstraintInfo1 *info)
btScalar getAccumulatedHingeAngle()
bool m_useReferenceFrameA
bool getEnableAngularMotor()
virtual void buildJacobian()
internal method used by the constraint solver, don't use them directly
const btRigidBody & getRigidBodyA() const
@ BT_HINGE_FLAGS_CFM_NORM
void setAccumulatedHingeAngle(btScalar accAngle)
btHingeConstraint(btRigidBody &rbA, btRigidBody &rbB, const btVector3 &pivotInA, const btVector3 &pivotInB, const btVector3 &axisInA, const btVector3 &axisInB, bool useReferenceFrameA=false)
btScalar btAdjustAngleToLimits(btScalar angleInRadians, btScalar angleLowerLimitInRadians, btScalar angleUpperLimitInRadians)
virtual void getInfo2(btConstraintInfo2 *info)
internal method used by the constraint solver, don't use them directly
btScalar getHingeAngle()
The getHingeAngle gives the hinge angle in range [-PI,PI].
const btVector3 & getCenterOfMassPosition() const
btScalar btAtan2(btScalar x, btScalar y)
btScalar getMotorFactor(btScalar pos, btScalar lowLim, btScalar uppLim, btScalar vel, btScalar timeFact)
internal method used by the constraint solver, don't use them directly
btScalar * m_J1angularAxis
void getSkewSymmetricMatrix(btVector3 *v0, btVector3 *v1, btVector3 *v2) const
virtual btScalar getParam(int num, int axis=-1) const
return the local value of parameter
btScalar btSqrt(btScalar y)
btVector3 & normalize()
Normalize this vector x^2 + y^2 + z^2 = 1.
btVector3 normalized() const
Return a normalized version of this vector.
btScalar * m_J1linearAxis
btScalar btFmod(btScalar x, btScalar y)
#define _BT_USE_CENTER_LIMIT_
btScalar computeAngularImpulseDenominator(const btVector3 &axis) const
void setFrames(const btTransform &frameA, const btTransform &frameB)
btScalar length2() const
Return the length of the vector squared.
btVector3 quatRotate(const btQuaternion &rotation, const btVector3 &v)
btScalar getUpperLimit() const