[Solved] Making objects stick to one another

Hi, so I am making a game were you are like a bubble and you are collecting other bubbles. But, I am facing a problem. I want the bubbles to connect to the players and also other bubbles that are already connected. I tried to weld the objects using the physics behaviour, but it is very jittery and not reliable and I could not figure out how to connect to other already connected bubbles. I also want the bubbles move with the player and even rotate with it. I tried using IDs but I was not able figure it out also. I also later want to have features that are specific to the connected bubbles (like shooting). Please help me

Here is an image of what I want:

Player: Green circle
Bubbles: Grey circles

(I am making it for a jam, so it would be helpful really fast)

Maybe when the objects are close to each other you can connect them with “Put an object around another”? You can have a variable (called CurrentAngle in my example) that keeps track of where the player is pointing.

1 Like

I had already tried it. It did not work out. Still, really thanks for helping :heart:

If bubble is in collision with player or with a bubble which has connected variable = 1, set connected to 1 and store current distance and angle.
If connected = 1, put bubble around player at distance and angle.

If the player rotates, the bubbles should rotate too.

1 Like

Thanks, it works <3 I will try to share the script ASAP. So, if anyone has the same issue, they can use it

1 Like

Here is the script,

Here I am creating a active bubble when player is in collision with non_active_bubble (Meaning that it is not connected to the player), this can also be done with ID too. Then, I am setting data about the bubbles and then linking it and also making a variable to show the it is connected to the player.

Here, I am checking if it is connected to player and then putting it around it using the data collected when the bubble was stuck to the player

Hope it help someone <3

1 Like