bullet_glue.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. #ifndef BB_BULLET_H
  2. #define BB_BULLET_H
  3. #include "btBulletDynamicsCommon.h"
  4. namespace bbBullet{
  5. btVector3 calculateLocalInertia( btCollisionShape *self,btScalar mass );
  6. btTransform getWorldTransform( btMotionState *self );
  7. struct Point2PointConstraint : public btPoint2PointConstraint{
  8. Point2PointConstraint(btRigidBody* rbA,btRigidBody* rbB, const btVector3& pivotInA,const btVector3& pivotInB):
  9. btPoint2PointConstraint(*rbA,*rbB,pivotInA,pivotInB){}
  10. Point2PointConstraint(btRigidBody* rbA,const btVector3& pivotInA):
  11. btPoint2PointConstraint(*rbA,pivotInA){}
  12. };
  13. struct MotionState : public btMotionState{
  14. virtual void setWorldTransform( btTransform *worldTrans ){
  15. }
  16. virtual void getWorldTransform( btTransform *worldTrans ){
  17. }
  18. virtual void setWorldTransform( const btTransform &worldTrans ){
  19. this->setWorldTransform( const_cast<btTransform*>( &worldTrans ) );
  20. }
  21. virtual void getWorldTransform( btTransform &worldTrans )const{
  22. const_cast<MotionState*>( this )->getWorldTransform( &worldTrans );
  23. }
  24. };
  25. struct DefaultMotionState : public btDefaultMotionState{
  26. DefaultMotionState(){
  27. }
  28. DefaultMotionState( const btTransform &startTrans,const btTransform &centerOfMassOffset ):btDefaultMotionState( startTrans,centerOfMassOffset ){
  29. }
  30. void setWorldTransform( btTransform *worldTrans ){
  31. btDefaultMotionState::setWorldTransform( *worldTrans );
  32. }
  33. void getWorldTransform( btTransform *worldTrans ){
  34. btDefaultMotionState::getWorldTransform( *worldTrans );
  35. }
  36. };
  37. void rayTest( btCollisionWorld *self,
  38. const btVector3 &rayFromWorld,
  39. const btVector3 &rayToWorld,
  40. btCollisionWorld::RayResultCallback *result );
  41. void convexSweepTest( btCollisionWorld *self,
  42. const btConvexShape *castShape,
  43. const btTransform &castFrom,
  44. const btTransform &castTo,
  45. btCollisionWorld::ConvexResultCallback *result,
  46. btScalar allowedCcdPenetration );
  47. }
  48. #endif