Forums > Jitter

Force for jit.phys.body question

Mar 04 2017 | 2:30 pm

Hi everyone!

I’m quite new to Max and I am struggling with physics to achieve my goal. It is quite specific task that I am doing but I’m sure that it can be done in Max anyway. Sorry in advance for my English hehe :)

I need to create several (let’s say six) jit.phys.bodies that will attract or repel one another with different force. I want them to move in space and stop once they are in balance. In other words I need this bodies to have a grade of attraction in case if there is a line between them (see drawing attached).
You can see in the drawing that body 5 attracts five bodies (3,2,1,2,3) very much and body 1 attracts only body 5 but the grade of attraction of body 1 is minimum. You can see the grade of attraction actually depends on the number of links that each body has. The force that moves each body has to be a sum of vectors. In the last drawing you can see the result of the movement that I am looking for.

I already tried with jit.phys.ghost and jit.phys.bodies @force … but no luck! I feel that it can be done with jit.phys.multiple but don’t quite understand how to do it. Sorry for being such a newbe…

Thanks for your help in advance,

Cheers from Spain :)


  1. dudas


Mar 06 2017 | 8:52 am

what have you tried and what’s not working? post your patch.

Mar 16 2017 | 1:01 pm

Hi Rob,

Thanks for trying to help us! Here is the patch.

Inside you will find four red cubes, each one with its jit.phys.ghost. You have to push 1 and 2 bottons, last one activates attraction force of central cube . Actually all the cubes move to the center until they collide with central cube, which jit.phys.ghost occupies the whole worldbox.

We want these cubes to stop in different distances from the center. For example, we want cube one to stop 4 meters from the center, cube two 6 meters, cube three 8 meters and cube four 10 meters from the center. And we also need them to influence each other, so we are looking for a clue that solves how to make cube 1 repel cube 2, and cube 3 attract cube 4 (but once again stop them before the collision).


Mar 20 2017 | 12:36 pm

i would maybe use additional jit.phys.ghost objects located at the points where you want the phys.bodies to come to rest. you can slow and stop the phys.body movement by increasing the phys.body linear damping (first value of damping attribute) to 1.

for "influence", you can calculate force vectors by subtracting the position of body1 from the position of body2, and scaling that by some amount and applying that as values to the phys.body force attribute. you can combine and average out those vectors for multiple influencers, using simple vector math (vexpr object, or better yet a javascript).

hope that helps

Viewing 4 posts - 1 through 4 (of 4 total)

Forums > Jitter