I’m having trouble figuring out where i’m going wrong. I’m using a mesh.bound to find the size of the next and previous mesh in the queue and using the extent.x and the localscale.x to figure out how far over I would need to move in the x so that they wouldn’t overlap but they still do. In my head it should work lol. What am I overlooking? ![]()
I’ve attached a pic to help explain what i’m trying to achieve.
Any help would be appreciated.
Thanks
void CreateStartingBlock()
{
for(fillBlock = 0.0f; fillBlock < blockSize;)
{
rnd = Random.Range(1,17);
o = (Transform)Instantiate(houses[rnd], transform.position, transform.rotation);
objectQueue.Enqueue(o);
objectList.Add (o);
Mesh oMesh = o.GetComponent<MeshFilter>().mesh;
Bounds oBounds = oMesh.bounds;
int oldIndex = objectList.Count - 1;
Transform oldTransform = objectList[oldIndex];
Mesh nMesh = oldTransform.GetComponent<MeshFilter>().mesh;
Bounds nBounds = nMesh.bounds;
//o.localPosition = nextPosition;
nextPosition.x += (oldTransform.localScale.x / 2) + (o.localScale.x / 2) + oBounds.extents.x + nBounds.extents.x;
o.localPosition = nextPosition;
fillBlock += o.localScale.x + oBounds.size.x;
}
blockComplete = true;
ResetFillBlock();
}


Thanks, I just had to multiply it O_o...Now I just have to fix the loop because it holding on to the wrong Bounds at some point.
– Symphony