Changeset 8351 for code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btContactConstraint.h
- Timestamp:
- Apr 28, 2011, 7:15:14 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btContactConstraint.h
r5781 r8351 17 17 #define CONTACT_CONSTRAINT_H 18 18 19 ///@todo: make into a proper class working with the iterative constraint solver 19 #include "LinearMath/btVector3.h" 20 #include "btJacobianEntry.h" 21 #include "btTypedConstraint.h" 22 #include "BulletCollision/NarrowPhaseCollision/btPersistentManifold.h" 20 23 21 class btRigidBody; 22 #include "LinearMath/btVector3.h" 23 #include "LinearMath/btScalar.h" 24 struct btContactSolverInfo; 25 class btManifoldPoint; 24 ///btContactConstraint can be automatically created to solve contact constraints using the unified btTypedConstraint interface 25 ATTRIBUTE_ALIGNED16(class) btContactConstraint : public btTypedConstraint 26 { 27 protected: 26 28 27 enum { 28 DEFAULT_CONTACT_SOLVER_TYPE=0, 29 CONTACT_SOLVER_TYPE1, 30 CONTACT_SOLVER_TYPE2, 31 USER_CONTACT_SOLVER_TYPE1, 32 MAX_CONTACT_SOLVER_TYPES 29 btPersistentManifold m_contactManifold; 30 31 public: 32 33 34 btContactConstraint(btPersistentManifold* contactManifold,btRigidBody& rbA,btRigidBody& rbB); 35 36 void setContactManifold(btPersistentManifold* contactManifold); 37 38 btPersistentManifold* getContactManifold() 39 { 40 return &m_contactManifold; 41 } 42 43 const btPersistentManifold* getContactManifold() const 44 { 45 return &m_contactManifold; 46 } 47 48 virtual ~btContactConstraint(); 49 50 virtual void getInfo1 (btConstraintInfo1* info); 51 52 virtual void getInfo2 (btConstraintInfo2* info); 53 54 ///obsolete methods 55 virtual void buildJacobian(); 56 57 33 58 }; 34 59 35 60 36 typedef btScalar (*ContactSolverFunc)(btRigidBody& body1, 37 btRigidBody& body2, 38 class btManifoldPoint& contactPoint, 39 const btContactSolverInfo& info); 40 41 ///stores some extra information to each contact point. It is not in the contact point, because that want to keep the collision detection independent from the constraint solver. 42 struct btConstraintPersistentData 43 { 44 inline btConstraintPersistentData() 45 :m_appliedImpulse(btScalar(0.)), 46 m_prevAppliedImpulse(btScalar(0.)), 47 m_accumulatedTangentImpulse0(btScalar(0.)), 48 m_accumulatedTangentImpulse1(btScalar(0.)), 49 m_jacDiagABInv(btScalar(0.)), 50 m_persistentLifeTime(0), 51 m_restitution(btScalar(0.)), 52 m_friction(btScalar(0.)), 53 m_penetration(btScalar(0.)), 54 m_contactSolverFunc(0), 55 m_frictionSolverFunc(0) 56 { 57 } 58 59 60 /// total applied impulse during most recent frame 61 btScalar m_appliedImpulse; 62 btScalar m_prevAppliedImpulse; 63 btScalar m_accumulatedTangentImpulse0; 64 btScalar m_accumulatedTangentImpulse1; 65 66 btScalar m_jacDiagABInv; 67 btScalar m_jacDiagABInvTangent0; 68 btScalar m_jacDiagABInvTangent1; 69 int m_persistentLifeTime; 70 btScalar m_restitution; 71 btScalar m_friction; 72 btScalar m_penetration; 73 btVector3 m_frictionWorldTangential0; 74 btVector3 m_frictionWorldTangential1; 75 76 btVector3 m_frictionAngularComponent0A; 77 btVector3 m_frictionAngularComponent0B; 78 btVector3 m_frictionAngularComponent1A; 79 btVector3 m_frictionAngularComponent1B; 80 81 //some data doesn't need to be persistent over frames: todo: clean/reuse this 82 btVector3 m_angularComponentA; 83 btVector3 m_angularComponentB; 84 85 ContactSolverFunc m_contactSolverFunc; 86 ContactSolverFunc m_frictionSolverFunc; 87 88 }; 89 90 ///bilateral constraint between two dynamic objects 91 ///positive distance = separation, negative distance = penetration 61 ///resolveSingleBilateral is an obsolete methods used for vehicle friction between two dynamic objects 92 62 void resolveSingleBilateral(btRigidBody& body1, const btVector3& pos1, 93 63 btRigidBody& body2, const btVector3& pos2, … … 95 65 96 66 97 ///contact constraint resolution:98 ///calculate and apply impulse to satisfy non-penetration and non-negative relative velocity constraint99 ///positive distance = separation, negative distance = penetration100 btScalar resolveSingleCollision(101 btRigidBody& body1,102 btRigidBody& body2,103 btManifoldPoint& contactPoint,104 const btContactSolverInfo& info);105 106 btScalar resolveSingleFriction(107 btRigidBody& body1,108 btRigidBody& body2,109 btManifoldPoint& contactPoint,110 const btContactSolverInfo& solverInfo111 );112 113 114 115 btScalar resolveSingleCollisionCombined(116 btRigidBody& body1,117 btRigidBody& body2,118 btManifoldPoint& contactPoint,119 const btContactSolverInfo& solverInfo120 );121 67 122 68 #endif //CONTACT_CONSTRAINT_H
Note: See TracChangeset
for help on using the changeset viewer.