Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2012
494
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.98 KB | None | 0 0
  1.         Ogre::Entity* ground = mSceneMgr->createEntity("ground", "Level.mesh");
  2.         Ogre::StaticGeometry *sg = mSceneMgr->createStaticGeometry("Level");
  3.         const int size = 1300;
  4.         sg->setRegionDimensions(Ogre::Vector3(size));
  5.         sg->setOrigin(Ogre::Vector3(-size/2, 0, -size/2));
  6.         sg->addEntity(ground, Ogre::Vector3::ZERO);
  7.         sg->build();
  8.  
  9.         // Create the collision shape and rigid body of our level.
  10.         hkpBvTreeShape* groundShape = HkOgre::Cooker::processOgreMesh(ground);
  11.         hkpRigidBodyCinfo ci;
  12.         ci.m_shape = groundShape;
  13.         ci.m_motionType = hkpMotion::MOTION_FIXED;
  14.         ci.m_position = hkVector4( 0.0f, 0.0f, 0.0f );
  15.         ci.m_qualityType = HK_COLLIDABLE_QUALITY_FIXED;
  16.         hkpRigidBody* groundBody = new hkpRigidBody(ci);
  17.  
  18.         mWorld->markForWrite();
  19.         // Add the ground geometry to the physical world.
  20.         mWorld->addEntity(groundBody)->removeReference();
  21.  
  22.         // Remove the reference to our physical
  23.         // shape because it's unneeded.
  24.         groundShape->removeReference();
  25.         mWorld->unmarkForWrite();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement