It's a minimalistic wrapper for using Havok with OGRE (as seen by the lazy name that I ripped-off of btOgre which I loved at the time that I used Bullet).
So, this wrapper is pretty much inspired by btOgre and OgrePhysX, both of which provided only what's needed to synchronize your graphics with the physics simulation.
Without further ado, I hereby present to you HkOgre - the Havok integration for OGRE ! (Read that in an epic voice )
[youtube]xYUIr-aHcsI[/youtube]
The code is very minimal and it's basically a collection of functions and a few classes to help you get started with using Havok. (Creating custom collision shapes and synchronizing rigid bodies come to mind.)
The above video showcases the 2 complete working demos that are more or less done, and the last terrain demo which I was working on today. (Special thanks to duststorm for pointing me to and sharing his code for retrieving mesh data from the terrain)
Q: How simple is it to setup rigid body synchronization ?
A: 1 Line of code. What did you expect?
Code: Select all
HkOgre::Renderable* rend = new HkOgre::Renderable(sphereNode, sphereRigidBody, mWorld);
A: Yes, manage your own physical world and simulation using raw Havok code. (The advantage to this is that you can easily implement the demos).
Q: Does HkOgre support Havok animation or ragdolls ?
A: No, sadly not yet, but it is a planned feature.
Q: Can you show me an example of how to setup a collision shape for my level ?
A: If you use 1 mesh for your whole level, like I do for the demos, then it's as easy as this:
Code: Select all
Ogre::Entity* ground = mSceneMgr->createEntity("ground", "Level.mesh");
Ogre::StaticGeometry *sg = mSceneMgr->createStaticGeometry("Level");
const int size = 1300;
sg->setRegionDimensions(Ogre::Vector3(size));
sg->setOrigin(Ogre::Vector3(-size/2, 0, -size/2));
sg->addEntity(ground, Ogre::Vector3::ZERO);
sg->build();
// Create the collision shape and rigid body of our level.
hkpBvTreeShape* groundShape = HkOgre::Cooker::processOgreMesh(ground);
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();
Q: Where can I find the demos and HkOgre itself ?
A: HkOgre is currently hosted on a BitBucket repository. You can grab the code for the demos and HkOgre from there and compile them yourself.
The pre-compiled version of the demo can be downloaded from my MediaFire folder which holds all my contributions for OGRE.
Q: Will you write any tutorials apart from the demos ?
A: Quite possibly, yes. I like using OGRE and Havok, I'll probably write a simple "Getting Started" tutorial very soon.
Q: The source code is not pretty. (Well documented or well-organized). Are you going to prettify it ?
A: Yes, as soon as possible.
Q: Generating collision meshes at runtime is slow - isn't there a tool to make them beforehand ?
A: If you have 3DS Max, Maya, or Softimage XSI available, Havok provides the needed tools to export stuff. But as I don't I'm going to write a .mesh to hkt/hkx converter soon.
Q: What is the license ?
A: HkOgre itself is licensed under the MIT license, like OGRE. So whatever terms apply to OGRE, the same goes for HkOgre too. The demos and resources are an exception. The demos and my original artwork are licensed under the WTFPL, while some of the individual resources, like the Lancer Evolution (vehicle used in the vehicle demo) and some of the textures used in the level are under their own licenses, each of which and the credit they require are included in the distribution.
Q: Which version of Havok do I need to use with HkOgre ?
A: I faced some problems with the regular one, so for now use the noSIMD version.
Update: drwbns found a workaround for this. Just add "HK_CONFIG_SIMD=1" (no quote marks) to your Preprocessor Definitions, and you shouldn't have any problems with the regular, SIMD version.
Q: Where can I find the free version of Havok ?
A: Here: http://www.havok.com/try-havok
Q: I heard Havok isn't open source, what limitations are there ?
A: From Havok's website:
If you have any more questions that I failed to cover do ask and I'll try to answer them as soon as possible.License Requirements:
Havok's Intel® sponsored free binary-only PC download can be used during development to evaluate, prototype, and commercially release any PC game. There are some basic licensing rules to follow:
PC titles sold for a retail value of less than $10.00 USD do not require a Havok distribution license to be executed.
PC titles sold for a retail value of more than $10.00 USD or more do require a Havok license to be executed but at no additional cost.
I'll most definitely write more demos in the future, as Havok has a whole lot of interesting ones.
Also, the vehicle demo is not perfect, because it currently utilizes a barebones vehicle using Havok's vehicle API (it has no wheels, just raycasts, so accuracy is far from it's best side).
TLDR:
-------------------------------------------------------------
What ?
Havok + OGRE = HkOGRE
License: Wrapper - MIT | Demos and Original Artwork - WTFPL
Where ?
Source Here | Precompiled Demos Here (As soon as they're uploaded)
How ?
Easy! Example (Or scroll up a bit)
-- I wanted to make the Q&A a bit more lighthearted, sorry if I went a bit over the top and made myself sound like a crappy salesman...