Changeset 8393 for code/trunk/src/external/bullet/BulletDynamics
- Timestamp:
- May 3, 2011, 5:07:42 AM (14 years ago)
- Location:
- code/trunk/src/external/bullet/BulletDynamics
- Files:
-
- 37 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/external/bullet/BulletDynamics/Character/btCharacterControllerInterface.h
r8351 r8393 14 14 */ 15 15 16 #ifndef CHARACTER_CONTROLLER_INTERFACE_H17 #define CHARACTER_CONTROLLER_INTERFACE_H16 #ifndef BT_CHARACTER_CONTROLLER_INTERFACE_H 17 #define BT_CHARACTER_CONTROLLER_INTERFACE_H 18 18 19 19 #include "LinearMath/btVector3.h" … … 43 43 }; 44 44 45 #endif 45 #endif //BT_CHARACTER_CONTROLLER_INTERFACE_H 46 -
code/trunk/src/external/bullet/BulletDynamics/Character/btKinematicCharacterController.cpp
r8351 r8393 85 85 { 86 86 ///need to transform normal into worldspace 87 hitNormalWorld = m_hitCollisionObject->getWorldTransform().getBasis()*convexResult.m_hitNormalLocal;87 hitNormalWorld = convexResult.m_hitCollisionObject->getWorldTransform().getBasis()*convexResult.m_hitNormalLocal; 88 88 } 89 89 -
code/trunk/src/external/bullet/BulletDynamics/Character/btKinematicCharacterController.h
r8351 r8393 15 15 16 16 17 #ifndef KINEMATIC_CHARACTER_CONTROLLER_H18 #define KINEMATIC_CHARACTER_CONTROLLER_H17 #ifndef BT_KINEMATIC_CHARACTER_CONTROLLER_H 18 #define BT_KINEMATIC_CHARACTER_CONTROLLER_H 19 19 20 20 #include "LinearMath/btVector3.h" … … 160 160 }; 161 161 162 #endif // KINEMATIC_CHARACTER_CONTROLLER_H162 #endif // BT_KINEMATIC_CHARACTER_CONTROLLER_H -
code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btConeTwistConstraint.cpp
r8351 r8393 1115 1115 1116 1116 1117 1117 void btConeTwistConstraint::setFrames(const btTransform & frameA, const btTransform & frameB) 1118 { 1119 m_rbAFrame = frameA; 1120 m_rbBFrame = frameB; 1121 buildJacobian(); 1122 //calculateTransforms(); 1123 } 1124 1125 1126 1127 -
code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btConeTwistConstraint.h
r8351 r8393 34 34 35 35 36 #ifndef CONETWISTCONSTRAINT_H37 #define CONETWISTCONSTRAINT_H36 #ifndef BT_CONETWISTCONSTRAINT_H 37 #define BT_CONETWISTCONSTRAINT_H 38 38 39 39 #include "LinearMath/btVector3.h" … … 144 144 145 145 void updateRHS(btScalar timeStep); 146 146 147 147 148 const btRigidBody& getRigidBodyA() const … … 245 246 bool isPastSwingLimit() { return m_solveSwingLimit; } 246 247 247 248 248 void setDamping(btScalar damping) { m_damping = damping; } 249 249 … … 269 269 ///If no axis is provided, it uses the default axis for this constraint. 270 270 virtual void setParam(int num, btScalar value, int axis = -1); 271 272 virtual void setFrames(const btTransform& frameA, const btTransform& frameB); 273 274 const btTransform& getFrameOffsetA() const 275 { 276 return m_rbAFrame; 277 } 278 279 const btTransform& getFrameOffsetB() const 280 { 281 return m_rbBFrame; 282 } 283 284 271 285 ///return the local value of parameter 272 286 virtual btScalar getParam(int num, int axis = -1) const; … … 330 344 331 345 332 #endif // CONETWISTCONSTRAINT_H346 #endif //BT_CONETWISTCONSTRAINT_H -
code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btConstraintSolver.h
r5781 r8393 14 14 */ 15 15 16 #ifndef CONSTRAINT_SOLVER_H17 #define CONSTRAINT_SOLVER_H16 #ifndef BT_CONSTRAINT_SOLVER_H 17 #define BT_CONSTRAINT_SOLVER_H 18 18 19 19 #include "LinearMath/btScalar.h" … … 50 50 51 51 52 #endif // CONSTRAINT_SOLVER_H52 #endif //BT_CONSTRAINT_SOLVER_H -
code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btContactConstraint.cpp
r8351 r8393 69 69 #include "BulletCollision/NarrowPhaseCollision/btManifoldPoint.h" 70 70 71 #define ASSERT2 btAssert72 71 73 #define USE_INTERNAL_APPLY_IMPULSE 1 72 73 //response between two dynamic objects without friction, assuming 0 penetration depth 74 btScalar resolveSingleCollision( 75 btRigidBody* body1, 76 btCollisionObject* colObj2, 77 const btVector3& contactPositionWorld, 78 const btVector3& contactNormalOnB, 79 const btContactSolverInfo& solverInfo, 80 btScalar distance) 81 { 82 btRigidBody* body2 = btRigidBody::upcast(colObj2); 83 84 85 const btVector3& normal = contactNormalOnB; 86 87 btVector3 rel_pos1 = contactPositionWorld - body1->getWorldTransform().getOrigin(); 88 btVector3 rel_pos2 = contactPositionWorld - colObj2->getWorldTransform().getOrigin(); 89 90 btVector3 vel1 = body1->getVelocityInLocalPoint(rel_pos1); 91 btVector3 vel2 = body2? body2->getVelocityInLocalPoint(rel_pos2) : btVector3(0,0,0); 92 btVector3 vel = vel1 - vel2; 93 btScalar rel_vel; 94 rel_vel = normal.dot(vel); 95 96 btScalar combinedRestitution = body1->getRestitution() * colObj2->getRestitution(); 97 btScalar restitution = combinedRestitution* -rel_vel; 98 99 btScalar positionalError = solverInfo.m_erp *-distance /solverInfo.m_timeStep ; 100 btScalar velocityError = -(1.0f + restitution) * rel_vel;// * damping; 101 btScalar denom0 = body1->computeImpulseDenominator(contactPositionWorld,normal); 102 btScalar denom1 = body2? body2->computeImpulseDenominator(contactPositionWorld,normal) : 0.f; 103 btScalar relaxation = 1.f; 104 btScalar jacDiagABInv = relaxation/(denom0+denom1); 105 106 btScalar penetrationImpulse = positionalError * jacDiagABInv; 107 btScalar velocityImpulse = velocityError * jacDiagABInv; 108 109 btScalar normalImpulse = penetrationImpulse+velocityImpulse; 110 normalImpulse = 0.f > normalImpulse ? 0.f: normalImpulse; 111 112 body1->applyImpulse(normal*(normalImpulse), rel_pos1); 113 if (body2) 114 body2->applyImpulse(-normal*(normalImpulse), rel_pos2); 115 116 return normalImpulse; 117 } 74 118 75 119 … … 84 128 85 129 btScalar normalLenSqr = normal.length2(); 86 ASSERT2(btFabs(normalLenSqr) < btScalar(1.1));130 btAssert(btFabs(normalLenSqr) < btScalar(1.1)); 87 131 if (normalLenSqr > btScalar(1.1)) 88 132 { -
code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btContactConstraint.h
r8351 r8393 14 14 */ 15 15 16 #ifndef CONTACT_CONSTRAINT_H17 #define CONTACT_CONSTRAINT_H16 #ifndef BT_CONTACT_CONSTRAINT_H 17 #define BT_CONTACT_CONSTRAINT_H 18 18 19 19 #include "LinearMath/btVector3.h" … … 58 58 }; 59 59 60 ///very basic collision resolution without friction 61 btScalar resolveSingleCollision(btRigidBody* body1, class btCollisionObject* colObj2, const btVector3& contactPositionWorld,const btVector3& contactNormalOnB, const struct btContactSolverInfo& solverInfo,btScalar distance); 62 60 63 61 64 ///resolveSingleBilateral is an obsolete methods used for vehicle friction between two dynamic objects … … 66 69 67 70 68 #endif // CONTACT_CONSTRAINT_H71 #endif //BT_CONTACT_CONSTRAINT_H -
code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btContactSolverInfo.h
r8351 r8393 14 14 */ 15 15 16 #ifndef CONTACT_SOLVER_INFO17 #define CONTACT_SOLVER_INFO16 #ifndef BT_CONTACT_SOLVER_INFO 17 #define BT_CONTACT_SOLVER_INFO 18 18 19 19 enum btSolverMode … … 85 85 }; 86 86 87 #endif // CONTACT_SOLVER_INFO87 #endif //BT_CONTACT_SOLVER_INFO -
code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btGeneric6DofConstraint.cpp
r8351 r8393 711 711 (void)timeStep; 712 712 713 } 714 715 716 void btGeneric6DofConstraint::setFrames(const btTransform& frameA, const btTransform& frameB) 717 { 718 m_frameInA = frameA; 719 m_frameInB = frameB; 720 buildJacobian(); 721 calculateTransforms(); 713 722 } 714 723 … … 1039 1048 return retVal; 1040 1049 } 1050 1051 1052 1053 void btGeneric6DofConstraint::setAxis(const btVector3& axis1,const btVector3& axis2) 1054 { 1055 btVector3 zAxis = axis1.normalized(); 1056 btVector3 yAxis = axis2.normalized(); 1057 btVector3 xAxis = yAxis.cross(zAxis); // we want right coordinate system 1058 1059 btTransform frameInW; 1060 frameInW.setIdentity(); 1061 frameInW.getBasis().setValue( xAxis[0], yAxis[0], zAxis[0], 1062 xAxis[1], yAxis[1], zAxis[1], 1063 xAxis[2], yAxis[2], zAxis[2]); 1064 1065 // now get constraint frame in local coordinate systems 1066 m_frameInA = m_rbA.getCenterOfMassTransform().inverse() * frameInW; 1067 m_frameInB = m_rbB.getCenterOfMassTransform().inverse() * frameInW; 1068 1069 calculateTransforms(); 1070 } -
code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btGeneric6DofConstraint.h
r8351 r8393 25 25 26 26 27 #ifndef GENERIC_6DOF_CONSTRAINT_H28 #define GENERIC_6DOF_CONSTRAINT_H27 #ifndef BT_GENERIC_6DOF_CONSTRAINT_H 28 #define BT_GENERIC_6DOF_CONSTRAINT_H 29 29 30 30 #include "LinearMath/btVector3.h" … … 434 434 btScalar getRelativePivotPosition(int axis_index) const; 435 435 436 void setFrames(const btTransform & frameA, const btTransform & frameB); 436 437 437 438 //! Test angular limit. … … 447 448 } 448 449 449 void setLinearUpperLimit(const btVector3& linearUpper) 450 { 451 m_linearLimits.m_upperLimit = linearUpper; 452 } 450 void getLinearLowerLimit(btVector3& linearLower) 451 { 452 linearLower = m_linearLimits.m_lowerLimit; 453 } 454 455 void setLinearUpperLimit(const btVector3& linearUpper) 456 { 457 m_linearLimits.m_upperLimit = linearUpper; 458 } 459 460 void getLinearUpperLimit(btVector3& linearUpper) 461 { 462 linearUpper = m_linearLimits.m_upperLimit; 463 } 453 464 454 465 void setAngularLowerLimit(const btVector3& angularLower) … … 458 469 } 459 470 471 void getAngularLowerLimit(btVector3& angularLower) 472 { 473 for(int i = 0; i < 3; i++) 474 angularLower[i] = m_angularLimits[i].m_loLimit; 475 } 476 460 477 void setAngularUpperLimit(const btVector3& angularUpper) 461 478 { … … 463 480 m_angularLimits[i].m_hiLimit = btNormalizeAngle(angularUpper[i]); 464 481 } 482 483 void getAngularUpperLimit(btVector3& angularUpper) 484 { 485 for(int i = 0; i < 3; i++) 486 angularUpper[i] = m_angularLimits[i].m_hiLimit; 487 } 465 488 466 489 //! Retrieves the angular limit informacion … … 526 549 virtual btScalar getParam(int num, int axis = -1) const; 527 550 551 void setAxis( const btVector3& axis1, const btVector3& axis2); 552 553 528 554 virtual int calculateSerializeBufferSize() const; 529 555 … … 586 612 587 613 588 #endif // GENERIC_6DOF_CONSTRAINT_H614 #endif //BT_GENERIC_6DOF_CONSTRAINT_H -
code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btGeneric6DofSpringConstraint.cpp
r8351 r8393 22 22 : btGeneric6DofConstraint(rbA, rbB, frameInA, frameInB, useLinearReferenceFrameA) 23 23 { 24 m_objectType = D6_SPRING_CONSTRAINT_TYPE; 25 24 26 for(int i = 0; i < 6; i++) 25 27 { … … 148 150 149 151 152 void btGeneric6DofSpringConstraint::setAxis(const btVector3& axis1,const btVector3& axis2) 153 { 154 btVector3 zAxis = axis1.normalized(); 155 btVector3 yAxis = axis2.normalized(); 156 btVector3 xAxis = yAxis.cross(zAxis); // we want right coordinate system 157 158 btTransform frameInW; 159 frameInW.setIdentity(); 160 frameInW.getBasis().setValue( xAxis[0], yAxis[0], zAxis[0], 161 xAxis[1], yAxis[1], zAxis[1], 162 xAxis[2], yAxis[2], zAxis[2]); 163 164 // now get constraint frame in local coordinate systems 165 m_frameInA = m_rbA.getCenterOfMassTransform().inverse() * frameInW; 166 m_frameInB = m_rbB.getCenterOfMassTransform().inverse() * frameInW; 167 168 calculateTransforms(); 169 } 150 170 151 171 172 -
code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btGeneric6DofSpringConstraint.h
r8351 r8393 14 14 */ 15 15 16 #ifndef GENERIC_6DOF_SPRING_CONSTRAINT_H17 #define GENERIC_6DOF_SPRING_CONSTRAINT_H16 #ifndef BT_GENERIC_6DOF_SPRING_CONSTRAINT_H 17 #define BT_GENERIC_6DOF_SPRING_CONSTRAINT_H 18 18 19 19 … … 49 49 void setEquilibriumPoint(int index); // set the current constraint position/orientation as an equilibrium point for given DOF 50 50 void setEquilibriumPoint(int index, btScalar val); 51 52 virtual void setAxis( const btVector3& axis1, const btVector3& axis2); 53 51 54 virtual void getInfo2 (btConstraintInfo2* info); 55 56 virtual int calculateSerializeBufferSize() const; 57 ///fills the dataBuffer and returns the struct name (and 0 on failure) 58 virtual const char* serialize(void* dataBuffer, btSerializer* serializer) const; 59 52 60 }; 53 61 54 #endif // GENERIC_6DOF_SPRING_CONSTRAINT_H55 62 63 ///do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64 64 struct btGeneric6DofSpringConstraintData 65 { 66 btGeneric6DofConstraintData m_6dofData; 67 68 int m_springEnabled[6]; 69 float m_equilibriumPoint[6]; 70 float m_springStiffness[6]; 71 float m_springDamping[6]; 72 }; 73 74 SIMD_FORCE_INLINE int btGeneric6DofSpringConstraint::calculateSerializeBufferSize() const 75 { 76 return sizeof(btGeneric6DofSpringConstraintData); 77 } 78 79 ///fills the dataBuffer and returns the struct name (and 0 on failure) 80 SIMD_FORCE_INLINE const char* btGeneric6DofSpringConstraint::serialize(void* dataBuffer, btSerializer* serializer) const 81 { 82 btGeneric6DofSpringConstraintData* dof = (btGeneric6DofSpringConstraintData*)dataBuffer; 83 btGeneric6DofConstraint::serialize(&dof->m_6dofData,serializer); 84 85 int i; 86 for (i=0;i<6;i++) 87 { 88 dof->m_equilibriumPoint[i] = m_equilibriumPoint[i]; 89 dof->m_springDamping[i] = m_springDamping[i]; 90 dof->m_springEnabled[i] = m_springEnabled[i]? 1 : 0; 91 dof->m_springStiffness[i] = m_springStiffness[i]; 92 } 93 return "btGeneric6DofConstraintData"; 94 } 95 96 #endif // BT_GENERIC_6DOF_SPRING_CONSTRAINT_H 97 -
code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btHinge2Constraint.h
r8351 r8393 14 14 */ 15 15 16 #ifndef HINGE2_CONSTRAINT_H17 #define HINGE2_CONSTRAINT_H16 #ifndef BT_HINGE2_CONSTRAINT_H 17 #define BT_HINGE2_CONSTRAINT_H 18 18 19 19 … … 55 55 56 56 57 #endif // HINGE2_CONSTRAINT_H57 #endif // BT_HINGE2_CONSTRAINT_H 58 58 -
code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btHingeConstraint.cpp
r8351 r8393 44 44 m_useReferenceFrameA(useReferenceFrameA), 45 45 m_flags(0) 46 #ifdef _BT_USE_CENTER_LIMIT_ 47 ,m_limit() 48 #endif 46 49 { 47 50 m_rbAFrame.getOrigin() = pivotInA; … … 76 79 rbAxisB1.getZ(),rbAxisB2.getZ(),axisInB.getZ() ); 77 80 81 #ifndef _BT_USE_CENTER_LIMIT_ 78 82 //start with free 79 83 m_lowerLimit = btScalar(1.0f); … … 83 87 m_limitSoftness = 0.9f; 84 88 m_solveLimit = false; 89 #endif 85 90 m_referenceSign = m_useReferenceFrameA ? btScalar(-1.f) : btScalar(1.f); 86 91 } … … 94 99 m_useReferenceFrameA(useReferenceFrameA), 95 100 m_flags(0) 101 #ifdef _BT_USE_CENTER_LIMIT_ 102 ,m_limit() 103 #endif 96 104 { 97 105 … … 118 126 rbAxisB1.getZ(),rbAxisB2.getZ(),axisInB.getZ() ); 119 127 128 #ifndef _BT_USE_CENTER_LIMIT_ 120 129 //start with free 121 130 m_lowerLimit = btScalar(1.0f); … … 125 134 m_limitSoftness = 0.9f; 126 135 m_solveLimit = false; 136 #endif 127 137 m_referenceSign = m_useReferenceFrameA ? btScalar(-1.f) : btScalar(1.f); 128 138 } … … 139 149 m_useReferenceFrameA(useReferenceFrameA), 140 150 m_flags(0) 141 { 151 #ifdef _BT_USE_CENTER_LIMIT_ 152 ,m_limit() 153 #endif 154 { 155 #ifndef _BT_USE_CENTER_LIMIT_ 142 156 //start with free 143 157 m_lowerLimit = btScalar(1.0f); … … 147 161 m_limitSoftness = 0.9f; 148 162 m_solveLimit = false; 163 #endif 149 164 m_referenceSign = m_useReferenceFrameA ? btScalar(-1.f) : btScalar(1.f); 150 165 } … … 160 175 m_useReferenceFrameA(useReferenceFrameA), 161 176 m_flags(0) 177 #ifdef _BT_USE_CENTER_LIMIT_ 178 ,m_limit() 179 #endif 162 180 { 163 181 ///not providing rigidbody B means implicitly using worldspace for body B 164 182 165 183 m_rbBFrame.getOrigin() = m_rbA.getCenterOfMassTransform()(m_rbAFrame.getOrigin()); 166 184 #ifndef _BT_USE_CENTER_LIMIT_ 167 185 //start with free 168 186 m_lowerLimit = btScalar(1.0f); … … 172 190 m_limitSoftness = 0.9f; 173 191 m_solveLimit = false; 192 #endif 174 193 m_referenceSign = m_useReferenceFrameA ? btScalar(-1.f) : btScalar(1.f); 175 194 } … … 450 469 if(getSolveLimit()) 451 470 { 452 limit_err = m_correction * m_referenceSign; 453 limit = (limit_err > btScalar(0.0)) ? 1 : 2; 471 #ifdef _BT_USE_CENTER_LIMIT_ 472 limit_err = m_limit.getCorrection() * m_referenceSign; 473 #else 474 limit_err = m_correction * m_referenceSign; 475 #endif 476 limit = (limit_err > btScalar(0.0)) ? 1 : 2; 477 454 478 } 455 479 // if the hinge has joint limits or motor, add in the extra row … … 515 539 } 516 540 // bounce (we'll use slider parameter abs(1.0 - m_dampingLimAng) for that) 541 #ifdef _BT_USE_CENTER_LIMIT_ 542 btScalar bounce = m_limit.getRelaxationFactor(); 543 #else 517 544 btScalar bounce = m_relaxationFactor; 545 #endif 518 546 if(bounce > btScalar(0.0)) 519 547 { … … 545 573 } 546 574 } 575 #ifdef _BT_USE_CENTER_LIMIT_ 576 info->m_constraintError[srow] *= m_limit.getBiasFactor(); 577 #else 547 578 info->m_constraintError[srow] *= m_biasFactor; 579 #endif 548 580 } // if(limit) 549 581 } // if angular limit or powered … … 551 583 552 584 553 554 585 void btHingeConstraint::setFrames(const btTransform & frameA, const btTransform & frameB) 586 { 587 m_rbAFrame = frameA; 588 m_rbBFrame = frameB; 589 buildJacobian(); 590 } 555 591 556 592 … … 578 614 579 615 580 #if 0581 void btHingeConstraint::testLimit()582 {583 // Compute limit information584 m_hingeAngle = getHingeAngle();585 m_correction = btScalar(0.);586 m_limitSign = btScalar(0.);587 m_solveLimit = false;588 if (m_lowerLimit <= m_upperLimit)589 {590 if (m_hingeAngle <= m_lowerLimit)591 {592 m_correction = (m_lowerLimit - m_hingeAngle);593 m_limitSign = 1.0f;594 m_solveLimit = true;595 }596 else if (m_hingeAngle >= m_upperLimit)597 {598 m_correction = m_upperLimit - m_hingeAngle;599 m_limitSign = -1.0f;600 m_solveLimit = true;601 }602 }603 return;604 }605 #else606 607 616 608 617 void btHingeConstraint::testLimit(const btTransform& transA,const btTransform& transB) … … 610 619 // Compute limit information 611 620 m_hingeAngle = getHingeAngle(transA,transB); 621 #ifdef _BT_USE_CENTER_LIMIT_ 622 m_limit.test(m_hingeAngle); 623 #else 612 624 m_correction = btScalar(0.); 613 625 m_limitSign = btScalar(0.); … … 629 641 } 630 642 } 643 #endif 631 644 return; 632 645 } 633 #endif 646 634 647 635 648 static btVector3 vHinge(0, 0, btScalar(1)); … … 662 675 void btHingeConstraint::setMotorTarget(btScalar targetAngle, btScalar dt) 663 676 { 677 #ifdef _BT_USE_CENTER_LIMIT_ 678 m_limit.fit(targetAngle); 679 #else 664 680 if (m_lowerLimit < m_upperLimit) 665 681 { … … 669 685 targetAngle = m_upperLimit; 670 686 } 671 687 #endif 672 688 // compute angular velocity 673 689 btScalar curAngle = getHingeAngle(m_rbA.getCenterOfMassTransform(),m_rbB.getCenterOfMassTransform()); … … 840 856 if(getSolveLimit()) 841 857 { 842 limit_err = m_correction * m_referenceSign; 843 limit = (limit_err > btScalar(0.0)) ? 1 : 2; 858 #ifdef _BT_USE_CENTER_LIMIT_ 859 limit_err = m_limit.getCorrection() * m_referenceSign; 860 #else 861 limit_err = m_correction * m_referenceSign; 862 #endif 863 limit = (limit_err > btScalar(0.0)) ? 1 : 2; 864 844 865 } 845 866 // if the hinge has joint limits or motor, add in the extra row … … 905 926 } 906 927 // bounce (we'll use slider parameter abs(1.0 - m_dampingLimAng) for that) 928 #ifdef _BT_USE_CENTER_LIMIT_ 929 btScalar bounce = m_limit.getRelaxationFactor(); 930 #else 907 931 btScalar bounce = m_relaxationFactor; 932 #endif 908 933 if(bounce > btScalar(0.0)) 909 934 { … … 935 960 } 936 961 } 962 #ifdef _BT_USE_CENTER_LIMIT_ 963 info->m_constraintError[srow] *= m_limit.getBiasFactor(); 964 #else 937 965 info->m_constraintError[srow] *= m_biasFactor; 966 #endif 938 967 } // if(limit) 939 968 } // if angular limit or powered -
code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btHingeConstraint.h
r8351 r8393 16 16 /* Hinge Constraint by Dirk Gregorius. Limits added by Marcus Hennix at Starbreeze Studios */ 17 17 18 #ifndef HINGECONSTRAINT_H 19 #define HINGECONSTRAINT_H 18 #ifndef BT_HINGECONSTRAINT_H 19 #define BT_HINGECONSTRAINT_H 20 21 #define _BT_USE_CENTER_LIMIT_ 1 22 20 23 21 24 #include "LinearMath/btVector3.h" … … 32 35 #define btHingeConstraintDataName "btHingeConstraintFloatData" 33 36 #endif //BT_USE_DOUBLE_PRECISION 37 34 38 35 39 … … 58 62 btScalar m_maxMotorImpulse; 59 63 64 65 #ifdef _BT_USE_CENTER_LIMIT_ 66 btAngularLimit m_limit; 67 #else 68 btScalar m_lowerLimit; 69 btScalar m_upperLimit; 70 btScalar m_limitSign; 71 btScalar m_correction; 72 60 73 btScalar m_limitSoftness; 61 74 btScalar m_biasFactor; 62 btScalar 63 64 b tScalar m_lowerLimit;65 btScalar m_upperLimit; 66 75 btScalar m_relaxationFactor; 76 77 bool m_solveLimit; 78 #endif 79 67 80 btScalar m_kHinge; 68 81 69 btScalar m_limitSign;70 btScalar m_correction;71 82 72 83 btScalar m_accLimitImpulse; 73 84 btScalar m_hingeAngle; 74 btScalar 85 btScalar m_referenceSign; 75 86 76 87 bool m_angularOnly; 77 88 bool m_enableAngularMotor; 78 bool m_solveLimit;79 89 bool m_useSolveConstraintObsolete; 80 90 bool m_useOffsetForConstraintFrame; … … 133 143 { 134 144 return m_rbB; 135 } 145 } 146 147 btTransform& getFrameOffsetA() 148 { 149 return m_rbAFrame; 150 } 151 152 btTransform& getFrameOffsetB() 153 { 154 return m_rbBFrame; 155 } 156 157 void setFrames(const btTransform& frameA, const btTransform& frameB); 136 158 137 159 void setAngularOnly(bool angularOnly) … … 158 180 void setLimit(btScalar low,btScalar high,btScalar _softness = 0.9f, btScalar _biasFactor = 0.3f, btScalar _relaxationFactor = 1.0f) 159 181 { 182 #ifdef _BT_USE_CENTER_LIMIT_ 183 m_limit.set(low, high, _softness, _biasFactor, _relaxationFactor); 184 #else 160 185 m_lowerLimit = btNormalizeAngle(low); 161 186 m_upperLimit = btNormalizeAngle(high); 162 163 187 m_limitSoftness = _softness; 164 188 m_biasFactor = _biasFactor; 165 189 m_relaxationFactor = _relaxationFactor; 166 190 #endif 167 191 } 168 192 … … 183 207 btVector3 rbAxisB2 = axisInB.cross(rbAxisB1); 184 208 185 186 m_rbBFrame.getOrigin() = m_rbA.getCenterOfMassTransform()(pivotInA); 209 m_rbBFrame.getOrigin() = m_rbB.getCenterOfMassTransform().inverse()(m_rbA.getCenterOfMassTransform()(pivotInA)); 210 187 211 m_rbBFrame.getBasis().setValue( rbAxisB1.getX(),rbAxisB2.getX(),axisInB.getX(), 188 212 rbAxisB1.getY(),rbAxisB2.getY(),axisInB.getY(), 189 213 rbAxisB1.getZ(),rbAxisB2.getZ(),axisInB.getZ() ); 214 m_rbBFrame.getBasis() = m_rbB.getCenterOfMassTransform().getBasis().inverse() * m_rbBFrame.getBasis(); 215 190 216 } 191 217 192 218 btScalar getLowerLimit() const 193 219 { 194 return m_lowerLimit; 220 #ifdef _BT_USE_CENTER_LIMIT_ 221 return m_limit.getLow(); 222 #else 223 return m_lowerLimit; 224 #endif 195 225 } 196 226 197 227 btScalar getUpperLimit() const 198 228 { 199 return m_upperLimit; 229 #ifdef _BT_USE_CENTER_LIMIT_ 230 return m_limit.getHigh(); 231 #else 232 return m_upperLimit; 233 #endif 200 234 } 201 235 … … 216 250 inline int getSolveLimit() 217 251 { 218 return m_solveLimit; 252 #ifdef _BT_USE_CENTER_LIMIT_ 253 return m_limit.isLimit(); 254 #else 255 return m_solveLimit; 256 #endif 219 257 } 220 258 221 259 inline btScalar getLimitSign() 222 260 { 261 #ifdef _BT_USE_CENTER_LIMIT_ 262 return m_limit.getSign(); 263 #else 223 264 return m_limitSign; 265 #endif 224 266 } 225 267 … … 320 362 hingeData->m_motorTargetVelocity = float(m_motorTargetVelocity); 321 363 hingeData->m_useReferenceFrameA = m_useReferenceFrameA; 322 364 #ifdef _BT_USE_CENTER_LIMIT_ 365 hingeData->m_lowerLimit = float(m_limit.getLow()); 366 hingeData->m_upperLimit = float(m_limit.getHigh()); 367 hingeData->m_limitSoftness = float(m_limit.getSoftness()); 368 hingeData->m_biasFactor = float(m_limit.getBiasFactor()); 369 hingeData->m_relaxationFactor = float(m_limit.getRelaxationFactor()); 370 #else 323 371 hingeData->m_lowerLimit = float(m_lowerLimit); 324 372 hingeData->m_upperLimit = float(m_upperLimit); … … 326 374 hingeData->m_biasFactor = float(m_biasFactor); 327 375 hingeData->m_relaxationFactor = float(m_relaxationFactor); 376 #endif 328 377 329 378 return btHingeConstraintDataName; 330 379 } 331 380 332 #endif // HINGECONSTRAINT_H381 #endif //BT_HINGECONSTRAINT_H -
code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btJacobianEntry.h
r8351 r8393 14 14 */ 15 15 16 #ifndef JACOBIAN_ENTRY_H17 #define JACOBIAN_ENTRY_H16 #ifndef BT_JACOBIAN_ENTRY_H 17 #define BT_JACOBIAN_ENTRY_H 18 18 19 19 #include "LinearMath/btVector3.h" … … 154 154 }; 155 155 156 #endif // JACOBIAN_ENTRY_H156 #endif //BT_JACOBIAN_ENTRY_H -
code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btPoint2PointConstraint.h
r8351 r8393 14 14 */ 15 15 16 #ifndef POINT2POINTCONSTRAINT_H17 #define POINT2POINTCONSTRAINT_H16 #ifndef BT_POINT2POINTCONSTRAINT_H 17 #define BT_POINT2POINTCONSTRAINT_H 18 18 19 19 #include "LinearMath/btVector3.h" … … 159 159 } 160 160 161 #endif // POINT2POINTCONSTRAINT_H161 #endif //BT_POINT2POINTCONSTRAINT_H -
code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btSequentialImpulseConstraintSolver.cpp
r8351 r8393 49 49 #ifdef USE_SIMD 50 50 #include <emmintrin.h> 51 #define vec_splat(x, e) _mm_shuffle_ps(x, x, _MM_SHUFFLE(e,e,e,e))52 static inline __m128 _vmathVfDot3( __m128 vec0, __m128 vec1 )51 #define btVecSplat(x, e) _mm_shuffle_ps(x, x, _MM_SHUFFLE(e,e,e,e)) 52 static inline __m128 btSimdDot3( __m128 vec0, __m128 vec1 ) 53 53 { 54 54 __m128 result = _mm_mul_ps( vec0, vec1); 55 return _mm_add_ps( vec_splat( result, 0 ), _mm_add_ps( vec_splat( result, 1 ), vec_splat( result, 2 ) ) );55 return _mm_add_ps( btVecSplat( result, 0 ), _mm_add_ps( btVecSplat( result, 1 ), btVecSplat( result, 2 ) ) ); 56 56 } 57 57 #endif//USE_SIMD … … 65 65 __m128 upperLimit1 = _mm_set1_ps(c.m_upperLimit); 66 66 __m128 deltaImpulse = _mm_sub_ps(_mm_set1_ps(c.m_rhs), _mm_mul_ps(_mm_set1_ps(c.m_appliedImpulse),_mm_set1_ps(c.m_cfm))); 67 __m128 deltaVel1Dotn = _mm_add_ps( _vmathVfDot3(c.m_contactNormal.mVec128,body1.internalGetDeltaLinearVelocity().mVec128), _vmathVfDot3(c.m_relpos1CrossNormal.mVec128,body1.internalGetDeltaAngularVelocity().mVec128));68 __m128 deltaVel2Dotn = _mm_sub_ps( _vmathVfDot3(c.m_relpos2CrossNormal.mVec128,body2.internalGetDeltaAngularVelocity().mVec128),_vmathVfDot3((c.m_contactNormal).mVec128,body2.internalGetDeltaLinearVelocity().mVec128));67 __m128 deltaVel1Dotn = _mm_add_ps(btSimdDot3(c.m_contactNormal.mVec128,body1.internalGetDeltaLinearVelocity().mVec128), btSimdDot3(c.m_relpos1CrossNormal.mVec128,body1.internalGetDeltaAngularVelocity().mVec128)); 68 __m128 deltaVel2Dotn = _mm_sub_ps(btSimdDot3(c.m_relpos2CrossNormal.mVec128,body2.internalGetDeltaAngularVelocity().mVec128),btSimdDot3((c.m_contactNormal).mVec128,body2.internalGetDeltaLinearVelocity().mVec128)); 69 69 deltaImpulse = _mm_sub_ps(deltaImpulse,_mm_mul_ps(deltaVel1Dotn,_mm_set1_ps(c.m_jacDiagABInv))); 70 70 deltaImpulse = _mm_sub_ps(deltaImpulse,_mm_mul_ps(deltaVel2Dotn,_mm_set1_ps(c.m_jacDiagABInv))); … … 128 128 __m128 upperLimit1 = _mm_set1_ps(c.m_upperLimit); 129 129 __m128 deltaImpulse = _mm_sub_ps(_mm_set1_ps(c.m_rhs), _mm_mul_ps(_mm_set1_ps(c.m_appliedImpulse),_mm_set1_ps(c.m_cfm))); 130 __m128 deltaVel1Dotn = _mm_add_ps( _vmathVfDot3(c.m_contactNormal.mVec128,body1.internalGetDeltaLinearVelocity().mVec128), _vmathVfDot3(c.m_relpos1CrossNormal.mVec128,body1.internalGetDeltaAngularVelocity().mVec128));131 __m128 deltaVel2Dotn = _mm_sub_ps( _vmathVfDot3(c.m_relpos2CrossNormal.mVec128,body2.internalGetDeltaAngularVelocity().mVec128),_vmathVfDot3((c.m_contactNormal).mVec128,body2.internalGetDeltaLinearVelocity().mVec128));130 __m128 deltaVel1Dotn = _mm_add_ps(btSimdDot3(c.m_contactNormal.mVec128,body1.internalGetDeltaLinearVelocity().mVec128), btSimdDot3(c.m_relpos1CrossNormal.mVec128,body1.internalGetDeltaAngularVelocity().mVec128)); 131 __m128 deltaVel2Dotn = _mm_sub_ps(btSimdDot3(c.m_relpos2CrossNormal.mVec128,body2.internalGetDeltaAngularVelocity().mVec128),btSimdDot3((c.m_contactNormal).mVec128,body2.internalGetDeltaLinearVelocity().mVec128)); 132 132 deltaImpulse = _mm_sub_ps(deltaImpulse,_mm_mul_ps(deltaVel1Dotn,_mm_set1_ps(c.m_jacDiagABInv))); 133 133 deltaImpulse = _mm_sub_ps(deltaImpulse,_mm_mul_ps(deltaVel2Dotn,_mm_set1_ps(c.m_jacDiagABInv))); … … 216 216 __m128 upperLimit1 = _mm_set1_ps(c.m_upperLimit); 217 217 __m128 deltaImpulse = _mm_sub_ps(_mm_set1_ps(c.m_rhsPenetration), _mm_mul_ps(_mm_set1_ps(c.m_appliedPushImpulse),_mm_set1_ps(c.m_cfm))); 218 __m128 deltaVel1Dotn = _mm_add_ps( _vmathVfDot3(c.m_contactNormal.mVec128,body1.internalGetPushVelocity().mVec128), _vmathVfDot3(c.m_relpos1CrossNormal.mVec128,body1.internalGetTurnVelocity().mVec128));219 __m128 deltaVel2Dotn = _mm_sub_ps( _vmathVfDot3(c.m_relpos2CrossNormal.mVec128,body2.internalGetTurnVelocity().mVec128),_vmathVfDot3((c.m_contactNormal).mVec128,body2.internalGetPushVelocity().mVec128));218 __m128 deltaVel1Dotn = _mm_add_ps(btSimdDot3(c.m_contactNormal.mVec128,body1.internalGetPushVelocity().mVec128), btSimdDot3(c.m_relpos1CrossNormal.mVec128,body1.internalGetTurnVelocity().mVec128)); 219 __m128 deltaVel2Dotn = _mm_sub_ps(btSimdDot3(c.m_relpos2CrossNormal.mVec128,body2.internalGetTurnVelocity().mVec128),btSimdDot3((c.m_contactNormal).mVec128,body2.internalGetPushVelocity().mVec128)); 220 220 deltaImpulse = _mm_sub_ps(deltaImpulse,_mm_mul_ps(deltaVel1Dotn,_mm_set1_ps(c.m_jacDiagABInv))); 221 221 deltaImpulse = _mm_sub_ps(deltaImpulse,_mm_mul_ps(deltaVel2Dotn,_mm_set1_ps(c.m_jacDiagABInv))); … … 558 558 559 559 btScalar positionalError = 0.f; 560 positionalError = -penetration * infoGlobal.m_erp/infoGlobal.m_timeStep;561 560 btScalar velocityError = restitution - rel_vel;// * damping; 561 562 if (penetration>0) 563 { 564 positionalError = 0; 565 velocityError -= penetration / infoGlobal.m_timeStep; 566 } else 567 { 568 positionalError = -penetration * infoGlobal.m_erp/infoGlobal.m_timeStep; 569 } 570 562 571 btScalar penetrationImpulse = positionalError*solverConstraint.m_jacDiagABInv; 563 572 btScalar velocityImpulse = velocityError *solverConstraint.m_jacDiagABInv; … … 780 789 btTypedConstraint* constraint = constraints[j]; 781 790 constraint->buildJacobian(); 791 constraint->internalSetAppliedImpulse(0.0f); 782 792 } 783 793 } … … 796 806 { 797 807 btTypedConstraint::btConstraintInfo1& info1 = m_tmpConstraintSizesPool[i]; 798 constraints[i]->getInfo1(&info1); 808 if (constraints[i]->isEnabled()) 809 { 810 constraints[i]->getInfo1(&info1); 811 } else 812 { 813 info1.m_numConstraintRows = 0; 814 info1.nub = 0; 815 } 799 816 totalNumRows += info1.m_numConstraintRows; 800 817 } … … 817 834 818 835 819 820 836 btRigidBody& rbA = constraint->getRigidBodyA(); 821 837 btRigidBody& rbB = constraint->getRigidBodyB(); … … 826 842 { 827 843 memset(¤tConstraintRow[j],0,sizeof(btSolverConstraint)); 828 currentConstraintRow[j].m_lowerLimit = - FLT_MAX;829 currentConstraintRow[j].m_upperLimit = FLT_MAX;844 currentConstraintRow[j].m_lowerLimit = -SIMD_INFINITY; 845 currentConstraintRow[j].m_upperLimit = SIMD_INFINITY; 830 846 currentConstraintRow[j].m_appliedImpulse = 0.f; 831 847 currentConstraintRow[j].m_appliedPushImpulse = 0.f; … … 860 876 constraints[i]->getInfo2(&info2); 861 877 878 if (currentConstraintRow->m_upperLimit>constraints[i]->getBreakingImpulseThreshold()) 879 { 880 currentConstraintRow->m_upperLimit = constraints[i]->getBreakingImpulseThreshold(); 881 } 882 883 if (currentConstraintRow->m_lowerLimit<-constraints[i]->getBreakingImpulseThreshold()) 884 { 885 currentConstraintRow->m_lowerLimit = -constraints[i]->getBreakingImpulseThreshold(); 886 } 887 888 889 862 890 ///finalize the constraint setup 863 891 for ( j=0;j<info1.m_numConstraintRows;j++) … … 1107 1135 int iteration; 1108 1136 { 1137 solveGroupCacheFriendlySplitImpulseIterations(bodies ,numBodies,manifoldPtr, numManifolds,constraints,numConstraints,infoGlobal,debugDrawer,stackAlloc); 1138 1109 1139 for ( iteration = 0;iteration<infoGlobal.m_numIterations;iteration++) 1110 1140 { … … 1112 1142 } 1113 1143 1114 solveGroupCacheFriendlySplitImpulseIterations(bodies ,numBodies,manifoldPtr, numManifolds,constraints,numConstraints,infoGlobal,debugDrawer,stackAlloc);1115 1144 } 1116 1145 return 0.f; … … 1143 1172 const btSolverConstraint& solverConstr = m_tmpSolverNonContactConstraintPool[j]; 1144 1173 btTypedConstraint* constr = (btTypedConstraint*)solverConstr.m_originalContactPoint; 1145 btScalar sum = constr->internalGetAppliedImpulse(); 1146 sum += solverConstr.m_appliedImpulse; 1147 constr->internalSetAppliedImpulse(sum); 1174 constr->internalSetAppliedImpulse(solverConstr.m_appliedImpulse); 1175 if (solverConstr.m_appliedImpulse>constr->getBreakingImpulseThreshold()) 1176 { 1177 constr->setEnabled(false); 1178 } 1148 1179 } 1149 1180 -
code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btSequentialImpulseConstraintSolver.h
r8351 r8393 14 14 */ 15 15 16 #ifndef SEQUENTIAL_IMPULSE_CONSTRAINT_SOLVER_H17 #define SEQUENTIAL_IMPULSE_CONSTRAINT_SOLVER_H16 #ifndef BT_SEQUENTIAL_IMPULSE_CONSTRAINT_SOLVER_H 17 #define BT_SEQUENTIAL_IMPULSE_CONSTRAINT_SOLVER_H 18 18 19 19 #include "btConstraintSolver.h" … … 125 125 126 126 127 #endif // SEQUENTIAL_IMPULSE_CONSTRAINT_SOLVER_H127 #endif //BT_SEQUENTIAL_IMPULSE_CONSTRAINT_SOLVER_H 128 128 -
code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btSliderConstraint.h
r8351 r8393 23 23 */ 24 24 25 #ifndef SLIDER_CONSTRAINT_H26 #define SLIDER_CONSTRAINT_H25 #ifndef BT_SLIDER_CONSTRAINT_H 26 #define BT_SLIDER_CONSTRAINT_H 27 27 28 28 … … 237 237 void setMaxAngMotorForce(btScalar maxAngMotorForce) { m_maxAngMotorForce = maxAngMotorForce; } 238 238 btScalar getMaxAngMotorForce() { return m_maxAngMotorForce; } 239 btScalar getLinearPos() { return m_linPos; } 239 240 btScalar getLinearPos() const { return m_linPos; } 241 btScalar getAngularPos() const { return m_angPos; } 242 240 243 241 244 … … 256 259 void setUseFrameOffset(bool frameOffsetOnOff) { m_useOffsetForConstraintFrame = frameOffsetOnOff; } 257 260 261 void setFrames(const btTransform& frameA, const btTransform& frameB) 262 { 263 m_frameInA=frameA; 264 m_frameInB=frameB; 265 calculateTransforms(m_rbA.getCenterOfMassTransform(),m_rbB.getCenterOfMassTransform()); 266 buildJacobian(); 267 } 268 269 258 270 ///override the default global value of a parameter (such as ERP or CFM), optionally provide the axis (0..5). 259 271 ///If no axis is provided, it uses the default axis for this constraint. … … 318 330 319 331 320 #endif // SLIDER_CONSTRAINT_H321 332 #endif //BT_SLIDER_CONSTRAINT_H 333 -
code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btSolve2LinearConstraint.h
r5781 r8393 14 14 */ 15 15 16 #ifndef SOLVE_2LINEAR_CONSTRAINT_H17 #define SOLVE_2LINEAR_CONSTRAINT_H16 #ifndef BT_SOLVE_2LINEAR_CONSTRAINT_H 17 #define BT_SOLVE_2LINEAR_CONSTRAINT_H 18 18 19 19 #include "LinearMath/btMatrix3x3.h" … … 105 105 }; 106 106 107 #endif // SOLVE_2LINEAR_CONSTRAINT_H107 #endif //BT_SOLVE_2LINEAR_CONSTRAINT_H -
code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btTypedConstraint.cpp
r8351 r8393 30 30 m_rbB(getFixedBody()), 31 31 m_appliedImpulse(btScalar(0.)), 32 m_dbgDrawSize(DEFAULT_DEBUGDRAW_SIZE) 32 m_dbgDrawSize(DEFAULT_DEBUGDRAW_SIZE), 33 m_breakingImpulseThreshold(SIMD_INFINITY), 34 m_isEnabled(true) 33 35 { 34 36 } … … 43 45 m_rbB(rbB), 44 46 m_appliedImpulse(btScalar(0.)), 45 m_dbgDrawSize(DEFAULT_DEBUGDRAW_SIZE) 47 m_dbgDrawSize(DEFAULT_DEBUGDRAW_SIZE), 48 m_breakingImpulseThreshold(SIMD_INFINITY), 49 m_isEnabled(true) 46 50 { 47 51 } … … 141 145 } 142 146 147 148 void btAngularLimit::set(btScalar low, btScalar high, btScalar _softness, btScalar _biasFactor, btScalar _relaxationFactor) 149 { 150 m_halfRange = (high - low) / 2.0f; 151 m_center = btNormalizeAngle(low + m_halfRange); 152 m_softness = _softness; 153 m_biasFactor = _biasFactor; 154 m_relaxationFactor = _relaxationFactor; 155 } 156 157 void btAngularLimit::test(const btScalar angle) 158 { 159 m_correction = 0.0f; 160 m_sign = 0.0f; 161 m_solveLimit = false; 162 163 if (m_halfRange >= 0.0f) 164 { 165 btScalar deviation = btNormalizeAngle(angle - m_center); 166 if (deviation < -m_halfRange) 167 { 168 m_solveLimit = true; 169 m_correction = - (deviation + m_halfRange); 170 m_sign = +1.0f; 171 } 172 else if (deviation > m_halfRange) 173 { 174 m_solveLimit = true; 175 m_correction = m_halfRange - deviation; 176 m_sign = -1.0f; 177 } 178 } 179 } 180 181 182 btScalar btAngularLimit::getError() const 183 { 184 return m_correction * m_sign; 185 } 186 187 void btAngularLimit::fit(btScalar& angle) const 188 { 189 if (m_halfRange > 0.0f) 190 { 191 btScalar relativeAngle = btNormalizeAngle(angle - m_center); 192 if (!btEqual(relativeAngle, m_halfRange)) 193 { 194 if (relativeAngle > 0.0f) 195 { 196 angle = getHigh(); 197 } 198 else 199 { 200 angle = getLow(); 201 } 202 } 203 } 204 } 205 206 btScalar btAngularLimit::getLow() const 207 { 208 return btNormalizeAngle(m_center - m_halfRange); 209 } 210 211 btScalar btAngularLimit::getHigh() const 212 { 213 return btNormalizeAngle(m_center + m_halfRange); 214 } -
code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btTypedConstraint.h
r8351 r8393 14 14 */ 15 15 16 #ifndef TYPED_CONSTRAINT_H17 #define TYPED_CONSTRAINT_H16 #ifndef BT_TYPED_CONSTRAINT_H 17 #define BT_TYPED_CONSTRAINT_H 18 18 19 19 class btRigidBody; 20 20 #include "LinearMath/btScalar.h" 21 21 #include "btSolverConstraint.h" 22 #include "BulletCollision/NarrowPhaseCollision/btPersistentManifold.h"23 22 24 23 class btSerializer; 25 24 25 //Don't change any of the existing enum values, so add enum types at the end for serialization compatibility 26 26 enum btTypedConstraintType 27 27 { 28 POINT2POINT_CONSTRAINT_TYPE= MAX_CONTACT_MANIFOLD_TYPE+1,28 POINT2POINT_CONSTRAINT_TYPE=3, 29 29 HINGE_CONSTRAINT_TYPE, 30 30 CONETWIST_CONSTRAINT_TYPE, 31 31 D6_CONSTRAINT_TYPE, 32 32 SLIDER_CONSTRAINT_TYPE, 33 CONTACT_CONSTRAINT_TYPE 33 CONTACT_CONSTRAINT_TYPE, 34 D6_SPRING_CONSTRAINT_TYPE, 35 MAX_CONSTRAINT_TYPE 34 36 }; 35 37 … … 60 62 void* m_userConstraintPtr; 61 63 }; 64 65 btScalar m_breakingImpulseThreshold; 66 bool m_isEnabled; 67 62 68 63 69 bool m_needsFeedback; … … 154 160 } 155 161 162 163 btScalar getBreakingImpulseThreshold() const 164 { 165 return m_breakingImpulseThreshold; 166 } 167 168 void setBreakingImpulseThreshold(btScalar threshold) 169 { 170 m_breakingImpulseThreshold = threshold; 171 } 172 173 bool isEnabled() const 174 { 175 return m_isEnabled; 176 } 177 178 void setEnabled(bool enabled) 179 { 180 m_isEnabled=enabled; 181 } 182 183 156 184 ///internal method used by the constraint solver, don't use them directly 157 185 virtual void solveConstraintObsolete(btRigidBody& /*bodyA*/,btRigidBody& /*bodyB*/,btScalar /*timeStep*/) {}; … … 312 340 313 341 314 315 #endif //TYPED_CONSTRAINT_H 342 class btAngularLimit 343 { 344 private: 345 btScalar 346 m_center, 347 m_halfRange, 348 m_softness, 349 m_biasFactor, 350 m_relaxationFactor, 351 m_correction, 352 m_sign; 353 354 bool 355 m_solveLimit; 356 357 public: 358 /// Default constructor initializes limit as inactive, allowing free constraint movement 359 btAngularLimit() 360 :m_center(0.0f), 361 m_halfRange(-1.0f), 362 m_softness(0.9f), 363 m_biasFactor(0.3f), 364 m_relaxationFactor(1.0f), 365 m_correction(0.0f), 366 m_sign(0.0f), 367 m_solveLimit(false) 368 {} 369 370 /// Sets all limit's parameters. 371 /// When low > high limit becomes inactive. 372 /// When high - low > 2PI limit is ineffective too becouse no angle can exceed the limit 373 void set(btScalar low, btScalar high, btScalar _softness = 0.9f, btScalar _biasFactor = 0.3f, btScalar _relaxationFactor = 1.0f); 374 375 /// Checks conastaint angle against limit. If limit is active and the angle violates the limit 376 /// correction is calculated. 377 void test(const btScalar angle); 378 379 /// Returns limit's softness 380 inline btScalar getSoftness() const 381 { 382 return m_softness; 383 } 384 385 /// Returns limit's bias factor 386 inline btScalar getBiasFactor() const 387 { 388 return m_biasFactor; 389 } 390 391 /// Returns limit's relaxation factor 392 inline btScalar getRelaxationFactor() const 393 { 394 return m_relaxationFactor; 395 } 396 397 /// Returns correction value evaluated when test() was invoked 398 inline btScalar getCorrection() const 399 { 400 return m_correction; 401 } 402 403 /// Returns sign value evaluated when test() was invoked 404 inline btScalar getSign() const 405 { 406 return m_sign; 407 } 408 409 /// Gives half of the distance between min and max limit angle 410 inline btScalar getHalfRange() const 411 { 412 return m_halfRange; 413 } 414 415 /// Returns true when the last test() invocation recognized limit violation 416 inline bool isLimit() const 417 { 418 return m_solveLimit; 419 } 420 421 /// Checks given angle against limit. If limit is active and angle doesn't fit it, the angle 422 /// returned is modified so it equals to the limit closest to given angle. 423 void fit(btScalar& angle) const; 424 425 /// Returns correction value multiplied by sign value 426 btScalar getError() const; 427 428 btScalar getLow() const; 429 430 btScalar getHigh() const; 431 432 }; 433 434 435 436 #endif //BT_TYPED_CONSTRAINT_H -
code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btUniversalConstraint.cpp
r8351 r8393 62 62 } 63 63 64 void btUniversalConstraint::setAxis(const btVector3& axis1,const btVector3& axis2) 65 { 66 m_axis1 = axis1; 67 m_axis2 = axis2; 68 69 btVector3 zAxis = axis1.normalized(); 70 btVector3 yAxis = axis2.normalized(); 71 btVector3 xAxis = yAxis.cross(zAxis); // we want right coordinate system 72 73 btTransform frameInW; 74 frameInW.setIdentity(); 75 frameInW.getBasis().setValue( xAxis[0], yAxis[0], zAxis[0], 76 xAxis[1], yAxis[1], zAxis[1], 77 xAxis[2], yAxis[2], zAxis[2]); 78 frameInW.setOrigin(m_anchor); 79 80 // now get constraint frame in local coordinate systems 81 m_frameInA = m_rbA.getCenterOfMassTransform().inverse() * frameInW; 82 m_frameInB = m_rbB.getCenterOfMassTransform().inverse() * frameInW; 83 84 calculateTransforms(); 85 } 86 87 -
code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btUniversalConstraint.h
r8351 r8393 14 14 */ 15 15 16 #ifndef UNIVERSAL_CONSTRAINT_H17 #define UNIVERSAL_CONSTRAINT_H16 #ifndef BT_UNIVERSAL_CONSTRAINT_H 17 #define BT_UNIVERSAL_CONSTRAINT_H 18 18 19 19 … … 53 53 void setUpperLimit(btScalar ang1max, btScalar ang2max) { setAngularUpperLimit(btVector3(0.f, ang1max, ang2max)); } 54 54 void setLowerLimit(btScalar ang1min, btScalar ang2min) { setAngularLowerLimit(btVector3(0.f, ang1min, ang2min)); } 55 56 void setAxis( const btVector3& axis1, const btVector3& axis2); 55 57 }; 56 58 57 59 58 60 59 #endif // UNIVERSAL_CONSTRAINT_H61 #endif // BT_UNIVERSAL_CONSTRAINT_H 60 62 -
code/trunk/src/external/bullet/BulletDynamics/Dynamics/btDiscreteDynamicsWorld.cpp
r8351 r8393 36 36 #include "BulletDynamics/ConstraintSolver/btGeneric6DofConstraint.h" 37 37 #include "BulletDynamics/ConstraintSolver/btSliderConstraint.h" 38 #include "BulletDynamics/ConstraintSolver/btContactConstraint.h" 39 38 40 39 41 #include "LinearMath/btIDebugDraw.h" … … 46 48 47 49 #include "LinearMath/btSerializer.h" 50 51 #if 0 52 btAlignedObjectArray<btVector3> debugContacts; 53 btAlignedObjectArray<btVector3> debugNormals; 54 int startHit=2; 55 int firstHit=startHit; 56 #endif 48 57 49 58 … … 315 324 dispatchInfo.m_debugDraw = getDebugDrawer(); 316 325 326 317 327 ///perform collision detection 318 328 performDiscreteCollisionDetection(); 329 330 if (getDispatchInfo().m_useContinuous) 331 addSpeculativeContacts(timeStep); 332 319 333 320 334 calculateSimulationIslands(); … … 746 760 class btClosestNotMeConvexResultCallback : public btCollisionWorld::ClosestConvexResultCallback 747 761 { 762 public: 763 748 764 btCollisionObject* m_me; 749 765 btScalar m_allowedPenetration; 750 766 btOverlappingPairCache* m_pairCache; 751 767 btDispatcher* m_dispatcher; 752 753 768 754 769 public: … … 798 813 if (m_dispatcher->needsResponse(m_me,otherObj)) 799 814 { 815 #if 0 800 816 ///don't do CCD when there are already contact points (touching contact/penetration) 801 817 btAlignedObjectArray<btPersistentManifold*> manifoldArray; … … 815 831 } 816 832 } 817 } 818 return true; 833 #endif 834 return true; 835 } 836 837 return false; 819 838 } 820 839 … … 825 844 int gNumClampedCcdMotions=0; 826 845 827 //#include "stdio.h"828 846 void btDiscreteDynamicsWorld::integrateTransforms(btScalar timeStep) 829 847 { … … 837 855 if (body->isActive() && (!body->isStaticOrKinematicObject())) 838 856 { 857 858 body->predictIntegratedTransform(timeStep, predictedTrans); 859 860 btScalar squareMotion = (predictedTrans.getOrigin()-body->getWorldTransform().getOrigin()).length2(); 861 862 863 864 if (getDispatchInfo().m_useContinuous && body->getCcdSquareMotionThreshold() && body->getCcdSquareMotionThreshold() < squareMotion) 865 { 866 BT_PROFILE("CCD motion clamping"); 867 if (body->getCollisionShape()->isConvex()) 868 { 869 gNumClampedCcdMotions++; 870 #ifdef USE_STATIC_ONLY 871 class StaticOnlyCallback : public btClosestNotMeConvexResultCallback 872 { 873 public: 874 875 StaticOnlyCallback (btCollisionObject* me,const btVector3& fromA,const btVector3& toA,btOverlappingPairCache* pairCache,btDispatcher* dispatcher) : 876 btClosestNotMeConvexResultCallback(me,fromA,toA,pairCache,dispatcher) 877 { 878 } 879 880 virtual bool needsCollision(btBroadphaseProxy* proxy0) const 881 { 882 btCollisionObject* otherObj = (btCollisionObject*) proxy0->m_clientObject; 883 if (!otherObj->isStaticOrKinematicObject()) 884 return false; 885 return btClosestNotMeConvexResultCallback::needsCollision(proxy0); 886 } 887 }; 888 889 StaticOnlyCallback sweepResults(body,body->getWorldTransform().getOrigin(),predictedTrans.getOrigin(),getBroadphase()->getOverlappingPairCache(),getDispatcher()); 890 #else 891 btClosestNotMeConvexResultCallback sweepResults(body,body->getWorldTransform().getOrigin(),predictedTrans.getOrigin(),getBroadphase()->getOverlappingPairCache(),getDispatcher()); 892 #endif 893 //btConvexShape* convexShape = static_cast<btConvexShape*>(body->getCollisionShape()); 894 btSphereShape tmpSphere(body->getCcdSweptSphereRadius());//btConvexShape* convexShape = static_cast<btConvexShape*>(body->getCollisionShape()); 895 sweepResults.m_allowedPenetration=getDispatchInfo().m_allowedCcdPenetration; 896 897 sweepResults.m_collisionFilterGroup = body->getBroadphaseProxy()->m_collisionFilterGroup; 898 sweepResults.m_collisionFilterMask = body->getBroadphaseProxy()->m_collisionFilterMask; 899 btTransform modifiedPredictedTrans = predictedTrans; 900 modifiedPredictedTrans.setBasis(body->getWorldTransform().getBasis()); 901 902 convexSweepTest(&tmpSphere,body->getWorldTransform(),modifiedPredictedTrans,sweepResults); 903 if (sweepResults.hasHit() && (sweepResults.m_closestHitFraction < 1.f)) 904 { 905 906 //printf("clamped integration to hit fraction = %f\n",fraction); 907 body->setHitFraction(sweepResults.m_closestHitFraction); 908 body->predictIntegratedTransform(timeStep*body->getHitFraction(), predictedTrans); 909 body->setHitFraction(0.f); 910 body->proceedToTransform( predictedTrans); 911 912 #if 0 913 btVector3 linVel = body->getLinearVelocity(); 914 915 btScalar maxSpeed = body->getCcdMotionThreshold()/getSolverInfo().m_timeStep; 916 btScalar maxSpeedSqr = maxSpeed*maxSpeed; 917 if (linVel.length2()>maxSpeedSqr) 918 { 919 linVel.normalize(); 920 linVel*= maxSpeed; 921 body->setLinearVelocity(linVel); 922 btScalar ms2 = body->getLinearVelocity().length2(); 923 body->predictIntegratedTransform(timeStep, predictedTrans); 924 925 btScalar sm2 = (predictedTrans.getOrigin()-body->getWorldTransform().getOrigin()).length2(); 926 btScalar smt = body->getCcdSquareMotionThreshold(); 927 printf("sm2=%f\n",sm2); 928 } 929 #else 930 //response between two dynamic objects without friction, assuming 0 penetration depth 931 btScalar appliedImpulse = 0.f; 932 btScalar depth = 0.f; 933 appliedImpulse = resolveSingleCollision(body,sweepResults.m_hitCollisionObject,sweepResults.m_hitPointWorld,sweepResults.m_hitNormalWorld,getSolverInfo(), depth); 934 935 936 #endif 937 938 continue; 939 } 940 } 941 } 942 943 944 body->proceedToTransform( predictedTrans); 945 } 946 } 947 } 948 949 void btDiscreteDynamicsWorld::addSpeculativeContacts(btScalar timeStep) 950 { 951 BT_PROFILE("addSpeculativeContacts"); 952 btTransform predictedTrans; 953 for ( int i=0;i<m_nonStaticRigidBodies.size();i++) 954 { 955 btRigidBody* body = m_nonStaticRigidBodies[i]; 956 body->setHitFraction(1.f); 957 958 if (body->isActive() && (!body->isStaticOrKinematicObject())) 959 { 839 960 body->predictIntegratedTransform(timeStep, predictedTrans); 840 961 btScalar squareMotion = (predictedTrans.getOrigin()-body->getWorldTransform().getOrigin()).length2(); … … 842 963 if (body->getCcdSquareMotionThreshold() && body->getCcdSquareMotionThreshold() < squareMotion) 843 964 { 844 BT_PROFILE(" CCD motion clamping");965 BT_PROFILE("search speculative contacts"); 845 966 if (body->getCollisionShape()->isConvex()) 846 967 { … … 853 974 sweepResults.m_collisionFilterGroup = body->getBroadphaseProxy()->m_collisionFilterGroup; 854 975 sweepResults.m_collisionFilterMask = body->getBroadphaseProxy()->m_collisionFilterMask; 855 856 convexSweepTest(&tmpSphere,body->getWorldTransform(),predictedTrans,sweepResults); 976 btTransform modifiedPredictedTrans; 977 modifiedPredictedTrans = predictedTrans; 978 modifiedPredictedTrans.setBasis(body->getWorldTransform().getBasis()); 979 980 convexSweepTest(&tmpSphere,body->getWorldTransform(),modifiedPredictedTrans,sweepResults); 857 981 if (sweepResults.hasHit() && (sweepResults.m_closestHitFraction < 1.f)) 858 982 { 859 body->setHitFraction(sweepResults.m_closestHitFraction); 860 body->predictIntegratedTransform(timeStep*body->getHitFraction(), predictedTrans); 861 body->setHitFraction(0.f); 862 // printf("clamped integration to hit fraction = %f\n",fraction); 983 btBroadphaseProxy* proxy0 = body->getBroadphaseHandle(); 984 btBroadphaseProxy* proxy1 = sweepResults.m_hitCollisionObject->getBroadphaseHandle(); 985 btBroadphasePair* pair = sweepResults.m_pairCache->findPair(proxy0,proxy1); 986 if (pair) 987 { 988 if (pair->m_algorithm) 989 { 990 btManifoldArray contacts; 991 pair->m_algorithm->getAllContactManifolds(contacts); 992 if (contacts.size()) 993 { 994 btManifoldResult result(body,sweepResults.m_hitCollisionObject); 995 result.setPersistentManifold(contacts[0]); 996 997 btVector3 vec = (modifiedPredictedTrans.getOrigin()-body->getWorldTransform().getOrigin()); 998 vec*=sweepResults.m_closestHitFraction; 999 1000 btScalar lenSqr = vec.length2(); 1001 btScalar depth = 0.f; 1002 btVector3 pointWorld = sweepResults.m_hitPointWorld; 1003 if (lenSqr>SIMD_EPSILON) 1004 { 1005 depth = btSqrt(lenSqr); 1006 pointWorld -= vec; 1007 vec /= depth; 1008 } 1009 1010 if (contacts[0]->getBody0()==body) 1011 { 1012 result.addContactPoint(sweepResults.m_hitNormalWorld,pointWorld,depth); 1013 #if 0 1014 debugContacts.push_back(sweepResults.m_hitPointWorld);//sweepResults.m_hitPointWorld); 1015 debugNormals.push_back(sweepResults.m_hitNormalWorld); 1016 #endif 1017 } else 1018 { 1019 //swapped 1020 result.addContactPoint(-sweepResults.m_hitNormalWorld,pointWorld,depth); 1021 //sweepResults.m_hitPointWorld,depth); 1022 1023 #if 0 1024 if (1)//firstHit==1) 1025 { 1026 firstHit=0; 1027 debugNormals.push_back(sweepResults.m_hitNormalWorld); 1028 debugContacts.push_back(pointWorld);//sweepResults.m_hitPointWorld); 1029 debugNormals.push_back(sweepResults.m_hitNormalWorld); 1030 debugContacts.push_back(sweepResults.m_hitPointWorld); 1031 } 1032 firstHit--; 1033 #endif 1034 } 1035 } 1036 1037 } else 1038 { 1039 //no algorithm, use dispatcher to create one 1040 1041 } 1042 1043 1044 } else 1045 { 1046 //add an overlapping pair 1047 //printf("pair missing\n"); 1048 1049 } 863 1050 } 864 1051 } 865 1052 } 866 1053 867 body->proceedToTransform( predictedTrans);868 1054 } 869 1055 } … … 1010 1196 } 1011 1197 break; 1198 case D6_SPRING_CONSTRAINT_TYPE: 1012 1199 case D6_CONSTRAINT_TYPE: 1013 1200 { -
code/trunk/src/external/bullet/BulletDynamics/Dynamics/btDiscreteDynamicsWorld.h
r8351 r8393 63 63 virtual void integrateTransforms(btScalar timeStep); 64 64 65 virtual void addSpeculativeContacts(btScalar timeStep); 66 65 67 virtual void calculateSimulationIslands(); 66 68 -
code/trunk/src/external/bullet/BulletDynamics/Dynamics/btDynamicsWorld.h
r8351 r8393 33 33 BT_SIMPLE_DYNAMICS_WORLD=1, 34 34 BT_DISCRETE_DYNAMICS_WORLD=2, 35 BT_CONTINUOUS_DYNAMICS_WORLD=3 35 BT_CONTINUOUS_DYNAMICS_WORLD=3, 36 BT_SOFT_RIGID_DYNAMICS_WORLD=4 36 37 }; 37 38 … … 86 87 87 88 virtual void addRigidBody(btRigidBody* body) = 0; 89 90 virtual void addRigidBody(btRigidBody* body, short group, short mask) = 0; 88 91 89 92 virtual void removeRigidBody(btRigidBody* body) = 0; -
code/trunk/src/external/bullet/BulletDynamics/Dynamics/btRigidBody.cpp
r8351 r8393 52 52 m_totalForce.setValue(btScalar(0.0), btScalar(0.0), btScalar(0.0)); 53 53 m_totalTorque.setValue(btScalar(0.0), btScalar(0.0), btScalar(0.0)), 54 m_linearDamping = btScalar(0.);55 m_angularDamping = btScalar(0.5); 54 setDamping(constructionInfo.m_linearDamping, constructionInfo.m_angularDamping); 55 56 56 m_linearSleepingThreshold = constructionInfo.m_linearSleepingThreshold; 57 57 m_angularSleepingThreshold = constructionInfo.m_angularSleepingThreshold; … … 85 85 86 86 setMassProps(constructionInfo.m_mass, constructionInfo.m_localInertia); 87 setDamping(constructionInfo.m_linearDamping, constructionInfo.m_angularDamping);88 87 updateInertiaTensor(); 89 88 -
code/trunk/src/external/bullet/BulletDynamics/Dynamics/btRigidBody.h
r8351 r8393 14 14 */ 15 15 16 #ifndef RIGIDBODY_H17 #define RIGIDBODY_H16 #ifndef BT_RIGIDBODY_H 17 #define BT_RIGIDBODY_H 18 18 19 19 #include "LinearMath/btAlignedObjectArray.h" … … 90 90 91 91 int m_debugBodyId; 92 92 93 93 94 94 protected: … … 271 271 } 272 272 273 const btVector3& getTotalForce() 273 const btVector3& getTotalForce() const 274 274 { 275 275 return m_totalForce; 276 276 }; 277 277 278 const btVector3& getTotalTorque() 278 const btVector3& getTotalTorque() const 279 279 { 280 280 return m_totalTorque; … … 505 505 } 506 506 507 int getNumConstraintRefs() 507 int getNumConstraintRefs() const 508 508 { 509 509 return m_constraintRefs.size(); … … 618 618 619 619 void internalWritebackVelocity(btScalar timeStep); 620 620 621 621 622 … … 687 688 688 689 689 #endif 690 690 #endif //BT_RIGIDBODY_H 691 -
code/trunk/src/external/bullet/BulletDynamics/Dynamics/btSimpleDynamicsWorld.cpp
r8351 r8393 79 79 infoGlobal.m_timeStep = timeStep; 80 80 m_constraintSolver->prepareSolve(0,numManifolds); 81 m_constraintSolver->solveGroup( 0,0,manifoldPtr, numManifolds,0,0,infoGlobal,m_debugDrawer, m_stackAlloc,m_dispatcher1);81 m_constraintSolver->solveGroup(&getCollisionObjectArray()[0],getNumCollisionObjects(),manifoldPtr, numManifolds,0,0,infoGlobal,m_debugDrawer, m_stackAlloc,m_dispatcher1); 82 82 m_constraintSolver->allSolved(infoGlobal,m_debugDrawer, m_stackAlloc); 83 83 } … … 155 155 } 156 156 } 157 158 void btSimpleDynamicsWorld::addRigidBody(btRigidBody* body, short group, short mask) 159 { 160 body->setGravity(m_gravity); 161 162 if (body->getCollisionShape()) 163 { 164 addCollisionObject(body,group,mask); 165 } 166 } 167 168 169 void btSimpleDynamicsWorld::debugDrawWorld() 170 { 171 172 } 173 174 void btSimpleDynamicsWorld::addAction(btActionInterface* action) 175 { 176 177 } 178 179 void btSimpleDynamicsWorld::removeAction(btActionInterface* action) 180 { 181 182 } 183 157 184 158 185 void btSimpleDynamicsWorld::updateAabbs() -
code/trunk/src/external/bullet/BulletDynamics/Dynamics/btSimpleDynamicsWorld.h
r8351 r8393 57 57 virtual void addRigidBody(btRigidBody* body); 58 58 59 virtual void addRigidBody(btRigidBody* body, short group, short mask); 60 59 61 virtual void removeRigidBody(btRigidBody* body); 62 63 virtual void debugDrawWorld(); 64 65 virtual void addAction(btActionInterface* action); 66 67 virtual void removeAction(btActionInterface* action); 60 68 61 69 ///removeCollisionObject will first check if it is a rigid body, if so call removeRigidBody otherwise call btCollisionWorld::removeCollisionObject -
code/trunk/src/external/bullet/BulletDynamics/Vehicle/btRaycastVehicle.cpp
r8351 r8393 22 22 #include "LinearMath/btIDebugDraw.h" 23 23 #include "BulletDynamics/ConstraintSolver/btContactConstraint.h" 24 25 #define ROLLING_INFLUENCE_FIX 26 24 27 25 28 btRigidBody& btActionInterface::getFixedBody() … … 695 698 btVector3 sideImp = m_axle[wheel] * m_sideImpulse[wheel]; 696 699 700 #if defined ROLLING_INFLUENCE_FIX // fix. It only worked if car's up was along Y - VT. 701 btVector3 vChassisWorldUp = getRigidBody()->getCenterOfMassTransform().getBasis().getColumn(m_indexUpAxis); 702 rel_pos -= vChassisWorldUp * (vChassisWorldUp.dot(rel_pos) * (1.f-wheelInfo.m_rollInfluence)); 703 #else 697 704 rel_pos[m_indexUpAxis] *= wheelInfo.m_rollInfluence; 705 #endif 698 706 m_chassisBody->applyImpulse(sideImp,rel_pos); 699 707 -
code/trunk/src/external/bullet/BulletDynamics/Vehicle/btRaycastVehicle.h
r8351 r8393 9 9 * It is provided "as is" without express or implied warranty. 10 10 */ 11 #ifndef RAYCASTVEHICLE_H12 #define RAYCASTVEHICLE_H11 #ifndef BT_RAYCASTVEHICLE_H 12 #define BT_RAYCASTVEHICLE_H 13 13 14 14 #include "BulletDynamics/Dynamics/btRigidBody.h" … … 113 113 void updateWheelTransform( int wheelIndex, bool interpolatedTransform = true ); 114 114 115 void setRaycastWheelInfo( int wheelIndex , bool isInContact, const btVector3& hitPoint, const btVector3& hitNormal,btScalar depth);115 // void setRaycastWheelInfo( int wheelIndex , bool isInContact, const btVector3& hitPoint, const btVector3& hitNormal,btScalar depth); 116 116 117 117 btWheelInfo& addWheel( const btVector3& connectionPointCS0, const btVector3& wheelDirectionCS0,const btVector3& wheelAxleCS,btScalar suspensionRestLength,btScalar wheelRadius,const btVehicleTuning& tuning, bool isFrontWheel); … … 233 233 234 234 235 #endif // RAYCASTVEHICLE_H236 235 #endif //BT_RAYCASTVEHICLE_H 236 -
code/trunk/src/external/bullet/BulletDynamics/Vehicle/btVehicleRaycaster.h
r5781 r8393 1 1 /* 2 * Copyright (c) 2005 Erwin Coumans http:// continuousphysics.com/Bullet/2 * Copyright (c) 2005 Erwin Coumans http://bulletphysics.org 3 3 * 4 4 * Permission to use, copy, modify, distribute and sell this software … … 9 9 * It is provided "as is" without express or implied warranty. 10 10 */ 11 #ifndef VEHICLE_RAYCASTER_H12 #define VEHICLE_RAYCASTER_H11 #ifndef BT_VEHICLE_RAYCASTER_H 12 #define BT_VEHICLE_RAYCASTER_H 13 13 14 14 #include "LinearMath/btVector3.h" … … 32 32 }; 33 33 34 #endif // VEHICLE_RAYCASTER_H34 #endif //BT_VEHICLE_RAYCASTER_H 35 35 -
code/trunk/src/external/bullet/BulletDynamics/Vehicle/btWheelInfo.h
r8351 r8393 9 9 * It is provided "as is" without express or implied warranty. 10 10 */ 11 #ifndef WHEEL_INFO_H12 #define WHEEL_INFO_H11 #ifndef BT_WHEEL_INFO_H 12 #define BT_WHEEL_INFO_H 13 13 14 14 #include "LinearMath/btVector3.h" … … 116 116 }; 117 117 118 #endif // WHEEL_INFO_H118 #endif //BT_WHEEL_INFO_H 119 119
Note: See TracChangeset
for help on using the changeset viewer.