void Ragdoll_experiment::initializeBodies() { ground = createGround(); ragDoll = createRagdoll(); ground->setFriction(GROUND_FRICTION); ground->setRestitution(GROUND_RESTITUTION); }
HingeHittingTableDemo::HingeHittingTableDemo(hkDemoEnvironment* env) : hkDefaultPhysicsDemo(env) { // Disable warnings: hkError::getInstance().setEnabled(0xafe97523, false); //'This utility is intended primarily for Havok demo use. If you wish to step the world asynchronously,...' enableDisplayingToiInformation(true); // // Setup the camera // { hkVector4 from( 0, 0, 10); hkVector4 to ( 0, 0, 0); hkVector4 up ( 0, 1, 0); setupDefaultCameras(env, from, to, up); } // // Setup and create the hkpWorld // { hkpWorldCinfo info; info.setBroadPhaseWorldSize(150.0f); info.m_collisionTolerance = .03f; info.m_gravity.setZero4(); info.m_simulationType = info.SIMULATION_TYPE_CONTINUOUS; m_world = new hkpWorld( info ); m_world->lock(); hkpAgentRegisterUtil::registerAllAgents( m_world->getCollisionDispatcher() ); setupGraphics(); } const HingeHittingTableDemoVariant& variant = g_variants[this->m_variantId]; // // Collision Filter // { hkpGroupFilter* filter = new hkpGroupFilter(); hkpGroupFilterSetup::setupGroupFilter( filter ); m_world->setCollisionFilter(filter); filter->disableCollisionsBetween(30,30); filter->removeReference(); } // Create a box { hkReal mass = 0.0f; hkVector4 size( 2.0f, 0.2f, 2.0f ); hkVector4 position( 1.0f, 0.0f, 0.0f ); hkpRigidBody* body = HK_NULL; if( 1 ) { // use a hkpBoxShape body = GameUtils::createBox( size, mass, position ); } else { // use a hkpConvexVerticesShape body = GameUtils::createConvexVerticesBox( size, mass, position ); } body->setName("table0"); m_world->addEntity( body )->removeReference(); } hkVector4 pos(-2.0f, 0.0f, 0.0f); hkVector4 vel(45.0f, 0.0f, 0.0f); switch(variant.m_sceneType) { case VARIANT_HINGE: createHinge(m_world, variant.m_objectQualityType, variant.m_constraintPriorityLevel, pos, vel); break; case VARIANT_RAGDOLL: case VARIANT_RAGDOLL_INCREASED_INERTIA: createRagdoll(m_world, variant.m_objectQualityType, variant.m_constraintPriorityLevel, pos, vel, variant.m_sceneType); break; } m_world->unlock(); }