source: trunk/test/Physics/Src/EasyConstraint.cpp @ 1782

Last change on this file since 1782 was 1782, checked in by touky, 8 years ago

Small physic refactor.

File size: 1.1 KB
Line 
1
2#if defined HAVE_CONFIG_H
3#   include "config.h"
4#endif
5
6#include "../Include/LolBtPhysicsIntegration.h"
7#include "../Include/LolPhysics.h"
8#include "../Include/EasyConstraint.h"
9
10namespace lol
11{
12
13namespace phys
14{
15
16#ifdef HAVE_PHYS_USE_BULLET
17
18//-------------------------------------------------------------------------
19//EASY_CONSTRAINT
20//--
21
22void EasyConstraint::AddToSimulation(class Simulation* current_simulation)
23{
24        btDiscreteDynamicsWorld* dynamics_world = current_simulation->GetWorld();
25        if (dynamics_world && m_typed_constraint)
26        {
27                dynamics_world->addConstraint(m_typed_constraint, m_disable_a2b_collision);
28                current_simulation->ObjectRegistration(true, this);
29        }
30}
31
32void EasyConstraint::RemoveFromSimulation(class Simulation* current_simulation)
33{
34        btDiscreteDynamicsWorld* dynamics_world = current_simulation->GetWorld();
35        if (dynamics_world && m_typed_constraint)
36        {
37                dynamics_world->removeConstraint(m_typed_constraint);
38                current_simulation->ObjectRegistration(false, this);
39        }
40}
41
42#endif // HAVE_PHYS_USE_BULLET
43
44} /* namespace phys */
45
46} /* namespace lol */
Note: See TracBrowser for help on using the repository browser.