Rigidbodies dont push each other out correctly
Hi, I wanted to create procedural dungeon generation explained in this article link text
i created the random room spawning inside of a circle and added them rigidbodies:
public int count = 50;
public Vector2 size_range = new Vector2(2, 8);
public int circle_size = 15;
// Use this for initialization
void Start ()
{
for(int i = 0; i < count; i++)
{
int width = Random.Range((int) size_range.x, (int) size_range.y);
int height = Random.Range((int) size_range.x, (int) size_range.y);
Vector2 pos = transform.position = Random.insideUnitCircle * circle_size;
GameObject clone = GameObject.CreatePrimitive(PrimitiveType.Cube);
clone.transform.localScale = new Vector3(width, 1, height);
clone.transform.position = new Vector3(pos.x+width/2f, 0, pos.y+height/2f);
clone.AddComponent<Rigidbody>();
clone.GetComponent<Rigidbody>().drag = 30;
clone.GetComponent<Rigidbody>().useGravity = false;
clone.GetComponent<Rigidbody>().constraints = RigidbodyConstraints.FreezeRotation | RigidbodyConstraints.FreezePositionY;
}
The problem is that the rooms dont push out each other completely and still overlap:
Then when I manually select all objects and change their Collision detection, they start moving, but even though i locked their rotation, they still start rotating, when puhsing each other: 
What am i doing wrong? Thanks
Does the article you got this from have a comment section?
Your answer
Follow this Question
Related Questions
Problem: Connecting Procedural Generated Dungeon with Growing Tree Algorithm 0 Answers
Roll a ball- Keys not working 2 Answers
Error CS0103 : The name rb does not exist in the current context 2 Answers
UnassignedReferenceException on rigidbody 0 Answers
Player stuck when jumping into a wall 0 Answers