Adding entities to the world from .hkx files

Adding entities to the world from .hkx files

Hi all.
I'm trying to load convex hull from .hkx file and add it to the world with:

hkLoader loader;
hkRootLevelContainer* container = loader.load("chair.hkx");
hkpRigidBody* myHullRb = reinterpret_castfindObjectByName("chair_object") );

and then


But last line is generating unhandled exception, and this info:
".\World\hkpWorld.cpp(769): [0x7F090345] Assert: entity
You can not add a null entity to a world."

What's wrong?
Thanks in advance.

2 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Oh, nevermind...
I solved it by using this code instead of previous:

hkpPhysicsData* physicsData;
hkPackfileReader::AllocatedData* loadedData;

hkIstream infile( "chair.hkx" );
if (infile.isOk())
physicsData = hkpHavokSnapshot::load(infile.getStreamReader(), &loadedData);
hkpRigidBody* chair;
chair = physicsData->findRigidBodyByName("chair_object");

Leave a Comment

Please sign in to add a comment. Not a member? Join today