MCPcopy Create free account
hub / github.com/bulletphysics/bullet3 / createSoftBody

Method createSoftBody

examples/ExtendedTutorials/SimpleCloth.cpp:105–127  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

103}
104
105void SimpleClothExample::createSoftBody(const btScalar s,
106 const int numX,
107 const int numY,
108 const int fixed)
109{
110 btSoftBody* cloth = btSoftBodyHelpers::CreatePatch(softBodyWorldInfo,
111 btVector3(-s / 2, s + 1, 0),
112 btVector3(+s / 2, s + 1, 0),
113 btVector3(-s / 2, s + 1, +s),
114 btVector3(+s / 2, s + 1, +s),
115 numX, numY,
116 fixed, true);
117
118 cloth->getCollisionShape()->setMargin(0.001f);
119 cloth->getCollisionShape()->setUserPointer((void*)cloth);
120 cloth->generateBendingConstraints(2, cloth->appendMaterial());
121 cloth->setTotalMass(10);
122 //cloth->m_cfg.citerations = 10;
123 // cloth->m_cfg.diterations = 10;
124 cloth->m_cfg.piterations = 5;
125 cloth->m_cfg.kDP = 0.005f;
126 getSoftDynamicsWorld()->addSoftBody(cloth);
127}
128
129void SimpleClothExample::renderScene()
130{

Callers

nothing calls this directly

Calls 7

appendMaterialMethod · 0.80
btVector3Class · 0.50
setMarginMethod · 0.45
getCollisionShapeMethod · 0.45
setTotalMassMethod · 0.45
addSoftBodyMethod · 0.45

Tested by

no test coverage detected