29 #include "btBulletDynamicsCommon.h"
30 #include "BulletDynamics/ConstraintSolver/btSliderConstraint.h"
31 #include "LinearMath/btVector3.h"
32 #include "LinearMath/btTransform.h"
55 tgPrismaticInfo::~tgPrismaticInfo()
64 void tgPrismaticInfo::initConnector(
tgWorld& world)
68 btSliderConstraint* tgPrismaticInfo::createSlider()
70 btRigidBody* fromBody = getFromRigidBody();
71 btVector3 from = getFromRigidInfo()->getConnectionPoint(getFrom(), getTo(), 0);
72 btTransform transATop;
73 transATop.setIdentity();
74 transATop.setOrigin(fromBody->getWorldTransform().inverse() * from);
75 transATop.setRotation(btQuaternion(btVector3(0,0,1),M_PI/2));
77 btRigidBody* toBody = getToRigidBody();
78 btVector3 to = getToRigidInfo()->getConnectionPoint(getTo(), getFrom(), 0);
79 btTransform transBTop;
80 transBTop.setIdentity();
81 transBTop.setOrigin(toBody->getWorldTransform().inverse() * to);
82 transBTop.setRotation(btQuaternion(btVector3(0,0,1),M_PI/2));
84 btSliderConstraint* slider =
new btSliderConstraint(*fromBody, *toBody, transATop, transBTop,
true);
91 tgNode startNode = this->getFrom();
92 tgNode endNode = this->getTo();
94 btVector3 buildVec = (endNode - startNode);
95 double m_startLength = buildVec.length();
99 btSliderConstraint* slider = createSlider();
106 double tgPrismaticInfo::getMass()
virtual void setup(tgWorld &world)
Definition of class tgNode.
Definition of class tgStructureInfo.
Contains the definition of class tgPrismaticInfo. A prismatic actuator builder.
virtual tgConnectorInfo * createConnectorInfo(const tgPair &pair)