collision filtering / jit.phys question
I am currently attempting to use collision hits amongst rigid bodies to trigger audio events. My current problem lies in the ability to filter out "repeated" events from frame to frame; i.e., collisions are updated on account of their duration, so if a collision lasts longer than a single frame it gets reported multiple times. I’d like to filter out these multiple-reported collisions and only accept the "new" ones. I imagine there is some way to do this that I have yet to foresee. Perhaps by comparing reports from successive frames using dict.route? (storing the delayed frame in a second dictionary) or even something simpler? Any insight is appreciated.
i thing the easiest way to determine if a collision is new, is to look at the duration field of the collision dict entry.
if it’s new, the duration will be 0.
check out the following example patch, and look inside the collision-sound sub-patch for a basic example of filtering new collisions.
let me know if you have other questions.
will it be possible in a next release of max to have:
1) an information on the velocity of the collision (or a force) at duration = 0 (the best will be to have this value for the 3 axis). I’ve used this information within Box2D to adjust the gain of a sound associated to a collision (this is not the case in phys.picker.impulse.maxpat); I will be happy to do the same with the Max6 physics objects.
2) a "collisions" arguments on jit.phys.body, jit.phys.ghost and jit.phys.multiple to handle collisions that are specific to the object through the rightest outlet. This way, it will be easer to filter collisions for a given object.
hi jean-michel. thanks for the suggestion.
you should be pleased to know that both these features are planned for a future update.
I pick up the thread : is there a way to know "intensity" of a collision between two bodies ?
check out the impulse entry of the collisions dictionary
the following patch gives an example of using this:
Many thanks Rob.
Forums > MaxMSP