Changeset 2908 for code/branches/questsystem5/src/bullet/BulletDynamics/ConstraintSolver/btConeTwistConstraint.h
- Timestamp:
- Apr 8, 2009, 12:58:47 AM (16 years ago)
- Location:
- code/branches/questsystem5
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/questsystem5
- Property svn:mergeinfo changed
-
code/branches/questsystem5/src/bullet/BulletDynamics/ConstraintSolver/btConeTwistConstraint.h
r2907 r2908 43 43 btScalar m_relaxationFactor; 44 44 45 btScalar m_damping;46 47 45 btScalar m_swingSpan1; 48 46 btScalar m_swingSpan2; 49 47 btScalar m_twistSpan; 50 51 btScalar m_fixThresh;52 48 53 49 btVector3 m_swingAxis; … … 61 57 btScalar m_twistCorrection; 62 58 63 btScalar m_twistAngle;64 65 59 btScalar m_accSwingLimitImpulse; 66 60 btScalar m_accTwistLimitImpulse; … … 70 64 bool m_solveSwingLimit; 71 65 72 bool m_useSolveConstraintObsolete;73 74 // not yet used...75 btScalar m_swingLimitRatio;76 btScalar m_twistLimitRatio;77 btVector3 m_twistAxisA;78 79 // motor80 bool m_bMotorEnabled;81 bool m_bNormalizedMotorStrength;82 btQuaternion m_qTarget;83 btScalar m_maxMotorImpulse;84 btVector3 m_accMotorImpulse;85 66 86 67 public: … … 94 75 virtual void buildJacobian(); 95 76 96 virtual void getInfo1 (btConstraintInfo1* info); 97 98 virtual void getInfo2 (btConstraintInfo2* info); 99 100 101 virtual void solveConstraintObsolete(btSolverBody& bodyA,btSolverBody& bodyB,btScalar timeStep); 77 virtual void solveConstraint(btScalar timeStep); 102 78 103 79 void updateRHS(btScalar timeStep); … … 117 93 } 118 94 119 void setLimit(int limitIndex,btScalar limitValue) 120 { 121 switch (limitIndex) 122 { 123 case 3: 124 { 125 m_twistSpan = limitValue; 126 break; 127 } 128 case 4: 129 { 130 m_swingSpan2 = limitValue; 131 break; 132 } 133 case 5: 134 { 135 m_swingSpan1 = limitValue; 136 break; 137 } 138 default: 139 { 140 } 141 }; 142 } 143 144 void setLimit(btScalar _swingSpan1,btScalar _swingSpan2,btScalar _twistSpan, btScalar _softness = 1.f, btScalar _biasFactor = 0.3f, btScalar _relaxationFactor = 1.0f) 95 void setLimit(btScalar _swingSpan1,btScalar _swingSpan2,btScalar _twistSpan, btScalar _softness = 0.8f, btScalar _biasFactor = 0.3f, btScalar _relaxationFactor = 1.0f) 145 96 { 146 97 m_swingSpan1 = _swingSpan1; … … 171 122 } 172 123 173 void calcAngleInfo();174 void calcAngleInfo2();175 176 inline btScalar getSwingSpan1()177 {178 return m_swingSpan1;179 }180 inline btScalar getSwingSpan2()181 {182 return m_swingSpan2;183 }184 inline btScalar getTwistSpan()185 {186 return m_twistSpan;187 }188 inline btScalar getTwistAngle()189 {190 return m_twistAngle;191 }192 bool isPastSwingLimit() { return m_solveSwingLimit; }193 194 195 void setDamping(btScalar damping) { m_damping = damping; }196 197 void enableMotor(bool b) { m_bMotorEnabled = b; }198 void setMaxMotorImpulse(btScalar maxMotorImpulse) { m_maxMotorImpulse = maxMotorImpulse; m_bNormalizedMotorStrength = false; }199 void setMaxMotorImpulseNormalized(btScalar maxMotorImpulse) { m_maxMotorImpulse = maxMotorImpulse; m_bNormalizedMotorStrength = true; }200 201 btScalar getFixThresh() { return m_fixThresh; }202 void setFixThresh(btScalar fixThresh) { m_fixThresh = fixThresh; }203 204 // setMotorTarget:205 // q: the desired rotation of bodyA wrt bodyB.206 // note: if q violates the joint limits, the internal target is clamped to avoid conflicting impulses (very bad for stability)207 // note: don't forget to enableMotor()208 void setMotorTarget(const btQuaternion &q);209 210 // same as above, but q is the desired rotation of frameA wrt frameB in constraint space211 void setMotorTargetInConstraintSpace(const btQuaternion &q);212 213 btVector3 GetPointForAngle(btScalar fAngleInRadians, btScalar fLength) const;214 215 216 217 protected:218 void init();219 220 void computeConeLimitInfo(const btQuaternion& qCone, // in221 btScalar& swingAngle, btVector3& vSwingAxis, btScalar& swingLimit); // all outs222 223 void computeTwistLimitInfo(const btQuaternion& qTwist, // in224 btScalar& twistAngle, btVector3& vTwistAxis); // all outs225 226 void adjustSwingAxisToUseEllipseNormal(btVector3& vSwingAxis) const;227 124 }; 228 125
Note: See TracChangeset
for help on using the changeset viewer.