Pretty much what the title says. I’ll explain what I need it for. Basically if you break a crate or something (or even drop an item on the ground, or die and drop all your items) there will be an anchored and non collidable cylinder that will basically work as the hitbox for each item. I don’t want the player colliding with them but I want them to push eachother away in order to prevent items from piling up in one spot (think magnets pushing eachother away).
Well obviously if you just make them collidable and not-anchored they will push eachother away, but that comes with a lot of it’s own problems I just don’t know how to separate the items based on them overlapping. Basically the closer to the center it is it should be pushed harder and away in the direction it most closely is facing and only on the x and z axis I don’t want them moving up or down really at all.
I already have a crate which randomly spawns 1-4 of these cylinder on the ground in it’s vicinity. I can show that code if needed but I don’t have issues with it, I just don’t know how to make the parts calmly push each other away creating space.
What I’m thinking is if I make a code so that each cylinder will check the position of other cylinders they’re colliding with and given a direction based on the direction opposite of the colliding cylinder(s) and also a speed based on how closely they’re colliding (so if they’re directly on top of eachother they would more quickly disperse) This being said I know it’s complicated and above what I can currently do on my own which is why I’m looking for help on here.