Differential D1739 Diff 5899 extern/bullet2/src/BulletDynamics/ConstraintSolver/btConeTwistConstraint.h
Changeset View
Changeset View
Standalone View
Standalone View
extern/bullet2/src/BulletDynamics/ConstraintSolver/btConeTwistConstraint.h
| Show First 20 Lines • Show All 164 Lines • ▼ Show 20 Lines | public: | ||||
| { | { | ||||
| return m_rbB; | return m_rbB; | ||||
| } | } | ||||
| void setAngularOnly(bool angularOnly) | void setAngularOnly(bool angularOnly) | ||||
| { | { | ||||
| m_angularOnly = angularOnly; | m_angularOnly = angularOnly; | ||||
| } | } | ||||
| bool getAngularOnly() const | |||||
| { | |||||
| return m_angularOnly; | |||||
| } | |||||
| void setLimit(int limitIndex,btScalar limitValue) | void setLimit(int limitIndex,btScalar limitValue) | ||||
| { | { | ||||
| switch (limitIndex) | switch (limitIndex) | ||||
| { | { | ||||
| case 3: | case 3: | ||||
| { | { | ||||
| m_twistSpan = limitValue; | m_twistSpan = limitValue; | ||||
| break; | break; | ||||
| Show All 9 Lines | case 5: | ||||
| break; | break; | ||||
| } | } | ||||
| default: | default: | ||||
| { | { | ||||
| } | } | ||||
| }; | }; | ||||
| } | } | ||||
| btScalar getLimit(int limitIndex) const | |||||
| { | |||||
| switch (limitIndex) | |||||
| { | |||||
| case 3: | |||||
| { | |||||
| return m_twistSpan; | |||||
| break; | |||||
| } | |||||
| case 4: | |||||
| { | |||||
| return m_swingSpan2; | |||||
| break; | |||||
| } | |||||
| case 5: | |||||
| { | |||||
| return m_swingSpan1; | |||||
| break; | |||||
| } | |||||
| default: | |||||
| { | |||||
| btAssert(0 && "Invalid limitIndex specified for btConeTwistConstraint"); | |||||
| return 0.0; | |||||
| } | |||||
| }; | |||||
| } | |||||
| // setLimit(), a few notes: | // setLimit(), a few notes: | ||||
| // _softness: | // _softness: | ||||
| // 0->1, recommend ~0.8->1. | // 0->1, recommend ~0.8->1. | ||||
| // describes % of limits where movement is free. | // describes % of limits where movement is free. | ||||
| // beyond this softness %, the limit is gradually enforced until the "hard" (1.0) limit is reached. | // beyond this softness %, the limit is gradually enforced until the "hard" (1.0) limit is reached. | ||||
| // _biasFactor: | // _biasFactor: | ||||
| // 0->1?, recommend 0.3 +/-0.3 or so. | // 0->1?, recommend 0.3 +/-0.3 or so. | ||||
| // strength with which constraint resists zeroth order (angular, not angular velocity) limit violation. | // strength with which constraint resists zeroth order (angular, not angular velocity) limit violation. | ||||
| // __relaxationFactor: | // __relaxationFactor: | ||||
| // 0->1, recommend to stay near 1. | // 0->1, recommend to stay near 1. | ||||
| // the lower the value, the less the constraint will fight velocities which violate the angular limits. | // the lower the value, the less the constraint will fight velocities which violate the angular limits. | ||||
| void setLimit(btScalar _swingSpan1,btScalar _swingSpan2,btScalar _twistSpan, btScalar _softness = 1.f, btScalar _biasFactor = 0.3f, btScalar _relaxationFactor = 1.0f) | void setLimit(btScalar _swingSpan1,btScalar _swingSpan2,btScalar _twistSpan, btScalar _softness = 1.f, btScalar _biasFactor = 0.3f, btScalar _relaxationFactor = 1.0f) | ||||
| { | { | ||||
| m_swingSpan1 = _swingSpan1; | m_swingSpan1 = _swingSpan1; | ||||
| m_swingSpan2 = _swingSpan2; | m_swingSpan2 = _swingSpan2; | ||||
| m_twistSpan = _twistSpan; | m_twistSpan = _twistSpan; | ||||
| m_limitSoftness = _softness; | m_limitSoftness = _softness; | ||||
| m_biasFactor = _biasFactor; | m_biasFactor = _biasFactor; | ||||
| m_relaxationFactor = _relaxationFactor; | m_relaxationFactor = _relaxationFactor; | ||||
| } | } | ||||
| const btTransform& getAFrame() { return m_rbAFrame; }; | const btTransform& getAFrame() const { return m_rbAFrame; }; | ||||
| const btTransform& getBFrame() { return m_rbBFrame; }; | const btTransform& getBFrame() const { return m_rbBFrame; }; | ||||
| inline int getSolveTwistLimit() | inline int getSolveTwistLimit() | ||||
| { | { | ||||
| return m_solveTwistLimit; | return m_solveTwistLimit; | ||||
| } | } | ||||
| inline int getSolveSwingLimit() | inline int getSolveSwingLimit() | ||||
| { | { | ||||
| return m_solveTwistLimit; | return m_solveTwistLimit; | ||||
| } | } | ||||
| inline btScalar getTwistLimitSign() | inline btScalar getTwistLimitSign() | ||||
| { | { | ||||
| return m_twistLimitSign; | return m_twistLimitSign; | ||||
| } | } | ||||
| void calcAngleInfo(); | void calcAngleInfo(); | ||||
| void calcAngleInfo2(const btTransform& transA, const btTransform& transB,const btMatrix3x3& invInertiaWorldA,const btMatrix3x3& invInertiaWorldB); | void calcAngleInfo2(const btTransform& transA, const btTransform& transB,const btMatrix3x3& invInertiaWorldA,const btMatrix3x3& invInertiaWorldB); | ||||
| inline btScalar getSwingSpan1() | inline btScalar getSwingSpan1() const | ||||
| { | { | ||||
| return m_swingSpan1; | return m_swingSpan1; | ||||
| } | } | ||||
| inline btScalar getSwingSpan2() | inline btScalar getSwingSpan2() const | ||||
| { | { | ||||
| return m_swingSpan2; | return m_swingSpan2; | ||||
| } | } | ||||
| inline btScalar getTwistSpan() | inline btScalar getTwistSpan() const | ||||
| { | { | ||||
| return m_twistSpan; | return m_twistSpan; | ||||
| } | } | ||||
| inline btScalar getTwistAngle() | inline btScalar getLimitSoftness() const | ||||
| { | |||||
| return m_limitSoftness; | |||||
| } | |||||
| inline btScalar getBiasFactor() const | |||||
| { | |||||
| return m_biasFactor; | |||||
| } | |||||
| inline btScalar getRelaxationFactor() const | |||||
| { | |||||
| return m_relaxationFactor; | |||||
| } | |||||
| inline btScalar getTwistAngle() const | |||||
| { | { | ||||
| return m_twistAngle; | return m_twistAngle; | ||||
| } | } | ||||
| bool isPastSwingLimit() { return m_solveSwingLimit; } | bool isPastSwingLimit() { return m_solveSwingLimit; } | ||||
| btScalar getDamping() const { return m_damping; } | |||||
| void setDamping(btScalar damping) { m_damping = damping; } | void setDamping(btScalar damping) { m_damping = damping; } | ||||
| void enableMotor(bool b) { m_bMotorEnabled = b; } | void enableMotor(bool b) { m_bMotorEnabled = b; } | ||||
| bool isMotorEnabled() const { return m_bMotorEnabled; } | |||||
| btScalar getMaxMotorImpulse() const { return m_maxMotorImpulse; } | |||||
| bool isMaxMotorImpulseNormalized() const { return m_bNormalizedMotorStrength; } | |||||
| void setMaxMotorImpulse(btScalar maxMotorImpulse) { m_maxMotorImpulse = maxMotorImpulse; m_bNormalizedMotorStrength = false; } | void setMaxMotorImpulse(btScalar maxMotorImpulse) { m_maxMotorImpulse = maxMotorImpulse; m_bNormalizedMotorStrength = false; } | ||||
| void setMaxMotorImpulseNormalized(btScalar maxMotorImpulse) { m_maxMotorImpulse = maxMotorImpulse; m_bNormalizedMotorStrength = true; } | void setMaxMotorImpulseNormalized(btScalar maxMotorImpulse) { m_maxMotorImpulse = maxMotorImpulse; m_bNormalizedMotorStrength = true; } | ||||
| btScalar getFixThresh() { return m_fixThresh; } | btScalar getFixThresh() { return m_fixThresh; } | ||||
| void setFixThresh(btScalar fixThresh) { m_fixThresh = fixThresh; } | void setFixThresh(btScalar fixThresh) { m_fixThresh = fixThresh; } | ||||
| // setMotorTarget: | // setMotorTarget: | ||||
| // q: the desired rotation of bodyA wrt bodyB. | // q: the desired rotation of bodyA wrt bodyB. | ||||
| // note: if q violates the joint limits, the internal target is clamped to avoid conflicting impulses (very bad for stability) | // note: if q violates the joint limits, the internal target is clamped to avoid conflicting impulses (very bad for stability) | ||||
| // note: don't forget to enableMotor() | // note: don't forget to enableMotor() | ||||
| void setMotorTarget(const btQuaternion &q); | void setMotorTarget(const btQuaternion &q); | ||||
| const btQuaternion& getMotorTarget() const { return m_qTarget; } | |||||
| // same as above, but q is the desired rotation of frameA wrt frameB in constraint space | // same as above, but q is the desired rotation of frameA wrt frameB in constraint space | ||||
| void setMotorTargetInConstraintSpace(const btQuaternion &q); | void setMotorTargetInConstraintSpace(const btQuaternion &q); | ||||
| btVector3 GetPointForAngle(btScalar fAngleInRadians, btScalar fLength) const; | btVector3 GetPointForAngle(btScalar fAngleInRadians, btScalar fLength) const; | ||||
| ///override the default global value of a parameter (such as ERP or CFM), optionally provide the axis (0..5). | ///override the default global value of a parameter (such as ERP or CFM), optionally provide the axis (0..5). | ||||
| ///If no axis is provided, it uses the default axis for this constraint. | ///If no axis is provided, it uses the default axis for this constraint. | ||||
| Show All 10 Lines | public: | ||||
| { | { | ||||
| return m_rbBFrame; | return m_rbBFrame; | ||||
| } | } | ||||
| ///return the local value of parameter | ///return the local value of parameter | ||||
| virtual btScalar getParam(int num, int axis = -1) const; | virtual btScalar getParam(int num, int axis = -1) const; | ||||
| int getFlags() const | |||||
| { | |||||
| return m_flags; | |||||
| } | |||||
| virtual int calculateSerializeBufferSize() const; | virtual int calculateSerializeBufferSize() const; | ||||
| ///fills the dataBuffer and returns the struct name (and 0 on failure) | ///fills the dataBuffer and returns the struct name (and 0 on failure) | ||||
| virtual const char* serialize(void* dataBuffer, btSerializer* serializer) const; | virtual const char* serialize(void* dataBuffer, btSerializer* serializer) const; | ||||
| }; | }; | ||||
| ▲ Show 20 Lines • Show All 74 Lines • Show Last 20 Lines | |||||