So, this is related to my previous questions, which I have already resolved. It's about pinching an object with collisions. Now, I want to freeze the movement of colliders when they push the object in all directions. I have to generate my own collisions because everything in the scene has fixed positions and I can not use the physical system.
I therefore have 3 scripts: one that calculates the scale of all the motifs of the scene; another who calculates their positions, so they are connected and look like one earth; and the compression script, which contains the bases (each base is a piece of soil directly under this object). If I freeze the ground between the bases, I simulate the collisions because the objects do not move any more.
It's where I suffer. I can get the basics right and left of the pressure colliders, then freeze each lot between them, but there are a lot of problems. First of all, I do not know how many lands will be, so I can not define them in the inspector. Then, the best option is to search by tag, which is not quite sure, but it may be bad for performance. Correct me if I'm wrong, but looking in all the objects of the scene (which is a lot) every object that needs to be compressed every time this happens can be excessive. I'm not sure either of that, but setting the scale of these objects with Mathf.Clamp can create a conflict with the other script that also sets the scale. And to convey this information is difficult because it must constantly be updated in case something changes.
Because of all this, I thought it would be a better idea to do everything in the script to change the scales. But then, it's more difficult to know which objects are the left and right bases, because I get this information in the other OnCollisionStay script. Help?