2
\$\begingroup\$

For a game I'm programming I'm looking for a kind of realistic mechanic for simulating the tearing apart of objects. Let me explain:

I have a given point p in a 2-dimensional space (possible later also more dimensions so a solution should be scalable, which i assume is not the problem) and I have a number of forces f1, f2, ..., fn acting on this point p. So normally this point moves over time according to the combination of this forces. But now I'm looking for a kind of realistic mechanic that if forces vary strongly the point/objects gets split up in two points/objects that move in different directions.

Here a simple visual example:

enter image description here

three "similar" forces resulting in one single force (the point will move according to this single vector)

enter image description here

three forces that "tear" the point apart and result in two vectors (point will be split up in two new points that move according two the respective vector)

I amuse we need two give the point some kind of inner force, that defines how easy it is to tear the point apart?

By kind of realistic I mean something that doesn't need to be extremely realistic according to the real world physics but something that would fell kind of real in a video game. So an additional benefit would be that it can be easily computed.

\$\endgroup\$

1 Answer 1

1
\$\begingroup\$

Hello and welcome to the site! That's an interesting question, and here are my first thoughts about it.

First of all, you need to find the two most "opposite" resulting forces, like in your second image. If a tear should happen, it will happen there.

Naively (there's probably a better way), that means testing all combinations of adding two groups of vectors. If you have n forces, you'll have to test 2^(n-1) - 1 combinations (the -1 is because we don't care about "all forces against none"). For example, in your second image, you could have :

  • UP competing against RIGHT and DOWN
  • RIGHT competing against UP and DOWN
  • DOWN competing against UP and RIGHT

Add a fourth force, and that will be four more possibilities. Again, maybe there's a way to discard some obvious "bad competitions", but if you don't have to manage too much forces, even exponential complexity can do the trick.

Then, you'll have to decide wich pair of forces is the most "tearing" one. And the math seems pretty simple: you just have to look for the weakest vector (in magnitude) and apply a coefficient depending on the angle between the vectors, in that case the opposite value of the cosinus function.

Tearing = - min(Vector_magnitude) * cos(Vectors_angle)

Here are some examples:

  • Two perfectly opposite (angle = PI) forces of magnitude 5 and 8 : Tearing = - 5 * -1 = 5
  • Two rouglhly opposite (PI > angle > PI/2) forces of magnitude 5 and 8 : Tearing = - 5 * -0.x = anything between 0 and 5
  • Two perpendicular (angle = PI/2) forces of magnitude 5 and 8 : Tearing = - 5 * 0 = 0
  • Two rouglhly colinear (PI/2 > angle > 0) forces of magnitude 5 and 8 : Tearing = - 5 * 0.x = some negative value, because of course there's no tearing since the forces both work in the same general direction

Find the grouping of forces with the highest tearing value, and compare that value with the "tearing resistance" of your object. If it's higher, your object split between the two resulting forces.


Here is an example with 3 forces A, B and C, and some eyeballed values. We can see that the biggest tear value happen when A and B pull against C (which indeed seems to be the biggest "fight"), with a tear factor of 5.7

enter image description here

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .