Rescale Meshes To Fit Within Rect
This is a nut that is a little hard to crack, I feel like. Can't seem to wrap my head around what the best solution would be.. And how to apporach it.
I have a RectTransform. A child of a few parents. I am instantiating up to three prefabs containing meshes within the area of this rect. (Basically spheres) The meshes should have some space appart from eachother as well as the walls of the rect. However, I am also able to resize the window at run time and the meshes are spawning in one at a time, which means they will have to be able to rescale and reposition themselves based on these facors. So my question is: How do I achieve this, without them colliding or getting outside of the rect, and preferably without them reposition themselves too much and jump around whenever the rect is resized?
It's quite the loaded question. It's a lot happening here, but I hope someone can help me out a little bit. I'm trying to create it myself because I know how to do each induvidual step, but not how to put it together in a way that will look good. Perhaps someone has done this before or know how to achieve it in a simple way and can send me on the right track.
The picture explains somewhat what I'm trying to make. A frame that you can resize and X amount of meshes inside that rescales and reposition themselves to fit the area.
Your answer
Follow this Question
Related Questions
Aspect ratio boxes floor 0 Answers
How to place a mesh on a sphere at a certain point? 0 Answers
How to instantiate objects to mesh while restricting the spawn area on a single axis? 2 Answers
Help! Animating hogs my Pos Y. 0 Answers
[Solved] Setting position of rectTransform through anchor presets in code 3 Answers