Changeset 2907 for code/branches/questsystem5/src/bullet/BulletDynamics/ConstraintSolver/btConeTwistConstraint.h
- Timestamp:
- Apr 8, 2009, 12:36:08 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
r2662 r2907 43 43 btScalar m_relaxationFactor; 44 44 45 btScalar m_damping; 46 45 47 btScalar m_swingSpan1; 46 48 btScalar m_swingSpan2; 47 49 btScalar m_twistSpan; 48 50 51 btScalar m_fixThresh; 52 49 53 btVector3 m_swingAxis; 50 54 btVector3 m_twistAxis; … … 57 61 btScalar m_twistCorrection; 58 62 63 btScalar m_twistAngle; 64 59 65 btScalar m_accSwingLimitImpulse; 60 66 btScalar m_accTwistLimitImpulse; … … 64 70 bool m_solveSwingLimit; 65 71 72 bool m_useSolveConstraintObsolete; 73 74 // not yet used... 75 btScalar m_swingLimitRatio; 76 btScalar m_twistLimitRatio; 77 btVector3 m_twistAxisA; 78 79 // motor 80 bool m_bMotorEnabled; 81 bool m_bNormalizedMotorStrength; 82 btQuaternion m_qTarget; 83 btScalar m_maxMotorImpulse; 84 btVector3 m_accMotorImpulse; 66 85 67 86 public: … … 75 94 virtual void buildJacobian(); 76 95 77 virtual void solveConstraint(btScalar timeStep); 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); 78 102 79 103 void updateRHS(btScalar timeStep); … … 93 117 } 94 118 95 void setLimit(btScalar _swingSpan1,btScalar _swingSpan2,btScalar _twistSpan, btScalar _softness = 0.8f, btScalar _biasFactor = 0.3f, btScalar _relaxationFactor = 1.0f) 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) 96 145 { 97 146 m_swingSpan1 = _swingSpan1; … … 122 171 } 123 172 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 space 211 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, // in 221 btScalar& swingAngle, btVector3& vSwingAxis, btScalar& swingLimit); // all outs 222 223 void computeTwistLimitInfo(const btQuaternion& qTwist, // in 224 btScalar& twistAngle, btVector3& vTwistAxis); // all outs 225 226 void adjustSwingAxisToUseEllipseNormal(btVector3& vSwingAxis) const; 124 227 }; 125 228
Note: See TracChangeset
for help on using the changeset viewer.