55 lines
1.4 KiB

  1. //
  2. // Lol Engine
  3. //
  4. // Copyright: (c) 2010-2012 Sam Hocevar <sam@hocevar.net>
  5. // (c) 2009-2012 Cédric Lecacheur <jordx@free.fr>
  6. // (c) 2009-2012 Benjamin Huet <huet.benjamin@gmail.com>
  7. // This program is free software; you can redistribute it and/or
  8. // modify it under the terms of the Do What The Fuck You Want To
  9. // Public License, Version 2, as published by Sam Hocevar. See
  10. // http://sam.zoy.org/projects/COPYING.WTFPL for more details.
  11. //
  12. #if defined HAVE_CONFIG_H
  13. # include "config.h"
  14. #endif
  15. #ifdef HAVE_PHYS_USE_BULLET
  16. #include "../Include/EasyConstraint.h"
  17. #endif //HAVE_PHYS_USE_BULLET
  18. namespace lol
  19. {
  20. namespace phys
  21. {
  22. #ifdef HAVE_PHYS_USE_BULLET
  23. //-------------------------------------------------------------------------
  24. //EASY_CONSTRAINT
  25. //--
  26. void EasyConstraint::AddToSimulation(class Simulation* current_simulation)
  27. {
  28. btDiscreteDynamicsWorld* dynamics_world = current_simulation->GetWorld();
  29. if (dynamics_world && m_typed_constraint)
  30. {
  31. dynamics_world->addConstraint(m_typed_constraint, m_disable_a2b_collision);
  32. current_simulation->AddToConstraint(this);
  33. }
  34. }
  35. void EasyConstraint::RemoveFromSimulation(class Simulation* current_simulation)
  36. {
  37. btDiscreteDynamicsWorld* dynamics_world = current_simulation->GetWorld();
  38. if (dynamics_world, m_typed_constraint)
  39. dynamics_world->removeConstraint(m_typed_constraint);
  40. }
  41. #endif // HAVE_PHYS_USE_BULLET
  42. } /* namespace phys */
  43. } /* namespace lol */