Importing 3dsmax scene into direct3d environment
Hey there, I am trying to import the data from a hkx, i have the following data imported so far: - The havok world - Geometry of objects Now i have retrieved the rigid bodies connected to the objects in the scene, but when i try to add the rigid bodies to the havok world my game crashes. My log contains the following: No thread memory manager specified. You must specify a thread memory manager when initializing hkBaseSystem. .EntityhkpEntity.cpp(262): [0x140a19b8] Assert : 'getWorld() == HK_NULL removeReference() or destructor called while hkpEntity is still in simulation' Here's a snippit from my import sourcecode: void Game::Initialize()
{
hkLoader loader;
hkRootLevelContainer* container = loader.load("../../../GameAssets/Max Scenes/Scene.hkx");
hkxScene* scene = (hkxScene*)container->findObjectByType("hkxScene");
hkpPhysicsData* physicsData = (hkpPhysicsData*)container->findObjectByType("hkpPhysicsData");
// Retrieve world
m_world = new hkpWorld(*physicsData->getWorldCinfo());
if(m_world != HK_NULL)
{
//
// Register the box-box collision agent
//
{
hkpAgentRegisterUtil::registerAllAgents(m_world->getCollisionDispatcher());
}
m_world->lock();
for(int i=0;i<scene->m_numMeshes;i++)
{
char rigidBodyName[10];
sprintf(rigidBodyName, "Box0%d", i + 1);
hkxMesh* mesh = scene->m_meshes[i];
hkpRigidBody* body = physicsData->findRigidBodyByName(rigidBodyName);
if(body != HK_NULL)
{
SimpleHavocObject* obj = new SimpleHavocObject(
m_device,
D3DXVECTOR3(1,0,0),
D3DXVECTOR3(0,0,0),
mesh);
obj->SetRigidBody(body);
// Add rigidbody to Havok world
m_world->addEntity(body);
objects.push_back(obj);
}
}
m_world->unlock();
}
}Thanks in advance, Pieter Ted de Vries
|