JointFixed.cpp 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. #include "StdAfx.h"
  2. #include <ode/ode.h>
  3. #include "jointfixed.h"
  4. namespace ODEManaged
  5. {
  6. //Constructors
  7. JointFixed::JointFixed(void) : Joint(){}
  8. JointFixed::JointFixed(World &world)
  9. {
  10. if(this->_id) dJointDestroy(this->_id);
  11. _id = dJointCreateFixed(world.Id(),0);
  12. }
  13. JointFixed::JointFixed(World &world, JointGroup &jointGroup)
  14. {
  15. if(this->_id) dJointDestroy(this->_id);
  16. _id = dJointCreateFixed(world.Id(), jointGroup.Id());
  17. }
  18. //Destructor
  19. JointFixed::~JointFixed(void){}
  20. //Methods
  21. //Overloaded Create
  22. void JointFixed::Create(World &world, JointGroup &jointGroup)
  23. {
  24. if(this->_id) dJointDestroy(this->_id);
  25. _id = dJointCreateFixed(world.Id(), jointGroup.Id());
  26. }
  27. void JointFixed::Create(World &world)
  28. {
  29. if(this->_id) dJointDestroy(this->_id);
  30. _id = dJointCreateFixed(world.Id(), 0);
  31. }
  32. //Overloaded Attach
  33. void JointFixed::Attach(Body &body1, Body &body2)
  34. {
  35. dJointAttach(this->_id, body1.Id(), body2.Id());
  36. }
  37. void JointFixed::Attach(Body &body1)
  38. {
  39. dJointAttach(this->_id, body1.Id(), 0);
  40. }
  41. //Fixed
  42. void JointFixed::SetFixed(void)
  43. {
  44. dJointSetFixed(this->_id);
  45. }
  46. }