void SuspendInactiveAgentsDemo::buildLandscape() { // // Create the ground we'll drive on. // { hkpRigidBodyCinfo groundInfo; // // Set the if condition to 0 if you want to test the heightfield // const int dim = 64; const hkReal s = 0.3f; if ( this->getDemoVariant() == 1 ) { // Triangle mesh FlatLand* fl = new FlatLand( dim ); m_landscape = fl; hkVector4 scaling( s,0.0f,s ); fl->setScaling( scaling ); groundInfo.m_shape = fl->createMoppShape(); //groundInfo.m_position.setMul4( -0.5f * dim, scaling ); groundInfo.m_position(1) = 0; } else if (getDemoVariant() == 0) { // Heightfield hkpSampledHeightFieldBaseCinfo ci; ci.m_xRes = dim; ci.m_zRes = dim; ci.m_scale.set( s, 0.5f, s ); m_landscape = HK_NULL; groundInfo.m_shape = new SuspendInactiveAgentsDemoSampledHeightFieldShape( ci ); groundInfo.m_position.set(-0.5f * ci.m_xRes * ci.m_scale(0), -2.0f, -0.5f * ci.m_zRes * ci.m_scale(2)); } else { // Warm starting collision manifold FlatLand* fl = new FlatLand( 2 ); fl->setTriangleRadius(0); m_landscape = fl; hkVector4 scaling( 100,0,100); fl->setScaling( scaling ); groundInfo.m_shape = fl->createMoppShape(); } { groundInfo.m_motionType = hkpMotion::MOTION_FIXED; groundInfo.m_friction = 2.0f; if (getDemoVariant() == 2) { groundInfo.m_position.set(50,0,50); } hkpRigidBody* groundbody = new hkpRigidBody(groundInfo); m_world->addEntity(groundbody); groundbody->removeReference(); } groundInfo.m_shape->removeReference(); } }