How to make separate instances repeal each other?

  • I'm trying to make several instances of the same object repel each other, but I'm having trouble figuring it out. I have a fairly large number of instances of this object, so it would be pretty processor-intense anyway, but that's not the issue. The issue is trying to find a system of loops or something that will make each instance repel every other instance. I can make every instance repel from one specific instance, but that doesn't really get the effect I'm going for. The force applied here would be inversely proportional to the distance between the two of them so that the objects wouldn't just accelerate away forever.

    The reason I'm doing this is because I think it would be a cool way to model a fluid (every particle in the fluid has a little space between the others, so it has room to flow). However, I am also open to suggestions for better ways to do this. Thank you!

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)