collision filtering / jit.phys question

zthomas's icon

Hey all,

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.

Thanks,
Zach

Rob Ramirez's icon

hi Zach.
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.

Max6/examples/jitter-examples/render/physics/phys.picker.impulse.maxpat

let me know if you have other questions.

JMC's icon

Hello Robert,

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.

Best,

Jean-Michel

Rob Ramirez's icon

hi jean-michel. thanks for the suggestion.
you should be pleased to know that both these features are planned for a future update.

pry's icon

Hi,
I pick up the thread : is there a way to know "intensity" of a collision between two bodies ?
thanks,

pry

Rob Ramirez's icon

check out the impulse entry of the collisions dictionary

the following patch gives an example of using this:
Max 6.1/examples/jitter-examples/render/physics/phys.world.collision.impulse.maxpat

pry's icon

oups...
Many thanks Rob.

pry