Changeset 2882 for code/trunk/src/bullet/BulletDynamics/Vehicle
- Timestamp:
- Mar 31, 2009, 8:05:51 PM (16 years ago)
- Location:
- code/trunk/src/bullet/BulletDynamics/Vehicle
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/bullet/BulletDynamics/Vehicle/btRaycastVehicle.cpp
r2662 r2882 20 20 #include "btWheelInfo.h" 21 21 #include "LinearMath/btMinMax.h" 22 23 22 #include "LinearMath/btIDebugDraw.h" 24 23 #include "BulletDynamics/ConstraintSolver/btContactConstraint.h" 25 24 … … 27 26 28 27 btRaycastVehicle::btRaycastVehicle(const btVehicleTuning& tuning,btRigidBody* chassis, btVehicleRaycaster* raycaster ) 29 : btTypedConstraint(VEHICLE_CONSTRAINT_TYPE), 30 m_vehicleRaycaster(raycaster), 28 :m_vehicleRaycaster(raycaster), 31 29 m_pitchControl(btScalar(0.)) 32 30 { … … 88 86 const btTransform& btRaycastVehicle::getWheelTransformWS( int wheelIndex ) const 89 87 { 90 assert(wheelIndex < getNumWheels());88 btAssert(wheelIndex < getNumWheels()); 91 89 const btWheelInfo& wheel = m_wheelInfo[wheelIndex]; 92 90 return wheel.m_worldTransform; … … 176 174 btVehicleRaycaster::btVehicleRaycasterResult rayResults; 177 175 178 assert(m_vehicleRaycaster);176 btAssert(m_vehicleRaycaster); 179 177 180 178 void* object = m_vehicleRaycaster->castRay(source,target,rayResults); … … 360 358 void btRaycastVehicle::setSteeringValue(btScalar steering,int wheel) 361 359 { 362 assert(wheel>=0 && wheel < getNumWheels());360 btAssert(wheel>=0 && wheel < getNumWheels()); 363 361 364 362 btWheelInfo& wheelInfo = getWheelInfo(wheel); … … 376 374 void btRaycastVehicle::applyEngineForce(btScalar force, int wheel) 377 375 { 378 assert(wheel>=0 && wheel < getNumWheels());376 btAssert(wheel>=0 && wheel < getNumWheels()); 379 377 btWheelInfo& wheelInfo = getWheelInfo(wheel); 380 378 wheelInfo.m_engineForce = force; … … 705 703 706 704 705 706 void btRaycastVehicle::debugDraw(btIDebugDraw* debugDrawer) 707 { 708 709 for (int v=0;v<this->getNumWheels();v++) 710 { 711 btVector3 wheelColor(0,255,255); 712 if (getWheelInfo(v).m_raycastInfo.m_isInContact) 713 { 714 wheelColor.setValue(0,0,255); 715 } else 716 { 717 wheelColor.setValue(255,0,255); 718 } 719 720 btVector3 wheelPosWS = getWheelInfo(v).m_worldTransform.getOrigin(); 721 722 btVector3 axle = btVector3( 723 getWheelInfo(v).m_worldTransform.getBasis()[0][getRightAxis()], 724 getWheelInfo(v).m_worldTransform.getBasis()[1][getRightAxis()], 725 getWheelInfo(v).m_worldTransform.getBasis()[2][getRightAxis()]); 726 727 //debug wheels (cylinders) 728 debugDrawer->drawLine(wheelPosWS,wheelPosWS+axle,wheelColor); 729 debugDrawer->drawLine(wheelPosWS,getWheelInfo(v).m_raycastInfo.m_contactPointWS,wheelColor); 730 731 } 732 } 733 734 707 735 void* btDefaultVehicleRaycaster::castRay(const btVector3& from,const btVector3& to, btVehicleRaycasterResult& result) 708 736 { … … 728 756 return 0; 729 757 } 758 -
code/trunk/src/bullet/BulletDynamics/Vehicle/btRaycastVehicle.h
r2662 r2882 18 18 #include "LinearMath/btAlignedObjectArray.h" 19 19 #include "btWheelInfo.h" 20 #include "BulletDynamics/Dynamics/btActionInterface.h" 20 21 21 22 class btVehicleTuning; 22 23 23 24 ///rayCast vehicle, very special constraint that turn a rigidbody into a vehicle. 24 class btRaycastVehicle : public bt TypedConstraint25 class btRaycastVehicle : public btActionInterface 25 26 { 26 27 … … 74 75 virtual ~btRaycastVehicle() ; 75 76 76 77 78 ///btActionInterface interface 79 virtual void updateAction( btCollisionWorld* collisionWorld, btScalar step) 80 { 81 updateVehicle(step); 82 } 83 84 85 ///btActionInterface interface 86 void debugDraw(btIDebugDraw* debugDrawer); 87 77 88 const btTransform& getChassisWorldTransform() const; 78 89 … … 80 91 81 92 virtual void updateVehicle(btScalar step); 82 93 94 83 95 void resetSuspension(); 84 96 … … 176 188 } 177 189 178 virtual void buildJacobian()179 {180 //not yet181 }182 183 virtual void solveConstraint(btScalar timeStep)184 {185 (void)timeStep;186 //not yet187 }188 190 189 191
Note: See TracChangeset
for help on using the changeset viewer.