unhandled exception hkpWorld() and hkpBoxShape()

unhandled exception hkpWorld() and hkpBoxShape()

viperld's picture

Hello.

I have a VS2010 project using Havok. I've followed instructions for setting up the project here: http://marcoarena.wordpress.com/2011/04/17/nice-to-meet-you-havok/.

The standalone "hello world" project works just fine but when I try to make a basic use of Havok in my actual project I get "unhandled exception" errors from calls to hkpWorld() and hkpBoxShape().

I've put up my Havok code here: http://pastebin.com/tQ1CiSRU.

I'm really not sure what it is i'm missing. I feel like I'm not doing anything special and that there's something I'm not including but I'm using the same settings as my functioning Havok project.

I've read the documentation but I'm new to Havok and really am lost. Let me know if there is anything else you need.

Thanks for your time.

3 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.
viperld's picture

I believe I've solved my problem.

My understanding of Havok is still incomplete but it seems to be that initialization of the base system and world, as well as the quiting, needs to all take place in the same scope.

I have placed them all into the same scope and my world is being created just fine.

havokTyler's picture

Hi, this looks like a fairly common problem. Here's a another thread with the same issue:http://software.intel.com/en-us/forums/showthread.php?t=80707(see 3rd post). And the same kind of issue here:http://software.intel.com/en-us/forums/showpost.php?p=178103

The problem is your hkMallocAllocator is going out of scope. Since this is just in your main thread the easiest solution is mentioned in the first post - switch to using 'hkMallocAllocator::m_defaultMallocAllocator' which already exists at a global scope and will not be destructed for the duration of the application.

-Tyler

PS. I'm going to go ahead an change the Havok demos that use the stack allocated hkAllocators in main() to usehkMallocAllocator::m_defaultMallocAllocator instead since it seems to be causing a lot of confusion.

Login to leave a comment.