36 for(
int i = 0; i <
m_rigids.size(); i++) {
49 btVector3 sum = btVector3(0.0, 0.0, 0.0);
50 for (
int ii = 0; ii <
m_rigids.size(); ii++)
55 const double totalMass =
getMass();
57 (totalMass == 0.0) ? btVector3(0.0, 0.0, 0.0) : (sum / totalMass);
70 for (
int ii = 0; ii <
m_rigids.size(); ii++)
74 t.setOrigin(t.getOrigin() - com);
107 for (
int ii = 0; ii <
m_rigids.size(); ii++)
116 btRigidBody* rb = tgCast::cast<btCollisionObject, btRigidBody>(
m_collisionObject);
122 btRigidBody* rb = tgCast::cast<btCollisionObject, btRigidBody>(
m_collisionObject);
131 for (
int ii = 0; ii <
m_rigids.size(); ii++) {
132 m_rigids[ii]->setRigidBody(rigidBody);
141 for (
int ii = 0; ii <
m_rigids.size(); ii++) {
142 m_rigids[ii]->setCollisionObject(collisionObject);
149 std::set<tgRigidInfo*> leaves;
150 for (
int ii = 0; ii <
m_rigids.size(); ii++) {
155 const std::set<tgRigidInfo*> compoundLeaves =
157 leaves.insert(compoundLeaves.begin(), compoundLeaves.end());
161 leaves.insert(rigid);
170 for (
int ii = 0; ii <
m_rigids.size(); ii++)
183 for (
int ii = 0; ii <
m_rigids.size(); ii++)
195 std::set<btVector3> contained;
196 for (
int ii = 0; ii <
m_rigids.size(); ii++)
198 const std::set<btVector3> nodes =
m_rigids[ii]->getContainedNodes();
199 contained.insert(nodes.begin(), nodes.end());
std::vector< tgRigidInfo * > m_rigids
virtual bool containsNode(const btVector3 &nodeVector) const
void addChild(tgModel *pChild)
virtual btRigidBody * getRigidBody()
virtual bool sharesNodesWith(const tgRigidInfo &other) const
Definition of class tgCompoundRigidInfo.
virtual double getMass() const
virtual btCollisionShape * getCollisionShape(tgWorld &world) const =0
virtual std::set< tgRigidInfo * > getLeafRigids()=0
std::set< btVector3 > getContainedNodes() const
virtual btVector3 getCenterOfMass() const
virtual void setCollisionObject(btCollisionObject *collisionObject)
virtual btTransform getTransform() const
btCollisionObject * m_collisionObject
virtual btVector3 getCenterOfMass() const =0
tgWorldImpl & implementation() const
virtual void setRigidBody(btRigidBody *const rigidBody)
virtual double getMass() const =0
virtual std::set< tgRigidInfo * > getLeafRigids()
void addRigid(tgRigidInfo &rigid)
void addCollisionShape(btCollisionShape *pShape)
virtual btTransform getTransform() const =0
btCompoundShape * m_compoundShape
virtual btCollisionShape * getCollisionShape(tgWorld &world) const
btCompoundShape * createCompoundShape(tgWorld &world) const