void AddRigidBodies() { //add the falling box { hkVector4 halfExtents(0.5f, 0.5f, 0.5f); hkpBoxShape* boxShape = new hkpBoxShape(halfExtents); hkpRigidBodyCinfo ci; ci.m_shape = boxShape; ci.m_position = hkVector4(0, 10, 0); ci.m_motionType = hkpMotion::MOTION_DYNAMIC; boxShape->setRadius(0.001f); const hkReal boxMass(10.0f); hkMassProperties massProps; hkpInertiaTensorComputer::computeShapeVolumeMassProperties(boxShape, boxMass, massProps); ci.setMassProperties(massProps); hkpRigidBody* rigidBody = new hkpRigidBody(ci); boxShape->removeReference(); box = static_cast<hkpRigidBody*>(g_pWorld->addEntity(rigidBody))); rigidBody->removeReference(); } //create the static box where the smaller box will fall { hkVector4 halfExtents(20.0f, 2.0f, 20.f); hkpBoxShape* boxShape = new hkpBoxShape(halfExtents); hkpRigidBodyCinfo ci; ci.m_shape = boxShape; ci.m_position = hkVector4(0, -2, 0); ci.m_motionType = hkpMotion::MOTION_FIXED; boxShape->setRadius(0.001f); hkpRigidBody* rigidBody = new hkpRigidBody(ci); boxShape->removeReference(); g_pWorld->addEntity(rigidBody)->removeReference(); } }