I have just updated my code from Havok 6.6.0 to the last release. Reading the documentation, I have been pleased to see that the collision callback system have been improved. in particular, I was interested in the newTYPE_MANIFOLD_AT_END_OF_STEP contact type that makes getting contact information after the solving step much easier. However, even with this new contct type, I can not get the impulse applied by the solver for most contacts !
I have set theregisterForEndOfStepContactPointCallbacks(event) andinfo.m_fireCollisionCallbacks = true; properly, I set therigidBody->setContactPointCallbackDelay(0); to 0 just in case... All the callback system works well... Except the getImpulseApplied value that is stuck to 0, unless the contact point lasts several frames.
For example, I set up a ball to hit and bounce against a wall with a certain velocity. This generates a brief contact that generates 2 or 3 callback calls, but none of them has an appliedImpulse greater than zero. Does anybody know how to get the impulse applied ? By the way, in my case it is important to get the actual impulse applied at each contact point, not an approximation based on the change of velocity.
Hi Loeiz,
Unfortunately, there is no way to get the applied impulse value from the callback (even the end of step) since it calculates that information afterwards. The usual workaround is, like you suggested, to use the velocities to approximate the impulse, but since you want the exact impulse I'm afraid there's no way to do that--at least not without source level access to the SDK. :/
Best regards,
--Joel
Thank you for the answer. This is indeed curious that this informmation is not available, as it is a relevant information for the different events of the game (e.g. setting the volume of the contact sound w.r.t. the impulse applied).
However, I found a member called m_internalSolverData in the contact properties, that seems to be completely related to the impulse applied. According to my measures on a sphere-plane contact, this value is proportionnal to the velocity of approach, and proportionnal to the time step used. this may be the coefficient applied for the contact point in the linear system being solved ? In that case, the impulse applied could be deduced... Could you tell more about this value ?
Getting impulses applied with Havok 2011.3.0.1
Hi all,
I have just updated my code from Havok 6.6.0 to the last release. Reading the documentation, I have been pleased to see that the collision callback system have been improved. in particular, I was interested in the newTYPE_MANIFOLD_AT_END_OF_STEP contact type that makes getting contact information after the solving step much easier. However, even with this new contct type, I can not get the impulse applied by the solver for most contacts !
I have set theregisterForEndOfStepContactPointCallbacks(event) andinfo.m_fireCollisionCallbacks = true; properly, I set therigidBody->setContactPointCallbackDelay(0); to 0 just in case... All the callback system works well... Except the getImpulseApplied value that is stuck to 0, unless the contact point lasts several frames.
For example, I set up a ball to hit and bounce against a wall with a certain velocity. This generates a brief contact that generates 2 or 3 callback calls, but none of them has an appliedImpulse greater than zero. Does anybody know how to get the impulse applied ? By the way, in my case it is important to get the actual impulse applied at each contact point, not an approximation based on the change of velocity.
Thanks in advance,
Loeiz.