Game Development Reference
In-Depth Information
Creating a box
Creating a box-shaped rigid body is fairly simple; all of the code to create one can
be found in the CreateObjects() function of this chapter's source code. We simply
create the three modular components described previously (motion state, collision
shape, and collision object), hook them together, and then inform the world object of
its existence through addRigidBody() . The only awkward step is of using btRi-
gidBodyConstructionInfo . This object is an intermediate step in creating btRi-
gidBody and requires the mass, motion state, and collision shape objects before it
can be built, although it has other properties that can be modified such as the coeffi-
cients of restitution (how much it bounces), and friction.
btRigidBody::btRigidBodyConstructionInfo
rbInfo(1.0f, m_pMotionState, pBoxShape);
btRigidBody* pRigidBody = new
btRigidBody(rbInfo);
Search WWH ::




Custom Search