Creating Organic Trigger Interactions with Spring-Mass Model and Randomization

Josef Rebbe's icon

Josef Rebbe

10月 01 2024 | 9:05 午前

Hi everyone,

I’m working on a project in Max where I have a 9x9 grid of 81 triggers. My goal is to create an organic, dynamic system where activating one trigger affects its neighboring triggers in a fluid and chaotic way, similar to how wind chimes respond to each other. Ideally, I’d like to simulate these interactions using a spring-mass physical model and add some randomness for unpredictability.

Here’s what I’m thinking so far:

  1. Grid setup: I’m using a matrixctrl or jit.matrix to represent the grid.

  2. Spring-mass model: I want to use jit.phys.body and jit.phys.6dof to simulate the triggers as masses connected by springs. When a trigger is activated, it would apply a force to its neighboring triggers via these spring connections.

  3. Random elements: I’d like to introduce random forces or delays to make the behavior less uniform and more unpredictable, keeping the system in a constantly evolving state of interaction.

  4. Chaotic triggering: The idea is to have the initial trigger cause a ripple effect that spreads organically through the grid, with some probability of neighboring triggers being activated based on the physics and randomness.

I’m struggling to figure out the best way to implement the physical model in Max and how to integrate the randomness for ongoing chaotic interactions. I’d really appreciate any advice, example patches, or tips on how to approach this!

Thanks so much!

TFL's icon

TFL

10月 01 2024 | 9:35 午前

Reminds me this patch I made for a thread about having sliders as a fluid.

For what you want to achieve I wouldn't go with jit.phys as you want to control single points (and a lot of them), and not volumes. I would do all the calculation directly in jit.gen instead.

Here is a P5JS implementation of a string-mass model applied to a grid of points. It should be a good starting point to implement the same thing in jit.gen.

The first link I posted shows you a basic setup to achieve this kind of thing: named [jit.matrix] for each characteristic of your points (either as single matrices or as planes of the same matrix), a qmetro to send regular bangs to keep the simulation going...

TFL's icon

TFL

10月 01 2024 | 1:25 午後

Rethinking about your request, I was wondering what, for each point of the grid, would be used as a trigger. And I realized that maybe you actually don't want a grid of masses connected by strings, where each point could move toward X and Y directions, but something more like a water ripple simulation, which can be done on a static grid - like your matrixctrl - where each point only have 1 value (its "z" position). And that would make more sense to have events triggered when one point reaches a value above a given threshold.

If I'm thinking right here, then I just found this video explaining how to do exactly than in Max.

Josef Rebbe's icon

Josef Rebbe

10月 04 2024 | 9:37 午後

This is awesome, thank you so much TFL. Very inspiring!