- Timestamp:
- Mar 31, 2009, 8:05:51 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/bullet/BulletDynamics/ConstraintSolver/btGeneric6DofConstraint.h
r2662 r2882 29 29 30 30 class btRigidBody; 31 32 31 33 32 34 … … 93 95 bool isLimited() 94 96 { 95 if(m_loLimit >=m_hiLimit) return false;97 if(m_loLimit > m_hiLimit) return false; 96 98 return true; 97 99 } … … 111 113 112 114 //! apply the correction impulses for two bodies 113 btScalar solveAngularLimits(btScalar timeStep,btVector3& axis, btScalar jacDiagABInv,btRigidBody * body0, btRigidBody * body1); 114 115 btScalar solveAngularLimits(btScalar timeStep,btVector3& axis, btScalar jacDiagABInv,btRigidBody * body0, btSolverBody& bodyA,btRigidBody * body1,btSolverBody& bodyB); 115 116 116 117 }; … … 130 131 btScalar m_restitution;//! Bounce parameter for linear limit 131 132 //!@} 133 bool m_enableMotor[3]; 134 btVector3 m_targetVelocity;//!< target motor velocity 135 btVector3 m_maxMotorForce;//!< max force on motor 136 btVector3 m_currentLimitError;//! How much is violated this limit 137 int m_currentLimit[3];//!< 0=free, 1=at lower limit, 2=at upper limit 132 138 133 139 btTranslationalLimitMotor() … … 140 146 m_damping = btScalar(1.0f); 141 147 m_restitution = btScalar(0.5f); 148 for(int i=0; i < 3; i++) 149 { 150 m_enableMotor[i] = false; 151 m_targetVelocity[i] = btScalar(0.f); 152 m_maxMotorForce[i] = btScalar(0.f); 153 } 142 154 } 143 155 … … 151 163 m_damping = other.m_damping; 152 164 m_restitution = other.m_restitution; 165 for(int i=0; i < 3; i++) 166 { 167 m_enableMotor[i] = other.m_enableMotor[i]; 168 m_targetVelocity[i] = other.m_targetVelocity[i]; 169 m_maxMotorForce[i] = other.m_maxMotorForce[i]; 170 } 153 171 } 154 172 … … 164 182 return (m_upperLimit[limitIndex] >= m_lowerLimit[limitIndex]); 165 183 } 184 inline bool needApplyForce(int limitIndex) 185 { 186 if(m_currentLimit[limitIndex] == 0 && m_enableMotor[limitIndex] == false) return false; 187 return true; 188 } 189 int testLimitValue(int limitIndex, btScalar test_value); 166 190 167 191 … … 169 193 btScalar timeStep, 170 194 btScalar jacDiagABInv, 171 btRigidBody& body1, const btVector3 &pointInA,172 btRigidBody& body2, const btVector3 &pointInB,195 btRigidBody& body1,btSolverBody& bodyA,const btVector3 &pointInA, 196 btRigidBody& body2,btSolverBody& bodyB,const btVector3 &pointInB, 173 197 int limit_index, 174 198 const btVector3 & axis_normal_on_a, … … 248 272 btVector3 m_calculatedAxisAngleDiff; 249 273 btVector3 m_calculatedAxis[3]; 274 btVector3 m_calculatedLinearDiff; 250 275 251 276 btVector3 m_AnchorPos; // point betwen pivots of bodies A and B to solve linear axes … … 263 288 264 289 290 int setAngularLimits(btConstraintInfo2 *info, int row_offset); 291 292 int setLinearLimits(btConstraintInfo2 *info); 265 293 266 294 void buildLinearJacobian( … … 270 298 void buildAngularJacobian(btJacobianEntry & jacAngular,const btVector3 & jointAxisW); 271 299 300 // tests linear limits 301 void calculateLinearInfo(); 272 302 273 303 //! calcs the euler angles between the two bodies. … … 277 307 278 308 public: 309 310 ///for backwards compatibility during the transition to 'getInfo/getInfo2' 311 bool m_useSolveConstraintObsolete; 312 279 313 btGeneric6DofConstraint(btRigidBody& rbA, btRigidBody& rbB, const btTransform& frameInA, const btTransform& frameInB ,bool useLinearReferenceFrameA); 280 314 … … 331 365 virtual void buildJacobian(); 332 366 333 virtual void solveConstraint(btScalar timeStep); 367 virtual void getInfo1 (btConstraintInfo1* info); 368 369 virtual void getInfo2 (btConstraintInfo2* info); 370 371 virtual void solveConstraintObsolete(btSolverBody& bodyA,btSolverBody& bodyB,btScalar timeStep); 334 372 335 373 void updateRHS(btScalar timeStep); … … 433 471 virtual void calcAnchorPos(void); // overridable 434 472 473 int get_limit_motor_info2( btRotationalLimitMotor * limot, 474 btRigidBody * body0, btRigidBody * body1, 475 btConstraintInfo2 *info, int row, btVector3& ax1, int rotational); 476 477 435 478 }; 436 479
Note: See TracChangeset
for help on using the changeset viewer.