Hello,
I am attempting to fill a "box" type object that I have with a prefab. To do this, just as a test, I created 5 semi transparent planes with Mesh Colliders [sides / bottom of box] and on scene load, spawned 50 items from an empty game object positioned near the bottom. The problem is, this is causing them to jump everywhere since they are hitting each other, and worse, they are for some reason going through my "sides" when to many items hit one area. I was wondering if there is a better way to go about filling up an area with an array of objects. I need to make sure I take Physics into consideration, since item's can not over lap. The best example would be filling a ball pit with balls.
Below is my coding I am using. I have this attached to an Empty game object, which is my spawn point:
public class FillPrizes : MonoBehaviour {
private System.Collections.Generic.List balls = new System.Collections.Generic.List();
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
if (balls.Count < 50) {
GameObject current = (GameObject)Instantiate(Resources.Load("p_Balls"), transform.position, transform.rotation);
balls.Add(current);
}
}
}