35 #include "LinearMath/btVector3.h"
63 origin = btVector3(0,0,0);
67 origin = btVector3(center.getX(), center.getY(), center.getZ());
73 const tgBox::Config boxConfig(c.width, c.height, c.density, c.friction, c.rollFriction, c.restitution);
81 spec.addBuilder(
"box",
new tgBoxInfo(boxConfig));
99 throw std::invalid_argument(
"dt is not positive");
118 const int nBoxes = 1;
121 btVector3 rotationPoint = origin;
122 btVector3 rotationAxis = btVector3(0, 1, 0);
123 double rotationAngle = 0.0;
127 for(std::size_t i=0;i<nodes.size();i+=2) {
133 s.
addRotation(rotationPoint, rotationAxis, rotationAngle);
137 void Wall::addBoxNodes() {
139 node =
tgNode(-100.0, 0.0, 0.0,
"node");
141 nodes.push_back(node);
143 node =
tgNode(100.0, 0.0, 0.0,
"node");
145 nodes.push_back(node);
Create a box shape as an obstacle or add it to your tensegrity.
virtual void setup(tgWorld &world)
virtual void setup(tgWorld &world)
virtual void step(double dt)
virtual void onVisit(const tgModelVisitor &r) const
Class that interfaces with Bullet to build the boxes.
void addPair(int fromNodeIdx, int toNodeIdx, std::string tags="")
void addRotation(const btVector3 &fixedPoint, const btVector3 &axis, double angle)
virtual void onVisit(tgModelVisitor &r)
virtual void step(double dt)
Definition of class tgNode.
Definition of class tgStructure.
Definition of class tgStructureInfo.
Definition of class tgBuildSpec.
void notifyStep(double dt)
void buildInto(tgModel &model, tgWorld &world)
void addNode(double x, double y, double z, std::string tags="")