I have a car with two wheels, connected by revolute joints. I would like to know the impact during collision and apply damage if the car falls from a great height.
I'm using ContactEvent.POST_SOLVE and calculate impulse (found in another topic) with:
var normalImpulse:Number = Math.sqrt( (impulse.normalImpulse1*impulse.normalImpulse1) + (impulse.normalImpulse2*impulse.normalImpulse2) );
This seems to work for the most part but sometimes I'm impulse getting values that are high for certain situations.
I'm not sure how these contact listeners work exactly, but is ContactEvent.POST_SOLVE being called more than once during the same frame event normal? I guess if the object happens to contact two other objects it's reasonable but my main issue is: what if the object is only in contact with one other object and it happens during a frame event well after contact? First impact values are usually reasonable and then, during the second or third ContactEvent.POST_SOLVE a larger value (about 10 - 50 times heigher). That value is even larger than if the car falls from a great height.
I added a check that during one frame event only consider the first ContactEvent.POST_SOLVE and seems to solve the problem. But I'm wondering if by ignoring the other values, perhaps in some cases some actual values may be ignored.
I'm using ContactEvent.POST_SOLVE and calculate impulse (found in another topic) with:
var normalImpulse:Number = Math.sqrt( (impulse.normalImpulse1*impulse.normalImpulse1) + (impulse.normalImpulse2*impulse.normalImpulse2) );
This seems to work for the most part but sometimes I'm impulse getting values that are high for certain situations.
I'm not sure how these contact listeners work exactly, but is ContactEvent.POST_SOLVE being called more than once during the same frame event normal? I guess if the object happens to contact two other objects it's reasonable but my main issue is: what if the object is only in contact with one other object and it happens during a frame event well after contact? First impact values are usually reasonable and then, during the second or third ContactEvent.POST_SOLVE a larger value (about 10 - 50 times heigher). That value is even larger than if the car falls from a great height.
I added a check that during one frame event only consider the first ContactEvent.POST_SOLVE and seems to solve the problem. But I'm wondering if by ignoring the other values, perhaps in some cases some actual values may be ignored.