Changeset 8351 for code/trunk/src/external/bullet/BulletDynamics/Vehicle
- Timestamp:
- Apr 28, 2011, 7:15:14 AM (14 years ago)
- Location:
- code/trunk/src/external/bullet/BulletDynamics/Vehicle
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/external/bullet/BulletDynamics/Vehicle/btRaycastVehicle.cpp
r5781 r8351 23 23 #include "BulletDynamics/ConstraintSolver/btContactConstraint.h" 24 24 25 static btRigidBody s_fixedObject( 0,0,0); 25 btRigidBody& btActionInterface::getFixedBody() 26 { 27 static btRigidBody s_fixed(0, 0,0); 28 s_fixed.setMassProps(btScalar(0.),btVector3(btScalar(0.),btScalar(0.),btScalar(0.))); 29 return s_fixed; 30 } 26 31 27 32 btRaycastVehicle::btRaycastVehicle(const btVehicleTuning& tuning,btRigidBody* chassis, btVehicleRaycaster* raycaster ) … … 71 76 ci.m_bIsFrontWheel = isFrontWheel; 72 77 ci.m_maxSuspensionTravelCm = tuning.m_maxSuspensionTravelCm; 78 ci.m_maxSuspensionForce = tuning.m_maxSuspensionForce; 73 79 74 80 m_wheelInfo.push_back( btWheelInfo(ci)); … … 187 193 wheel.m_raycastInfo.m_isInContact = true; 188 194 189 wheel.m_raycastInfo.m_groundObject = & s_fixedObject;///@todo for driving on dynamic/movable objects!;195 wheel.m_raycastInfo.m_groundObject = &getFixedBody();///@todo for driving on dynamic/movable objects!; 190 196 //wheel.m_raycastInfo.m_groundObject = object; 191 197 … … 302 308 btScalar suspensionForce = wheel.m_wheelsSuspensionForce; 303 309 304 btScalar gMaxSuspensionForce = btScalar(6000.); 305 if (suspensionForce > gMaxSuspensionForce) 306 { 307 suspensionForce = gMaxSuspensionForce; 310 if (suspensionForce > wheel.m_maxSuspensionForce) 311 { 312 suspensionForce = wheel.m_maxSuspensionForce; 308 313 } 309 314 btVector3 impulse = wheel.m_raycastInfo.m_contactNormalWS * suspensionForce * step; … … 690 695 btVector3 sideImp = m_axle[wheel] * m_sideImpulse[wheel]; 691 696 692 rel_pos[m_index ForwardAxis] *= wheelInfo.m_rollInfluence;697 rel_pos[m_indexUpAxis] *= wheelInfo.m_rollInfluence; 693 698 m_chassisBody->applyImpulse(sideImp,rel_pos); 694 699 … … 709 714 for (int v=0;v<this->getNumWheels();v++) 710 715 { 711 btVector3 wheelColor(0, 255,255);716 btVector3 wheelColor(0,1,1); 712 717 if (getWheelInfo(v).m_raycastInfo.m_isInContact) 713 718 { 714 wheelColor.setValue(0,0, 255);719 wheelColor.setValue(0,0,1); 715 720 } else 716 721 { 717 wheelColor.setValue( 255,0,255);722 wheelColor.setValue(1,0,1); 718 723 } 719 724 -
code/trunk/src/external/bullet/BulletDynamics/Vehicle/btRaycastVehicle.h
r5781 r8351 30 30 btAlignedObjectArray<btScalar> m_forwardImpulse; 31 31 btAlignedObjectArray<btScalar> m_sideImpulse; 32 33 ///backwards compatibility 34 int m_userConstraintType; 35 int m_userConstraintId; 32 36 33 37 public: … … 41 45 m_suspensionDamping(btScalar(0.88)), 42 46 m_maxSuspensionTravelCm(btScalar(500.)), 43 m_frictionSlip(btScalar(10.5)) 47 m_frictionSlip(btScalar(10.5)), 48 m_maxSuspensionForce(btScalar(6000.)) 44 49 { 45 50 } … … 49 54 btScalar m_maxSuspensionTravelCm; 50 55 btScalar m_frictionSlip; 56 btScalar m_maxSuspensionForce; 51 57 52 58 }; … … 79 85 virtual void updateAction( btCollisionWorld* collisionWorld, btScalar step) 80 86 { 87 (void) collisionWorld; 81 88 updateVehicle(step); 82 89 } … … 189 196 190 197 198 ///backwards compatibility 199 int getUserConstraintType() const 200 { 201 return m_userConstraintType ; 202 } 203 204 void setUserConstraintType(int userConstraintType) 205 { 206 m_userConstraintType = userConstraintType; 207 }; 208 209 void setUserConstraintId(int uid) 210 { 211 m_userConstraintId = uid; 212 } 213 214 int getUserConstraintId() const 215 { 216 return m_userConstraintId; 217 } 191 218 192 219 }; -
code/trunk/src/external/bullet/BulletDynamics/Vehicle/btWheelInfo.h
r5781 r8351 30 30 btScalar m_wheelsDampingRelaxation; 31 31 btScalar m_frictionSlip; 32 btScalar m_maxSuspensionForce; 32 33 bool m_bIsFrontWheel; 33 34 … … 69 70 btScalar m_deltaRotation; 70 71 btScalar m_rollInfluence; 72 btScalar m_maxSuspensionForce; 71 73 72 74 btScalar m_engineForce; … … 100 102 m_rollInfluence = btScalar(0.1); 101 103 m_bIsFrontWheel = ci.m_bIsFrontWheel; 104 m_maxSuspensionForce = ci.m_maxSuspensionForce; 102 105 103 106 }
Note: See TracChangeset
for help on using the changeset viewer.