nickG wrote:"Static Geometry collision" working only with Ogre->CreateStaticGeometry?
or compatable with Ogre->CreateEntity?
Well, to use static geometry you need to create it and add an entity to it, and the function that creates collision shapes/meshes takes an entity, so it doesn't matter whether you use static geometry or just an entity, the example shows how to use it because it improves performance.
In short, feel free to just do this:
Code: Select all
Ogre::Entity* myEntity = mSceneMgr->createEntity("name", "ogrehead.mesh");
// Create the collision shape and rigid body of our level.
hkpBvTreeShape* groundShape = HkOgre::Cooker::processOgreMesh(myEntity);
hkpRigidBodyCinfo ci;
ci.m_shape = groundShape;
ci.m_motionType = hkpMotion::MOTION_FIXED;
ci.m_position = hkVector4( 0.0f, 0.0f, 0.0f );
ci.m_qualityType = HK_COLLIDABLE_QUALITY_FIXED;
hkpRigidBody* groundBody = new hkpRigidBody(ci);
mWorld->markForWrite();
// Add the ground geometry to the physical world.
mWorld->addEntity(groundBody)->removeReference();
// Remove the reference to our physical
// shape because it's unneeded.
groundShape->removeReference();
mWorld->unmarkForWrite();
That would work perfectly.
Another update: drwbns got the terrain collision building working (a
big thank you to them
), so I need to get to adding that in the primary repository as soon as I can. (Friday, or during the weekend).