determine colors and invisible "handles" in jit.phys environment

Noah's icon

before moving forward with this patch (below) I would like to resolve a couple of things.
Any help / guidance is much appreciated.

first, I have 100 spheres, and I would like to make 25 of them color#1, 25 of them color#2, 25 of them color#3, 25 of them color#4

also, I would like to make the "handles" on the spheres invisible

also interested in any other ideas/directions for improvements

Max Patch
Copy patch and select New From Clipboard in Max.

thank you!

Rob Ramirez's icon

you can use the builtin scanwrap functionality of jit.gl.multiple to do you your colors, simply passing in a 1D 4 cell matrix to the color input, but you have to restructure your position matrix slightly.

for hiding the body handles, simply disable gl.physdraw, or set @draw_bodies 0

Max Patch
Copy patch and select New From Clipboard in Max.

Noah's icon

Rob,

as always, thank you much for the concise and useful answer plus patch.

using the jit.noise object leaves me with one further question,

how would I control the four colors?

Rob Ramirez's icon

my pleasure.

change it to jit.matrix and use the setcell message: setcell 0 val 1 0 0 1, setcell 1 val 1 1 0 0 ... etc..., bang

Noah's icon
Max Patch
Copy patch and select New From Clipboard in Max.

after poking at this for an hour or so I have to admit I don't know how to do what you're suggesting.
not sure what I'm doing wrong, having a difficult time finding any documentation that clarifies
any help is appreciated

Rob Ramirez's icon

you needed to provide a final arg setting the number of cells, and you need to bang the matrix after setting the values.
basic jit.matrix stuff, so make sure you look at jitter tutorial #2 if this doesn't make sense.

Max Patch
Copy patch and select New From Clipboard in Max.

Noah's icon

Thanks again, Rob.
Really appreciate your generosity.

Read through Jitter Tutorial #2 again. I often understand the principles within the tutorial, and then have a difficult time applying them to the specifics of my patch(es).