I am looking at a rigid body and I can get the material from it. But i am wondering how I can add custom properties to the material for a rigid body?

I have seen the demo where the Material is customized to have scale data per shape. But how would you do that with a simple cube?
Ie each cube has a sound ID that identifies the sound that should be played on a collision for example.

Am using Maya for the tools.

Also in the demo, how was the data added to the mesh?
Did the artist go in a set a additional data on each section that has a different scale?

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

Hi rbabiak,

There are ways to work with materials, but it can be difficult. If you look at the MeshMaterialsDemo.cpp, the scale factor is added in code. Doing it from a modeller will be a little more difficult, but you can do it with a custom filter. You can check the documentation in Havok Content Tools/Integrating with the Havok Content Tools/Tutorial : Extending the Toolchain for information on that.

However, if you only want to associate a sound with each rigid body, there is an easier way. hkpRigidBodies, and for that case all hkpWorldObjects, have a list of type hkpProperty. You can pretty much put any ID, value pairs you want in there. If you look at Havok Content Tools/The Havok Filter Pipeline/Physics Filters you can find how to create attribute groups in your modeler. If you give your attribute group the name hkProperties and then assign the ID/value pair, it will be picked up by the loader at runtime and assign it to the rigid body as an hkpProperty.

Once you have the property in the system, you can check for that property in your own hkCollisionListener. You overwrite the callbacks for this interface to do things when contact points are created, destroyed, processed, etc.

How you want to index sounds or layout your sound system is up to you. I hope this gives you a good place to get started.


Developer Support Engineer Havok

Ok that makes sense.
using the hkPropertys I can assign a value pair to a rigid body.

If the Rigid body is a mesh, is there a way to assign a property to it per face?

For example if I have a cube as a mesh (6 faces) can I assign a value pair to each face?

The in game example I am trying to do is to tag some of the poly's in the physics world to be roads, sidewalks, and grass.

As my factious example above, I would want each sidewalk poly to make a sound like a wooden boardwalk, while the street would sound like stone, and the grass like, well grass...

so for the big mesh I have that is the ground, how do I paint/ assign a material/ attribute to each face? Will i need to write a custom filter to get these attributes from Maya into the shape faces when loaded in Havok?

Hi rbabiak,

take a look here:

Hope this helps,

Thanks S_W

Login to leave a comment.