Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Apr 21st, 2012  |  syntax: None  |  size: 1.86 KB  |  views: 101  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. void ConvertPosToBull(const Vector& pos, btVector3& bull) {
  2.         bull.setX(HL2BULL(pos.x));
  3.         bull.setY(HL2BULL(pos.z));
  4.         bull.setZ(-HL2BULL(pos.y));
  5. }
  6.  
  7. void ConvertPosToHL(const btVector3& pos, Vector& hl) {
  8.         hl.x = BULL2HL(pos.x());
  9.         hl.y = -BULL2HL(pos.z());
  10.         hl.z = BULL2HL(pos.y());
  11. }
  12.  
  13. void ConvertDirectionToBull(const Vector& dir, btVector3& bull) {
  14.         bull.setX(dir.x);
  15.         bull.setY(dir.z);
  16.         bull.setZ(-dir.y);
  17. }
  18.  
  19. void ConvertDirectionToHL(const btVector3& dir, Vector& hl) {
  20.         hl.x = dir.x();
  21.         hl.y = -dir.z();
  22.         hl.z = dir.y();
  23. }
  24.  
  25. void ConvertRotationToBull(const QAngle& angles, btMatrix3x3& bull) {
  26.         RadianEuler radian(angles);
  27.         btQuaternion q1;
  28.         q1.setEulerZYX(radian.z, radian.y, radian.x);
  29.         btQuaternion q2(q1.getX(), q1.getZ(), -q1.getY(), q1.getW());
  30.         bull.setRotation(q2);
  31. }
  32.  
  33. void ConvertRotationToBull(const QAngle& angles, btQuaternion& bull) {
  34.         RadianEuler radian(angles);
  35.         btQuaternion q;
  36.         q.setEulerZYX(radian.z, radian.y, radian.x);
  37.         bull.setX(q.getX());
  38.         bull.setY(q.getZ());
  39.         bull.setZ(-q.getY());
  40.         bull.setW(q.getW());
  41. }
  42.  
  43. void ConvertRotationToHL(const btMatrix3x3& matrix, QAngle& hl) {
  44.         btQuaternion quat;
  45.         matrix.getRotation(quat);
  46.         Quaternion q(quat.getX(), -quat.getZ(), quat.getY(), quat.getW());
  47.         RadianEuler radian(q);
  48.         hl = radian.ToQAngle();
  49. }
  50.  
  51. void ConvertRotationToHL(const btQuaternion& quat, QAngle& hl)
  52. {
  53.         Quaternion q(quat.getX(), -quat.getZ(), quat.getY(), quat.getW());
  54.         RadianEuler radian(q);
  55.         hl = radian.ToQAngle();
  56. }
  57.  
  58.  
  59. void ConvertAngularImpulseToBull(const AngularImpulse& angularimp, btVector3& bull) {
  60.         bull.setX(DEG2RAD(angularimp.x));
  61.         bull.setY(DEG2RAD(angularimp.z));
  62.         bull.setZ(-DEG2RAD(angularimp.y));
  63. }
  64.  
  65. void ConvertAngularImpulseToHL(const btVector3& angularimp, AngularImpulse& hl) {
  66.         hl.x = RAD2DEG(angularimp.x());
  67.         hl.y = -RAD2DEG(angularimp.z());
  68.         hl.z = RAD2DEG(angularimp.y());
  69. }
clone this paste RAW Paste Data