Havok importing convex hulls

Havok importing convex hulls

deltawing1's picture

I've spent like 10 hours on this, please can somebody help.

I'm using Havok to import a .hkx convex hull by using the following code:

hkLoader loader;
hkRootLevelContainer* container = loader.load("hull1.hkx");

That's all good, but how do I actually use "container"? How do I get the information I need from "container" so I can use the data?

In the Havok manual, I need to do this to create a convex hull shape. The data I need to extract from container is the paramter "stridedVerts".

ThkpConvexVerticesShape* pShape = new hkpConvexVerticesShape(stridedVerts, dummyPlaneEquations);

Please help, or else I will fail my uni subject >.<

I'm using Havok to import a .hkx convex hull by using the following code:

hkLoader loader;
hkRootLevelContainer* container = loader.load("hull1.hkx");


That's all good, but how do I actually use "container"? How do I get the information I need from "container" so I can use the data?

In the Havok manual, I need to do this to create a convex hull shape. The data I need to extract from container is the paramter "stridedVerts".

ThkpConvexVerticesShape* pShape = new hkpConvexVerticesShape(stridedVerts, dummyPlaneEquations);

Please help, or else I will fail my uni subject >.<

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

sorry i did a double paste.


see how desparate i am?

havokdaniel's picture

Hi deltawing1,

Once you have the container you can use hkRootLevelContainer::findObjectByType() or hkRootLevelContainer::findObjectByName() to get the shape/entity out of there. If you've made your hull in your modeller and applied the rigid body modifer and named it "myHull1", then doing something like this should work:

hkLoader loader;
hkRootLevelContainer* container = loader.load("hull1.hkx");
hkpRigidBody* myHullRb = reinterpret_cast( container->findObjectByName("myHull1") );

You could use findObjectByType() too:

hkpRigidBody* myHullRb = reinterpret_cast( container->findObjectByType(hkpRigidBodyClass.getName()) );

Hope this works for you.

Daniel

Login to leave a comment.