38 #include "btBulletDynamicsCommon.h"
39 #include "BulletCollision/CollisionDispatch/btGhostObject.h"
62 void tgBasicContactCableInfo::initConnector(
tgWorld& world)
65 m_bulletContactSpringCable = createTgBulletContactSpringCable(world);
75 assert(m_bulletContactSpringCable);
76 return new tgBasicActuator(m_bulletContactSpringCable, getTags(), m_config);
79 double tgBasicContactCableInfo::getMass()
94 btRigidBody* fromBody = getFromRigidBody();
95 btRigidBody* toBody = getToRigidBody();
100 std::vector<tgBulletSpringCableAnchor*> anchorList;
103 anchorList.push_back(anchor1);
106 anchorList.push_back(anchor2);
112 btCompoundShape* m_compoundShape =
new btCompoundShape(&world);
114 btTransform t = transform;
115 btVector3 origin(0.0, 0.0, 0.0);
119 btScalar radius = 0.001;
120 btScalar length = (from - to).length() / 2.0;
121 btBoxShape* box =
new btBoxShape(btVector3(radius, length, radius));
123 m_compoundShape->addChildShape(t, box);
125 btPairCachingGhostObject* m_ghostObject =
new btPairCachingGhostObject();
128 transform.setRotation(btQuaternion::getIdentity());
130 m_ghostObject->setCollisionShape (m_compoundShape);
131 m_ghostObject->setWorldTransform(transform);
132 m_ghostObject->setCollisionFlags (btCollisionObject::CF_NO_CONTACT_RESPONSE);
137 m_dynamicsWorld.addCollisionObject(m_ghostObject,btBroadphaseProxy::CharacterFilter, btBroadphaseProxy::StaticFilter|btBroadphaseProxy::DefaultFilter);
static btDynamicsWorld & worldToDynamicsWorld(const tgWorld &world)
Definition of class tgNode.
static btTransform getTransform(const btVector3 &startOrientation, const btVector3 &start, const btVector3 &end)
Contains the definition of class tgBulletUtil.
Definitions of class tgBulletSpringCableAnchor, formerly muscleAnchor.
virtual btVector3 getConnectionPoint(const btVector3 &referencePoint, const btVector3 &destinationPoint) const =0