39 lines
949 B

  1. #include "../Include/LolBtPhysicsIntegration.h"
  2. #include "../Include/LolPhysics.h"
  3. #include "../Include/EasyConstraint.h"
  4. namespace lol
  5. {
  6. namespace phys
  7. {
  8. #ifdef HAVE_PHYS_USE_BULLET
  9. //-------------------------------------------------------------------------
  10. //EASY_CONSTRAINT
  11. //--
  12. void EasyConstraint::AddToSimulation(class Simulation* current_simulation)
  13. {
  14. btDiscreteDynamicsWorld* dynamics_world = current_simulation->GetWorld();
  15. if (dynamics_world && m_typed_constraint)
  16. {
  17. dynamics_world->addConstraint(m_typed_constraint, m_disable_a2b_collision);
  18. current_simulation->AddToConstraint(this);
  19. }
  20. }
  21. void EasyConstraint::RemoveFromSimulation(class Simulation* current_simulation)
  22. {
  23. btDiscreteDynamicsWorld* dynamics_world = current_simulation->GetWorld();
  24. if (dynamics_world, m_typed_constraint)
  25. dynamics_world->removeConstraint(m_typed_constraint);
  26. }
  27. #endif // HAVE_PHYS_USE_BULLET
  28. } /* namespace phys */
  29. } /* namespace lol */