Loading...
You are not logged-in Login/Register





  • Posts   Search Threads
  • pjstyleOctober 1, 2008 7:08 AM PDT   
    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



    sean.thurstonOctober 1, 2008 12:07 PM PDT
    Rate
     
    Re: Importing 3dsmax scene into direct3d environment

    Hi Pieter Ted de Vries,

    The output there is becuase you didn't initialize thread memory. If you take a look at the ConsoleExampleMt, it shows how to setup the memory system. It is in the StandAloneDemos folder.

    The second one there is an assert used for debugging purposes. There is a difference between asserts and crashes, just throwing that out there for everyone. What's going on with this one is that you are loading the your information from a packfile, which is fine. But, the packfiledata is then being freed when the initialize method exists. What you want to do is keep that packfiledata around until the end of the simulation. So, you might want to store it as a member variable of your simulation. You might need to call addReference() on it so that when the loader exits, it doesn't take the packfiledata with it.

    There was a post about this buried in another thread: http://software.intel.com/en-us/forums/showthread.php?t=59587page/2

    It is like a few posts from the bottom. I'm glad this came up in its own thread though.

    Let me know if that helps.

    Thanks,
    Sean



    Developer Support Engineer
    Havok
    www.havok.com

    pjstyleOctober 1, 2008 1:09 PM PDT
    Rate
     
    Re: Importing 3dsmax scene into direct3d environment

    Hi Sean,

    I have made the hkLoader class a member variable of my game class and now i can add the rigid bodies to my Havok world. Thanks!

     

    Regards,

    Ted



Forum jump:  

Intel Software Network Forums Statistics

17,025 users have contributed to 48,321 threads and 172,762 posts to date.

In the past 24 hours, we have 11 new thread(s) 45 new posts(s), and 38 new user(s).

In the past 3 days, the most popular thread for everyone has been Optimalization of sine function\'s taylor expansion The most posts were made to Most likely, the issue is that The post with the most views is Optimalization of sine function\'s taylor expansion

Please welcome our newest member mehakchehal52


For more complete information about compiler optimizations, see our Optimization Notice.