Spawning objects overlapping and pushing each other

Hey guys, I’m trying to create a game which guys holding the balloons and balloons spawning every few seconds. My problem is without rigidbody balloons I spawn overlapping each other and with rigidbodies balloons pushing each other. I want spawning ballons to squeeze each other and look like bouquet of flowers. My spawn code is below. Thanks for your help.

public class Balloon : MonoBehaviour
{
    public List<GameObject> targets;
    private GameObject player;
    public float Timer = 2;
    // Start is called before the first frame update
    void Start()
    {
        player = GameObject.Find("Player");


    }

    // Update is called once per frame
    private void Update()
    {
        Timer -= Time.deltaTime;
        if (Timer <= 0f)
        {
            StartCoroutine(SpawnTarget());
            Timer = 2f;
        }
    }

    IEnumerator SpawnTarget()
    {
        yield return new WaitForSeconds(Random.Range(1, 1.5f));
        int index = Random.Range(0, targets.Count);
        GameObject newBalloons= Instantiate(targets[index], new Vector3 (transform.position.x,(transform.position.y+0.8f),transform.position.z), Quaternion.identity, transform) as GameObject;
        newBalloons.transform.parent = transform;
    }
}

Im guessing you want them to act like helium balloons. You hold multiple helium balloons on string and they will clump together above your head. Because this is basically a physics simulation, you are going to need Rigidbodies. You could of course fake it by just giving the balloon a certain position, in that case you don’t need rigidbodies but they will not interact with each other.


The code you are using now, does exactly what it is supposed to do. But if you want your balloons to act balloon-like you are either going to have to fake it (animations, translations that kinda stuff) or make a structure that will be similar to the balloons. For instance, you could create a ball joint at the hand, with a string (read stick) attached to that. Then you add another ball joint at the end of the string and add your balloon there. Helium balloons have buoyancy, so you just add a little bit of force continuously upwards. The balloons will hinge on the hand so will rotate upwards, colliding with each other above.


Thought it would be best to add an example so you can see how it would look. In the below picture you see a hand (cube). The balloons are all the same, at the little spheres there are joints. Bottom spheres are connected to the hand, top spheres connect the strings to the balloons. The balloons themselves have a script attached to them, adding a little bit of force upwards in the update function. The top picture is the object as is, bottom picture is during Play Mode. The effect of this is also, that if you move the hand, the balloons will also interact with the movement.


This is of course just a ball on a stick, so it will act like a ball on a stick. It’s all up to you to make it as realistic as you want, but it sure looks like a bouquet of balloons to me. (As long as you dont move it, but let’s not talk about that…)

Yeah I want my character to hold ballons from bottom of the stick/rope. Should I use hinge joint for that or is there some other way ?