So I have a scene, in which - when loaded it will create, position and scale between 7 - 9 objects (stars) on the screen:
When run - this is a normal result:
Is there a way to detect distance between the instances of the same object, “randomStar”, and if it is less than 30px to add some small amount to X and Y so that the stars can be a bit more spaced out?
Try something like pseudo
if randomStar is in collision with randomStar
randomStar put away object
I would use 2 objects.
A starcreator object and your stars.
Then you create star at starcreator position.
Then you move the starcreator object.
Then you can use starcreator distance to star.
You can use a while loop to create your object, and compare distance with closest object, and if too close, delete it and create another until the distance is acceptable.