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

Method initPhysics

examples/ExtendedTutorials/SimpleCloth.cpp:72–103  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

70};
71
72void SimpleClothExample::initPhysics()
73{
74 m_guiHelper->setUpAxis(1);
75
76 createEmptyDynamicsWorld();
77
78 m_guiHelper->createPhysicsDebugDrawer(m_dynamicsWorld);
79
80 if (m_dynamicsWorld->getDebugDrawer())
81 m_dynamicsWorld->getDebugDrawer()->setDebugMode(btIDebugDraw::DBG_DrawWireframe + btIDebugDraw::DBG_DrawContactPoints);
82
83 ///create a few basic rigid bodies
84 btBoxShape* groundShape = createBoxShape(btVector3(btScalar(50.), btScalar(50.), btScalar(50.)));
85 m_collisionShapes.push_back(groundShape);
86
87 btTransform groundTransform;
88 groundTransform.setIdentity();
89 groundTransform.setOrigin(btVector3(0, -50, 0));
90 {
91 btScalar mass(0.);
92 createRigidBody(mass, groundTransform, groundShape, btVector4(0, 0, 1, 1));
93 }
94
95 {
96 const btScalar s = 4; //size of cloth patch
97 const int NUM_X = 31; //vertices on X axis
98 const int NUM_Z = 31; //vertices on Z axis
99 createSoftBody(s, NUM_X, NUM_Z);
100 }
101
102 m_guiHelper->autogenerateGraphicsObjects(m_dynamicsWorld);
103}
104
105void SimpleClothExample::createSoftBody(const btScalar s,
106 const int numX,

Callers

nothing calls this directly

Calls 9

btVector4Class · 0.85
getDebugDrawerMethod · 0.80
setDebugModeMethod · 0.80
btVector3Class · 0.50
setUpAxisMethod · 0.45
push_backMethod · 0.45
setIdentityMethod · 0.45

Tested by

no test coverage detected