Strange behavior with long, thin objects - Inertia ratio?

Strange behavior with long, thin objects - Inertia ratio?

Hello all!

I've gotten very good results with integrating Havok into my game engine. Most objects behave as would be expected. However, two of my game objects are not physically behaving as you would expect. A great sword, and a wooden spear. Sometimes, when dropped, the items will spin around on one end while leaning over very far without dropping onto their sides when you would expect them to.

Although the spear is a capsule, and the sword is a box, both of the objects are long and thin. I looked into it, and found some things mentioned in the documentation about rotational inertia, but I'm not extremely knowledgable about such things. Currently, I'm setting my rigid body inertia using hkpInertiaTensorComputer::computeShapeVolumeMassProperties(). Then after looking around, I stumbled onto hkpInertiaTensorComputer::clipInertia(20.0f,info) being used in DestructibleBridgeDemo.cpp - and, unfortunately, this is the only place I've found it being used on the entire internet. I tried using this method, and it seems to work in correcting some of the behavior of the sword and spear, but I have a few questions..

  1.  Was I doing something wrong in the first place to cause the strange behavior? Or is this normal? 
  2. What effect will clipInertia(20,info) have on normal objects? Am I correct in assuming that clipInertia will have no effect on objects that have relatively similar inertia on each rotational axis?
  3. Is there any situation where I shouldn't use clipInertia()?
  4. Is there a better fix for this situation?

I appreciate any informtation or advice, Thank you







3 帖子 / 0 全新

Hi Bobby,

1) Long thin objects can often cause undesired behaviour. Have you looked at the inertia tensor of your sword/spear in the visual debugger (by turning on the "Inertia Tensors" viewer). What are the dimensions of your sword/spear?
2) Yes you are right, clipInertia() clips the ratio that each axis of the inertia makes with the other axes (in this case to a maximum of 1:20.0). So if the axes are relatively similar there will be little to no effect.
3) Firstly, using clipInertia(20.0f,info) on objects with ratios between their axes less than 20.0 would result in the same inertia, but the clipInertia() function has already done all the calculations so this could be very wasteful if done often. And obviously if you particularly wanted your object's inertia to be long and thin, using clipInertia() would force the inertia to be widened.

As you've noticed, artificially increasing the inertia of a long, thin object so it is less thin (which clipInertia() does), generally results in a more stable simulation. If you've any other questions just let us know.

Amy Developer Support Engineer Havok

Thanks very much for the information. I just wanted to verify where I was headed since I couldn't find any mention of clipInertia in the documentation (or the entire internet) :)