dynamics3d_floor_plugin.cpp
Go to the documentation of this file.
1 
8 
9 namespace argos {
10 
11  /****************************************/
12  /****************************************/
13 
15  /* Get the friction of the floor */
16  m_fFriction = m_pcEngine->GetDefaultFriction();
17  GetNodeAttributeOrDefault(t_tree, "friction", m_fFriction, m_fFriction);
18  /* Call the destructor for the floor body */
19  m_cFloor.~btRigidBody();
20  /* Call the constructor for the floor body */
21  btRigidBody::btRigidBodyConstructionInfo sConstructionInfo(0, nullptr, &m_cFloorShape);
22  sConstructionInfo.m_friction = m_fFriction;
23  /* Create the floor */
24  new (&m_cFloor) btRigidBody(sConstructionInfo);
25  m_cFloor.setUserPointer(nullptr);
26  m_cFloor.getWorldTransform().setOrigin(m_cFloorOrigin);
27  /* Add floor to world */
28  m_pcEngine->GetWorld().addRigidBody(&m_cFloor);
29  }
30 
31  /****************************************/
32  /****************************************/
33 
35  /* Remove floor from world */
36  m_pcEngine->GetWorld().removeRigidBody(&m_cFloor);
37  /* Call the destructor for the floor body */
38  m_cFloor.~btRigidBody();
39  /* Call the constructor for the floor body */
40  btRigidBody::btRigidBodyConstructionInfo sConstructionInfo(0, nullptr, &m_cFloorShape);
41  sConstructionInfo.m_friction = m_fFriction;
42  /* Create the floor */
43  new (&m_cFloor) btRigidBody(sConstructionInfo);
44  m_cFloor.setUserPointer(nullptr);
45  m_cFloor.getWorldTransform().setOrigin(m_cFloorOrigin);
46  /* Add floor to world */
47  m_pcEngine->GetWorld().addRigidBody(&m_cFloor);
48  }
49 
50  /****************************************/
51  /****************************************/
52 
54  /* Remove floor from world */
55  m_pcEngine->GetWorld().removeRigidBody(&m_cFloor);
56  }
57 
58  /****************************************/
59  /****************************************/
60 
62  "floor",
63  "Michael Allwright [allsey87@gmail.com]",
64  "1.0",
65  "Inserts a floor into the 3D dynamics engine",
66  "For a description on how to use this plugin, please consult the documentation\n"
67  "for the dynamics3d physics engine plugin",
68  "Usable");
69 
70  /****************************************/
71  /****************************************/
72 
73 }
The namespace containing all the ARGoS related code.
Definition: ci_actuator.h:12
REGISTER_DYNAMICS3D_PLUGIN(CDynamics3DFloorPlugin, "floor", "Michael Allwright [allsey87@gmail.com]", "1.0", "Inserts a floor into the 3D dynamics engine", "For a description on how to use this plugin, please consult the documentation\n" "for the dynamics3d physics engine plugin", "Usable")
void GetNodeAttributeOrDefault(TConfigurationNode &t_node, const std::string &str_attribute, T &t_buffer, const T &t_default)
Returns the value of a node's attribute, or the passed default value.
ticpp::Element TConfigurationNode
The ARGoS configuration XML node.
btMultiBodyDynamicsWorld & GetWorld()
btScalar GetDefaultFriction() const
virtual void Init(TConfigurationNode &t_tree)
CDynamics3DEngine * m_pcEngine